diff --git a/.bazelrc b/.bazelrc index 615785d2b267..6f7a24ff8942 100644 --- a/.bazelrc +++ b/.bazelrc @@ -140,6 +140,13 @@ build:remote --remote_executor=remotebuildexecution.googleapis.com # retry mechanism and we do not want to retry unnecessarily if Karma already tried multiple times. test:saucelabs --flaky_test_attempts=1 +################ +# Flag Aliases # +################ + +# --ng_perf will ask the Ivy compiler to produce performance results for each build. +build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf + #################################################### # User bazel configuration # NOTE: This needs to be the *last* entry in the config. diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c4b7c5ab215..d08d898225d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,47 @@ +# 12.0.0-next.6 (2021-03-24) + + +### Bug Fixes + +* **animations:** cleanup DOM elements when the root view is removed ([#41059](https://github.com/angular/angular/issues/41059)) ([c49b280](https://github.com/angular/angular/commit/c49b28013a6c017c9afc73bbc00bb4fdcf15c70e)) +* **compiler-cli:** add `useInlining` option to type check config ([#41043](https://github.com/angular/angular/issues/41043)) ([09aefd2](https://github.com/angular/angular/commit/09aefd29045db77689f4dc16a6abae09a79cfb81)), closes [#40963](https://github.com/angular/angular/issues/40963) +* **core:** detect synthesized constructors that have been downleveled using TS 4.2 ([#41305](https://github.com/angular/angular/issues/41305)) ([274dc15](https://github.com/angular/angular/commit/274dc15452739e4fab2f647804a64d5b797cfed5)), closes [#41298](https://github.com/angular/angular/issues/41298) +* **ngcc:** detect synthesized constructors that have been downleveled using TS 4.2 ([#41305](https://github.com/angular/angular/issues/41305)) ([8d3da56](https://github.com/angular/angular/commit/8d3da56eda12070df1fb473c8609f3a94d77bfd6)), closes [#41298](https://github.com/angular/angular/issues/41298) +* **router:** fragment can be null ([#37336](https://github.com/angular/angular/issues/37336)) ([b555160](https://github.com/angular/angular/commit/b5551609fe02787641bdfdb0a6edfded413a3b52)), closes [#23894](https://github.com/angular/angular/issues/23894) [#34197](https://github.com/angular/angular/issues/34197) + + +### Features + +* **router:** add migration for ActivatedRouteSnapshot.fragment ([#41092](https://github.com/angular/angular/issues/41092)) ([190fa07](https://github.com/angular/angular/commit/190fa07b9a416defb581d2bf76d1deef7baefce6)), closes [#37336](https://github.com/angular/angular/issues/37336) + + +### BREAKING CHANGES + +* **animations:** DOM elements are now correctly removed when the root view is removed. +If you are using SSR and use the app's HTML for rendering, you will need +to ensure that you save the HTML to a variable before destorying the +app. +It is also possible that tests could be accidentally relying on the old behavior by +trying to find an element that was not removed in a previous test. If +this is the case, the failing tests should be updated to ensure they +have proper setup code which initializes elements they rely on. +* **router:** Strict null checks will report on fragment potentially being null. +Migration path: add null check. + + + +## 11.2.7 (2021-03-24) + + +### Bug Fixes + +* **compiler:** correctly process multiple rules containing `:host` selectors ([#41261](https://github.com/angular/angular/issues/41261)) ([f358d6b](https://github.com/angular/angular/commit/f358d6b113e1a8215fcb50dbc3c5db8799699901)), closes [#41237](https://github.com/angular/angular/issues/41237) +* **compiler-cli:** add `useInlining` option to type check config ([#41268](https://github.com/angular/angular/issues/41268)) ([57644e9](https://github.com/angular/angular/commit/57644e95aadbfe9c8f336be77a22f7a5e1859758)), closes [#40963](https://github.com/angular/angular/issues/40963) +* **core:** remove obsolete check for [class] and [className] presence ([#41254](https://github.com/angular/angular/issues/41254)) ([8a53b54](https://github.com/angular/angular/commit/8a53b5454eea7b4db09498d9018687aa0b0ca7f3)) +* **language-service:** show suggestion when type inference is suboptimal ([#41072](https://github.com/angular/angular/issues/41072)) ([18cd7a0](https://github.com/angular/angular/commit/18cd7a0c6921983556fe1fffbff93d42ae138007)), closes [angular/vscode-ng-language-service#1155](https://github.com/angular/vscode-ng-language-service/issues/1155) [#41042](https://github.com/angular/angular/issues/41042) + + + # 12.0.0-next.5 (2021-03-17) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68c1ad4e02a4..9a8ba801c235 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,9 +89,9 @@ Before you submit your Pull Request (PR) consider the following guidelines: We cannot accept code without a signed CLA. Make sure you author all contributed Git commits with email address associated with your CLA signature. -4. Fork the angular/angular repo. +4. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the angular/angular repo. -5. Make your changes in a new git branch: +5. In your forked repository, make your changes in a new git branch: ```shell git checkout -b my-fix-branch master diff --git a/aio/content/examples/interpolation/e2e/src/app.e2e-spec.ts b/aio/content/examples/interpolation/e2e/src/app.e2e-spec.ts index d12b2c47f35b..a2ce3747e720 100644 --- a/aio/content/examples/interpolation/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/interpolation/e2e/src/app.e2e-spec.ts @@ -40,6 +40,6 @@ describe('Interpolation e2e tests', () => { const label = element(by.css('label')); expect(await label.getText()).toEqual('Type something:'); await input.sendKeys('abc'); - expect(await label.getText()).toEqual('Type something: abc'); + expect(await label.getText()).toMatch(/^Type something:\s+abc$/); }); }); diff --git a/aio/content/examples/toh-pt6/src/app/hero.service.ts b/aio/content/examples/toh-pt6/src/app/hero.service.ts index 43ef4a0f00ed..82f233f04cbf 100644 --- a/aio/content/examples/toh-pt6/src/app/hero.service.ts +++ b/aio/content/examples/toh-pt6/src/app/hero.service.ts @@ -104,8 +104,7 @@ export class HeroService { // #docregion deleteHero /** DELETE: delete the hero from the server */ - deleteHero(hero: Hero | number): Observable { - const id = typeof hero === 'number' ? hero : hero.id; + deleteHero(id: number): Observable { const url = `${this.heroesUrl}/${id}`; return this.http.delete(url, this.httpOptions).pipe( diff --git a/aio/content/examples/toh-pt6/src/app/heroes/heroes.component.ts b/aio/content/examples/toh-pt6/src/app/heroes/heroes.component.ts index 7cdeca088a26..5826d8ace89c 100644 --- a/aio/content/examples/toh-pt6/src/app/heroes/heroes.component.ts +++ b/aio/content/examples/toh-pt6/src/app/heroes/heroes.component.ts @@ -36,7 +36,7 @@ export class HeroesComponent implements OnInit { // #docregion delete delete(hero: Hero): void { this.heroes = this.heroes.filter(h => h !== hero); - this.heroService.deleteHero(hero).subscribe(); + this.heroService.deleteHero(hero.id).subscribe(); } // #enddocregion delete diff --git a/aio/content/guide/browser-support.md b/aio/content/guide/browser-support.md index f117ff9d0842..576ba367ed65 100644 --- a/aio/content/guide/browser-support.md +++ b/aio/content/guide/browser-support.md @@ -3,90 +3,44 @@ Angular supports most recent browsers. This includes the following specific versions: - - - - - - + + - - - - - + + - - - - - + + - - - - - + + + - - - - - + + + - - - + + - - - + + -
- Browser - - Supported versions -BrowserSupported versions
- Chrome - - latest - Chromelatest
- Firefox - - latest and extended support release (ESR) - Firefoxlatest and extended support release (ESR)
- Edge - - 2 most recent major versions - Edge2 most recent major versions
IE - IE - -
11
- *deprecated, see the deprecations guide
+ 11
+ *deprecated, see the deprecations guide
- Safari - - 2 most recent major versions -
Safari2 most recent major versions
- iOS - - 2 most recent major versions - iOS2 most recent major versions
- Android - - Q (10.0), Pie (9.0), Oreo (8.0), Nougat (7.0) - AndroidQ (10.0), Pie (9.0), Oreo (8.0), Nougat (7.0)
+
Angular's continuous integration process runs unit tests of the framework on all of these browsers for every pull request, @@ -158,220 +112,133 @@ If the polyfill you want is not already in `polyfills.ts` file, add the `import` These are the polyfills required to run an Angular application on each supported browser: - - - - - - + + - - - - -
- Browsers (Desktop & Mobile) - - Polyfills Required - Browsers (Desktop & Mobile)Polyfills Required
Chrome, Firefox, Edge,
Safari, Android, IE 11
- - [ES2015](guide/browser-support#core-es6) - + ES2015
- ### Optional browser features to polyfill Some features of Angular may require additional polyfills. - - - - - - - - + + + - - - - - - - - - - - - - -
- Feature - - Polyfill - - Browsers (Desktop & Mobile) - FeaturePolyfillBrowsers (Desktop & Mobile)
- - [AnimationBuilder](api/animations/AnimationBuilder). + AnimationBuilder (Standard animation support does not require polyfills.) - - - [Web Animations](guide/browser-support#web-animations) - + Web Animations

If AnimationBuilder is used, enables scrubbing support for IE/Edge and Safari. (Chrome and Firefox support this natively).

- - [NgClass](api/common/NgClass) on SVG elements + NgClass on SVG elements - - [classList](guide/browser-support#classlist) - + classList IE 11
- - [Router](guide/router) when using - [hash-based routing](guide/router#location-strategy) + Router when using hash-based routing - - [ES7/array](guide/browser-support#core-es7-array) - + ES7/array IE 11
- - ### Suggested polyfills The following polyfills are used to test the framework itself. They are a good starting point for an application. - - - - - - - - - - - - - - - - - - - - - - - - -
Polyfill License Size*
- ES7/array - MIT 0.1KB
- ES2015 - MIT 27.4KB
- classList - Public domain 1KB
- Web Animations - Apache 14.8KB
@@ -399,7 +266,6 @@ For example: // __Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame // __Zone_disable_on_property = true; // disable patch onProperty such as onclick // __zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames - /* * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js * with the following flag, it will bypass `zone.js` patch for IE/Edge @@ -408,6 +274,5 @@ For example: </script> <!-- zone.js required by Angular --> <script src="node_modules/zone.js/bundles/zone.umd.js"></script> - <!-- application polyfills --> diff --git a/aio/content/guide/reviewing-content.md b/aio/content/guide/reviewing-content.md index a842774f503f..732fc6190512 100644 --- a/aio/content/guide/reviewing-content.md +++ b/aio/content/guide/reviewing-content.md @@ -1,4 +1,4 @@ -# Reviewing content +# Reviewing Content Angular developers work best when they have access to accurate and complete documentation. Keeping existing content up-to-date is an essential part of ensuring that all developers have a great documentation experience. @@ -26,7 +26,8 @@ You can review a topic using either the GitHub user interface or in an editor on 1. Locate the last reviewed date at the bottom of the topic and verify that the topic meets the [review criteria](#review-criteria). - If the topic does not have a last reviewed date, you are welcome to add it to the topic. + If the topic does not have a last reviewed date, you are welcome to add it to the topic. To add a date, use the `YYYY-MM-DD` date format. Example: + `@reviewed 2021-03-23` 1. Read through the topic. diff --git a/aio/content/images/bios/JiaLiPassion.jpg b/aio/content/images/bios/JiaLiPassion.jpg index ce0499909ccd..6bba1283f838 100644 Binary files a/aio/content/images/bios/JiaLiPassion.jpg and b/aio/content/images/bios/JiaLiPassion.jpg differ diff --git a/aio/content/images/bios/ahsanayaz.jpg b/aio/content/images/bios/ahsanayaz.jpg index 5152c18a5fdf..e2798a1d39be 100644 Binary files a/aio/content/images/bios/ahsanayaz.jpg and b/aio/content/images/bios/ahsanayaz.jpg differ diff --git a/aio/content/images/bios/ajitsinghkaler.jpg b/aio/content/images/bios/ajitsinghkaler.jpg index ee2a65333c2b..745b1c2837dc 100644 Binary files a/aio/content/images/bios/ajitsinghkaler.jpg and b/aio/content/images/bios/ajitsinghkaler.jpg differ diff --git a/aio/content/images/bios/alainchautard.png b/aio/content/images/bios/alainchautard.png index 0fce8607b875..d31c5ffe4a35 100644 Binary files a/aio/content/images/bios/alainchautard.png and b/aio/content/images/bios/alainchautard.png differ diff --git a/aio/content/images/bios/alan-agius4.jpg b/aio/content/images/bios/alan-agius4.jpg index da3c78b6e021..e3111a6123b6 100644 Binary files a/aio/content/images/bios/alan-agius4.jpg and b/aio/content/images/bios/alan-agius4.jpg differ diff --git a/aio/content/images/bios/alex-wolfe.jpg b/aio/content/images/bios/alex-wolfe.jpg deleted file mode 100644 index 7746786b0f8c..000000000000 Binary files a/aio/content/images/bios/alex-wolfe.jpg and /dev/null differ diff --git a/aio/content/images/bios/ali.jpg b/aio/content/images/bios/ali.jpg deleted file mode 100644 index e69d674eb157..000000000000 Binary files a/aio/content/images/bios/ali.jpg and /dev/null differ diff --git a/aio/content/images/bios/alisaduncan.jpg b/aio/content/images/bios/alisaduncan.jpg new file mode 100644 index 000000000000..daa24402b85b Binary files /dev/null and b/aio/content/images/bios/alisaduncan.jpg differ diff --git a/aio/content/images/bios/alvarocamillont.png b/aio/content/images/bios/alvarocamillont.png index dc4e6b01172e..0ce71cad9ace 100644 Binary files a/aio/content/images/bios/alvarocamillont.png and b/aio/content/images/bios/alvarocamillont.png differ diff --git a/aio/content/images/bios/amcdnl.jpeg b/aio/content/images/bios/amcdnl.jpeg deleted file mode 100644 index 38c100df949e..000000000000 Binary files a/aio/content/images/bios/amcdnl.jpeg and /dev/null differ diff --git a/aio/content/images/bios/andrew-kushnir.jpg b/aio/content/images/bios/andrew-kushnir.jpg index eac5e668a6b0..202c71f6b769 100644 Binary files a/aio/content/images/bios/andrew-kushnir.jpg and b/aio/content/images/bios/andrew-kushnir.jpg differ diff --git a/aio/content/images/bios/angular-gde-bio-placeholder.jpg b/aio/content/images/bios/angular-gde-bio-placeholder.jpg deleted file mode 100644 index 6d25b2acaa0e..000000000000 Binary files a/aio/content/images/bios/angular-gde-bio-placeholder.jpg and /dev/null differ diff --git a/aio/content/images/bios/aristeidis.jpg b/aio/content/images/bios/aristeidis.jpg index 554ece0f5695..d6748071d9b3 100644 Binary files a/aio/content/images/bios/aristeidis.jpg and b/aio/content/images/bios/aristeidis.jpg differ diff --git a/aio/content/images/bios/brian-love.jpg b/aio/content/images/bios/brian-love.jpg index c97de3bcc580..c23090907343 100644 Binary files a/aio/content/images/bios/brian-love.jpg and b/aio/content/images/bios/brian-love.jpg differ diff --git a/aio/content/images/bios/cexbrayat.jpg b/aio/content/images/bios/cexbrayat.jpg index a9f7cb1f7e3b..2f82d8d51c33 100644 Binary files a/aio/content/images/bios/cexbrayat.jpg and b/aio/content/images/bios/cexbrayat.jpg differ diff --git a/aio/content/images/bios/christianliebel.jpg b/aio/content/images/bios/christianliebel.jpg index 15b9a94248c6..5afb9c8fdd9e 100644 Binary files a/aio/content/images/bios/christianliebel.jpg and b/aio/content/images/bios/christianliebel.jpg differ diff --git a/aio/content/images/bios/chuckj.jpg b/aio/content/images/bios/chuckj.jpg deleted file mode 100644 index fbb51a579aeb..000000000000 Binary files a/aio/content/images/bios/chuckj.jpg and /dev/null differ diff --git a/aio/content/images/bios/david-east.jpg b/aio/content/images/bios/david-east.jpg deleted file mode 100644 index bcbd59fe61cd..000000000000 Binary files a/aio/content/images/bios/david-east.jpg and /dev/null differ diff --git a/aio/content/images/bios/denny.jpg b/aio/content/images/bios/denny.jpg deleted file mode 100644 index e131a20cb746..000000000000 Binary files a/aio/content/images/bios/denny.jpg and /dev/null differ diff --git a/aio/content/images/bios/doguhan.jpg b/aio/content/images/bios/doguhan.jpg index 9585e677aaa8..574057c6c72d 100644 Binary files a/aio/content/images/bios/doguhan.jpg and b/aio/content/images/bios/doguhan.jpg differ diff --git a/aio/content/images/bios/eliraneliassy.jpg b/aio/content/images/bios/eliraneliassy.jpg index 52d094d2cd0f..5fbfde254702 100644 Binary files a/aio/content/images/bios/eliraneliassy.jpg and b/aio/content/images/bios/eliraneliassy.jpg differ diff --git a/aio/content/images/bios/eric.jpg b/aio/content/images/bios/eric.jpg deleted file mode 100644 index d9d81b92edfe..000000000000 Binary files a/aio/content/images/bios/eric.jpg and /dev/null differ diff --git a/aio/content/images/bios/fatima.jpg b/aio/content/images/bios/fatima.jpg deleted file mode 100644 index 222164324a1f..000000000000 Binary files a/aio/content/images/bios/fatima.jpg and /dev/null differ diff --git a/aio/content/images/bios/gerardsans.jpg b/aio/content/images/bios/gerardsans.jpg index 79a3109ab598..ae93796f7933 100644 Binary files a/aio/content/images/bios/gerardsans.jpg and b/aio/content/images/bios/gerardsans.jpg differ diff --git a/aio/content/images/bios/jessicajaniuk.jpg b/aio/content/images/bios/jessicajaniuk.jpg index 6026d84611a1..f8600cf28a76 100644 Binary files a/aio/content/images/bios/jessicajaniuk.jpg and b/aio/content/images/bios/jessicajaniuk.jpg differ diff --git a/aio/content/images/bios/jesus-rodriguez.jpg b/aio/content/images/bios/jesus-rodriguez.jpg deleted file mode 100644 index 2fd79480afaa..000000000000 Binary files a/aio/content/images/bios/jesus-rodriguez.jpg and /dev/null differ diff --git a/aio/content/images/bios/john-papa.jpg b/aio/content/images/bios/john-papa.jpg deleted file mode 100644 index c03d5665e693..000000000000 Binary files a/aio/content/images/bios/john-papa.jpg and /dev/null differ diff --git a/aio/content/images/bios/judy.png b/aio/content/images/bios/judy.png deleted file mode 100644 index aecc90bfea67..000000000000 Binary files a/aio/content/images/bios/judy.png and /dev/null differ diff --git a/aio/content/images/bios/juleskremer.jpg b/aio/content/images/bios/juleskremer.jpg deleted file mode 100644 index 970ad47b023a..000000000000 Binary files a/aio/content/images/bios/juleskremer.jpg and /dev/null differ diff --git a/aio/content/images/bios/julie-ralph.jpg b/aio/content/images/bios/julie-ralph.jpg deleted file mode 100644 index 4585dadcb3fb..000000000000 Binary files a/aio/content/images/bios/julie-ralph.jpg and /dev/null differ diff --git a/aio/content/images/bios/juristr.jpg b/aio/content/images/bios/juristr.jpg index be3df97e0174..43a6e363a824 100644 Binary files a/aio/content/images/bios/juristr.jpg and b/aio/content/images/bios/juristr.jpg differ diff --git a/aio/content/images/bios/kamilmysliwiec.jpg b/aio/content/images/bios/kamilmysliwiec.jpg index 88c240d57a46..5fcb7890f211 100644 Binary files a/aio/content/images/bios/kamilmysliwiec.jpg and b/aio/content/images/bios/kamilmysliwiec.jpg differ diff --git a/aio/content/images/bios/kapunahelewong.jpg b/aio/content/images/bios/kapunahelewong.jpg deleted file mode 100644 index ce57726435dc..000000000000 Binary files a/aio/content/images/bios/kapunahelewong.jpg and /dev/null differ diff --git a/aio/content/images/bios/kara-erickson.jpg b/aio/content/images/bios/kara-erickson.jpg deleted file mode 100644 index ba2ebba28a1a..000000000000 Binary files a/aio/content/images/bios/kara-erickson.jpg and /dev/null differ diff --git a/aio/content/images/bios/katerina.jpg b/aio/content/images/bios/katerina.jpg index 042c8a114822..6f8387d6284a 100644 Binary files a/aio/content/images/bios/katerina.jpg and b/aio/content/images/bios/katerina.jpg differ diff --git a/aio/content/images/bios/kathy.jpg b/aio/content/images/bios/kathy.jpg deleted file mode 100644 index 18c40777c010..000000000000 Binary files a/aio/content/images/bios/kathy.jpg and /dev/null differ diff --git a/aio/content/images/bios/kimmaida.jpg b/aio/content/images/bios/kimmaida.jpg index 735240bc9a88..915fa21cc52e 100644 Binary files a/aio/content/images/bios/kimmaida.jpg and b/aio/content/images/bios/kimmaida.jpg differ diff --git a/aio/content/images/bios/kyliau.jpg b/aio/content/images/bios/kyliau.jpg index 71114c1bf371..eb6c664558a3 100644 Binary files a/aio/content/images/bios/kyliau.jpg and b/aio/content/images/bios/kyliau.jpg differ diff --git a/aio/content/images/bios/lacolaco.jpg b/aio/content/images/bios/lacolaco.jpg index 5b5c13dbf7fe..6312717dea53 100644 Binary files a/aio/content/images/bios/lacolaco.jpg and b/aio/content/images/bios/lacolaco.jpg differ diff --git a/aio/content/images/bios/leonardo.jpg b/aio/content/images/bios/leonardo.jpg index 5ce901cae511..96432dbd9127 100644 Binary files a/aio/content/images/bios/leonardo.jpg and b/aio/content/images/bios/leonardo.jpg differ diff --git a/aio/content/images/bios/lucas.jpg b/aio/content/images/bios/lucas.jpg deleted file mode 100644 index f891ac13fe6e..000000000000 Binary files a/aio/content/images/bios/lucas.jpg and /dev/null differ diff --git a/aio/content/images/bios/luixaviles.jpg b/aio/content/images/bios/luixaviles.jpg index 961b24271d7e..284873cd385a 100644 Binary files a/aio/content/images/bios/luixaviles.jpg and b/aio/content/images/bios/luixaviles.jpg differ diff --git a/aio/content/images/bios/manumurthy.jpg b/aio/content/images/bios/manumurthy.jpg deleted file mode 100644 index 4e932256931a..000000000000 Binary files a/aio/content/images/bios/manumurthy.jpg and /dev/null differ diff --git a/aio/content/images/bios/marcy.jpg b/aio/content/images/bios/marcy.jpg deleted file mode 100644 index ae69f2111ede..000000000000 Binary files a/aio/content/images/bios/marcy.jpg and /dev/null differ diff --git a/aio/content/images/bios/matias.jpg b/aio/content/images/bios/matias.jpg deleted file mode 100644 index 0342dd22d162..000000000000 Binary files a/aio/content/images/bios/matias.jpg and /dev/null differ diff --git a/aio/content/images/bios/max-sills.jpg b/aio/content/images/bios/max-sills.jpg deleted file mode 100644 index c1a2fdfe4b84..000000000000 Binary files a/aio/content/images/bios/max-sills.jpg and /dev/null differ diff --git a/aio/content/images/bios/mhartington.png b/aio/content/images/bios/mhartington.png index dfacd6d34478..07007b469d93 100644 Binary files a/aio/content/images/bios/mhartington.png and b/aio/content/images/bios/mhartington.png differ diff --git a/aio/content/images/bios/michal.jpg b/aio/content/images/bios/michal.jpg deleted file mode 100644 index 0d0c75ec2a54..000000000000 Binary files a/aio/content/images/bios/michal.jpg and /dev/null differ diff --git a/aio/content/images/bios/mikeryan.jpg b/aio/content/images/bios/mikeryan.jpg deleted file mode 100755 index fd63309e6b35..000000000000 Binary files a/aio/content/images/bios/mikeryan.jpg and /dev/null differ diff --git a/aio/content/images/bios/mira.jpg b/aio/content/images/bios/mira.jpg index d2c32f7d914b..c4fafe69f298 100644 Binary files a/aio/content/images/bios/mira.jpg and b/aio/content/images/bios/mira.jpg differ diff --git a/aio/content/images/bios/naomi.jpg b/aio/content/images/bios/naomi.jpg deleted file mode 100644 index d611951e8bed..000000000000 Binary files a/aio/content/images/bios/naomi.jpg and /dev/null differ diff --git a/aio/content/images/bios/nirkaufman.jpg b/aio/content/images/bios/nirkaufman.jpg index 59e2444a4ccd..d1a0c19ebb82 100644 Binary files a/aio/content/images/bios/nirkaufman.jpg and b/aio/content/images/bios/nirkaufman.jpg differ diff --git a/aio/content/images/bios/patovargas.png b/aio/content/images/bios/patovargas.png index 22479d774a76..8b74d3821ad9 100644 Binary files a/aio/content/images/bios/patovargas.png and b/aio/content/images/bios/patovargas.png differ diff --git a/aio/content/images/bios/patrick-stapleton.jpg b/aio/content/images/bios/patrick-stapleton.jpg deleted file mode 100644 index c856cb5b8fd5..000000000000 Binary files a/aio/content/images/bios/patrick-stapleton.jpg and /dev/null differ diff --git a/aio/content/images/bios/rex.jpg b/aio/content/images/bios/rex.jpg deleted file mode 100644 index 2e5529d67151..000000000000 Binary files a/aio/content/images/bios/rex.jpg and /dev/null differ diff --git a/aio/content/images/bios/rmesserle.jpg b/aio/content/images/bios/rmesserle.jpg deleted file mode 100644 index 7b3f1bf6b19b..000000000000 Binary files a/aio/content/images/bios/rmesserle.jpg and /dev/null differ diff --git a/aio/content/images/bios/rockument69.jpg b/aio/content/images/bios/rockument69.jpg deleted file mode 100644 index 59888c9fff48..000000000000 Binary files a/aio/content/images/bios/rockument69.jpg and /dev/null differ diff --git a/aio/content/images/bios/ryan.jpg b/aio/content/images/bios/ryan.jpg deleted file mode 100644 index 45113ea634d1..000000000000 Binary files a/aio/content/images/bios/ryan.jpg and /dev/null differ diff --git a/aio/content/images/bios/sajee.jpg b/aio/content/images/bios/sajee.jpg index 820c92bacfcd..f2ed15cd2398 100644 Binary files a/aio/content/images/bios/sajee.jpg and b/aio/content/images/bios/sajee.jpg differ diff --git a/aio/content/images/bios/scott.jpg b/aio/content/images/bios/scott.jpg deleted file mode 100644 index f80680564d02..000000000000 Binary files a/aio/content/images/bios/scott.jpg and /dev/null differ diff --git a/aio/content/images/bios/shahar.jpg b/aio/content/images/bios/shahar.jpg deleted file mode 100644 index 0fabe66e4227..000000000000 Binary files a/aio/content/images/bios/shahar.jpg and /dev/null differ diff --git a/aio/content/images/bios/shannon.jpg b/aio/content/images/bios/shannon.jpg deleted file mode 100644 index 3f590d68720a..000000000000 Binary files a/aio/content/images/bios/shannon.jpg and /dev/null differ diff --git a/aio/content/images/bios/shield-bio-placeholder.jpg b/aio/content/images/bios/shield-bio-placeholder.jpg deleted file mode 100644 index e0f8892330c6..000000000000 Binary files a/aio/content/images/bios/shield-bio-placeholder.jpg and /dev/null differ diff --git a/aio/content/images/bios/sidd-ajmera.jpg b/aio/content/images/bios/sidd-ajmera.jpg index 4cf25b9f162a..d9e5ff34c4a2 100644 Binary files a/aio/content/images/bios/sidd-ajmera.jpg and b/aio/content/images/bios/sidd-ajmera.jpg differ diff --git a/aio/content/images/bios/sonukapoor.jpg b/aio/content/images/bios/sonukapoor.jpg index d65e576fcf1e..88f6cca1fcf9 100644 Binary files a/aio/content/images/bios/sonukapoor.jpg and b/aio/content/images/bios/sonukapoor.jpg differ diff --git a/aio/content/images/bios/stephenfluin.jpg b/aio/content/images/bios/stephenfluin.jpg deleted file mode 100644 index b0d95942bf32..000000000000 Binary files a/aio/content/images/bios/stephenfluin.jpg and /dev/null differ diff --git a/aio/content/images/bios/teriglover.png b/aio/content/images/bios/teriglover.png index 75d192064e58..bf23858ccab8 100644 Binary files a/aio/content/images/bios/teriglover.png and b/aio/content/images/bios/teriglover.png differ diff --git a/aio/content/images/bios/teropa.jpg b/aio/content/images/bios/teropa.jpg deleted file mode 100644 index 175be9e860cd..000000000000 Binary files a/aio/content/images/bios/teropa.jpg and /dev/null differ diff --git a/aio/content/images/bios/thierrychatel.jpg b/aio/content/images/bios/thierrychatel.jpg old mode 100755 new mode 100644 index 1a57f41fe8af..103f69cb1fff Binary files a/aio/content/images/bios/thierrychatel.jpg and b/aio/content/images/bios/thierrychatel.jpg differ diff --git a/aio/content/images/bios/thomas.jpg b/aio/content/images/bios/thomas.jpg deleted file mode 100644 index 1fdbda575b93..000000000000 Binary files a/aio/content/images/bios/thomas.jpg and /dev/null differ diff --git a/aio/content/images/bios/tobias.jpg b/aio/content/images/bios/tobias.jpg deleted file mode 100644 index 5fa0e3c61809..000000000000 Binary files a/aio/content/images/bios/tobias.jpg and /dev/null differ diff --git a/aio/content/images/bios/tonyc.jpg b/aio/content/images/bios/tonyc.jpg deleted file mode 100644 index 4a22c874fffc..000000000000 Binary files a/aio/content/images/bios/tonyc.jpg and /dev/null differ diff --git a/aio/content/images/bios/topherfangio.jpg b/aio/content/images/bios/topherfangio.jpg deleted file mode 100644 index a3a365313713..000000000000 Binary files a/aio/content/images/bios/topherfangio.jpg and /dev/null differ diff --git a/aio/content/images/bios/torgeirhelgevold.jpg b/aio/content/images/bios/torgeirhelgevold.jpg deleted file mode 100644 index fc4b2e089b64..000000000000 Binary files a/aio/content/images/bios/torgeirhelgevold.jpg and /dev/null differ diff --git a/aio/content/images/bios/tracylee.jpg b/aio/content/images/bios/tracylee.jpg index 50ad9f576709..a2114c4d02ef 100644 Binary files a/aio/content/images/bios/tracylee.jpg and b/aio/content/images/bios/tracylee.jpg differ diff --git a/aio/content/images/bios/twerske.jpg b/aio/content/images/bios/twerske.jpg index d07466313c2b..01c716bb8475 100644 Binary files a/aio/content/images/bios/twerske.jpg and b/aio/content/images/bios/twerske.jpg differ diff --git a/aio/content/images/bios/victor.jpg b/aio/content/images/bios/victor.jpg deleted file mode 100644 index 54d6a7c44efd..000000000000 Binary files a/aio/content/images/bios/victor.jpg and /dev/null differ diff --git a/aio/content/images/bios/waterplea.jpg b/aio/content/images/bios/waterplea.jpg new file mode 100644 index 000000000000..2a526ccbfc2c Binary files /dev/null and b/aio/content/images/bios/waterplea.jpg differ diff --git a/aio/content/images/bios/webdave.jpg b/aio/content/images/bios/webdave.jpg index b0fe14a105e7..3ebb8b3bf833 100644 Binary files a/aio/content/images/bios/webdave.jpg and b/aio/content/images/bios/webdave.jpg differ diff --git a/aio/content/images/bios/wesgrimes.jpg b/aio/content/images/bios/wesgrimes.jpg index 05f69774d06e..f68aaaab2e25 100644 Binary files a/aio/content/images/bios/wesgrimes.jpg and b/aio/content/images/bios/wesgrimes.jpg differ diff --git a/aio/content/images/bios/xiaofei.jpg b/aio/content/images/bios/xiaofei.jpg deleted file mode 100644 index 770ccd8bc923..000000000000 Binary files a/aio/content/images/bios/xiaofei.jpg and /dev/null differ diff --git a/aio/content/images/bios/yurzui.jpg b/aio/content/images/bios/yurzui.jpg index d4c33a6f51bf..f5c6aa71eafe 100644 Binary files a/aio/content/images/bios/yurzui.jpg and b/aio/content/images/bios/yurzui.jpg differ diff --git a/aio/content/images/bios/zach-arend.jpg b/aio/content/images/bios/zach-arend.jpg new file mode 100644 index 000000000000..2b856a72fcb8 Binary files /dev/null and b/aio/content/images/bios/zach-arend.jpg differ diff --git a/aio/content/marketing/contributors.json b/aio/content/marketing/contributors.json index f7c6149d68cf..34dc8d9468d3 100644 --- a/aio/content/marketing/contributors.json +++ b/aio/content/marketing/contributors.json @@ -44,6 +44,14 @@ "picture": "alan-agius4.jpg", "bio": "Angular CLI Member, Loves TypeScript, Build Tools, Food, Beer & Coffee :)" }, + "alisaduncan": { + "name": "Alisa Duncan", + "picture": "alisaduncan.jpg", + "twitter": "alisaduncan", + "website": "https://github.com/alisaduncan", + "bio": "Alisa is a software engineer and community builder who loves the thrill of learning new things. She is a core member of the ngGirls Team, co-organizes the local AngularKC meetup, and helps women learn web development as the Curriculum Director for the Coding & Cocktails program at Kansas City Women in Technology. When not coding, she enjoys drinking red wine with her husband while sitting on the patio.", + "groups": ["GDE"] + }, "alvarocamillont": { "name": "Alvaro Camillo Neto", "picture": "alvarocamillont.png", @@ -183,10 +191,9 @@ "cindygk": { "name": "Cindy Greene-Kaplan", "picture": "cindygreenekaplan.jpg", - "twitter": "CindyGK2019", + "twitter": "cindykaygk", "bio": "Cindy is a Program Manager on the Angular team at Google. She is passionate about improving team processes and overall execution. She enjoys dance fitness, movies and travel.", - "groups": ["Angular"], - "lead": "juleskremer" + "groups": ["Angular"] }, "cironunes": { "name": "Ciro Nunes", @@ -352,8 +359,7 @@ "twitter": "IgorMinar", "website": "https://google.com/+IgorMinar", "bio": "Igor is a software engineer at Google. He is a lead on the Angular project, practitioner of test driven development, open source enthusiast, hacker. In his free time, Igor enjoys spending time with his wife and two kids, doing outdoor activities (including but not limited to sports, gardening and building retaining walls).", - "groups": ["Angular"], - "lead": "juleskremer" + "groups": ["Angular"] }, "jbedard": { "name": "Jason Bedard", @@ -459,13 +465,6 @@ "bio": "Justin (aka Schwarty) is a Google Developer Expert in Web Technologies and Angular, the host and maintainer of the weekly AngularAir live video broadcast, educator, writer and content creator. He has Angular courses available on LinkedIn Learning and Pluralsight and loves passing on years of full stack development knowledge to help empower others to find their inner awesomeness!", "groups": ["GDE"] }, - "juleskremer": { - "name": "Jules Kremer", - "picture": "juleskremer.jpg", - "twitter": "jules_kremer", - "bio": "Jules Kremer is the engineering manager for web frameworks at Google including Angular. Jules has over 20 years of experience in technology and has been a software engineer, product manager, developer evangelist, and competitive intelligence lead. Jules has a passion for supporting women in tech, yoga, hiking, cooking, and exploring the jungles of Maui.", - "groups": ["Angular"] - }, "juristr": { "name": "Juri Strumpflohner", "picture": "juristr.jpg", @@ -589,14 +588,6 @@ "groups": ["GDE", "Collaborators"] }, - "manughub": { - "name": "Manu Murthy", - "picture": "manumurthy.jpg", - "twitter": "manu_murthy", - "bio": "Manu heads technical program management for Angular at Google. Manu keeps the big picture in focus and works with cross-functional teams to plan, execute and usher programs through the entire lifecycle.", - "groups": ["Angular"], - "lead": "juleskremer" - }, "martinakraus": { "name": "Martina Kraus", "picture": "martinakraus.jpg", @@ -627,8 +618,7 @@ "twitter": "mgechev", "website": "https://blog.mgechev.com/", "bio": "Software engineer who enjoys theoretical computer science and its practical applications. Speaker, author of the book 'Switching to Angular', codelyzer, Guess.js, and the Go linter revive. Working for faster and more reliable software.", - "groups": ["Angular"], - "lead": "stephenfluin" + "groups": ["Angular"] }, "mhartington": { "name": "Mike Hartington", @@ -822,15 +812,6 @@ "bio": "Srashti is Senior Developer at Hvantage Technologies. She's also a Google Developer Expert for Angular and Microsoft MVP (Developer Technologies) based in India. Co-organiser All About Web (@itsAllAboutWeb) and Indore Technical Community (#ngIndore).", "groups": ["GDE"] }, - "stephenfluin": { - "name": "Stephen Fluin", - "picture": "stephenfluin.jpg", - "twitter": "stephenfluin", - "website": "https://plus.google.com/+stephenfluin", - "bio": "Stephen is a Developer Advocate working on the Angular team. Before joining Google, he was a Google Expert. Stephen loves to help enterprises use technology more effectively.", - "groups": ["Angular"], - "lead": "juleskremer" - }, "stevermeister": { "name": "Stepan Suvorov", "picture": "stevermeister.jpg", @@ -911,6 +892,14 @@ "bio": "Ward is an all-around developer with JavaScript, Node.js®, and .net chops. He's a frequent conference speaker and podcaster, trainer, Google Developer Expert for Angular, Microsoft MVP, and PluralSight author. He is also president of IdeaBlade, an enterprise software consulting firm and the makers of breeze.js. He would like to get more sleep and spend more time in the mountains.", "groups": ["GDE"] }, + "waterplea": { + "name": "Alexander Inkin", + "picture": "waterplea.jpg", + "twitter": "waterplea", + "website": "https://alexander.inkin.ru", + "bio": "Alex is a front end dev in love with Angular and declarative approach. He enjoys Web for it's multimedia nature and rich features. Actively creating and contributing to open source ecosystem he also does a lot of tech writing. He is a music and movies fan and a Montessori enthusiast father of two kids.", + "groups": ["GDE"] + }, "webdave": { "name": "David Muellerchen", "picture": "webdave.jpg", @@ -950,6 +939,13 @@ "website": "https://medium.com/@a.yurich.zuev", "bio": "Alexey is a web development addict who likes diving deep into the source code and sharing his knowledge through visualization. Creator of ng-run.com", "groups": ["GDE"] + }, + "zarend": { + "name": "Zach Arend", + "picture": "zach-arend.jpg", + "bio": "Zach is a software engineer at Google on the Angular Core team. He is passionate about a good user experience, burritos and puppies.", + "groups": ["Angular"], + "lead": "jelbourn" } } diff --git a/aio/scripts/contributors/validate-data.js b/aio/scripts/contributors/validate-data.js index 61cedc3b5258..895e880c26e6 100644 --- a/aio/scripts/contributors/validate-data.js +++ b/aio/scripts/contributors/validate-data.js @@ -1,10 +1,11 @@ #!/usr/bin/env node // Imports -const {existsSync, readFileSync} = require('fs'); +const {readdirSync, readFileSync, statSync} = require('fs'); const {join, resolve} = require('path'); // Constants +const MAX_IMAGE_SIZE = 30 * 1024; // 30kb const CONTENT_DIR = resolve(__dirname, '../../content'); const IMAGES_DIR = join(CONTENT_DIR, 'images/bios'); const CONTRIBUTORS_PATH = join(CONTENT_DIR, 'marketing/contributors.json'); @@ -16,19 +17,37 @@ _main(); // Functions - Definitions function _main() { const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); - - // Check that there are no missing images. const expectedImages = Object.keys(contributors) .filter(key => !!contributors[key].picture) .map(key => join(IMAGES_DIR, contributors[key].picture)); - const missingImages = expectedImages.filter(path => !existsSync(path)); + const existingImages = readdirSync(IMAGES_DIR) + .filter(name => name !== '_no-one.jpg') + .map(name => join(IMAGES_DIR, name)); + // Check that there are no missing images. + const missingImages = expectedImages.filter(path => !existingImages.includes(path)); if (missingImages.length > 0) { throw new Error( 'The following pictures are referenced in \'contributors.json\' but do not exist:' + missingImages.map(path => `\n - ${path}`).join('')); } + // Check that there are no unused images. + const unusedImages = existingImages.filter(path => !expectedImages.includes(path)); + if (unusedImages.length > 0) { + throw new Error( + 'The following pictures are not referenced in \'contributors.json\' and should be deleted:' + + unusedImages.map(path => `\n - ${path}`).join('')); + } + + // Check that there are no images that exceed the size limit. + const tooLargeImages = expectedImages.filter(path => statSync(path).size > MAX_IMAGE_SIZE); + if (tooLargeImages.length > 0) { + throw new Error( + `The following pictures exceed maximum size limit of ${MAX_IMAGE_SIZE / 1024}kb:` + + tooLargeImages.map(path => `\n - ${path}`).join('')); + } + // Verify that all keys are sorted alphabetically const keys = Object.keys(contributors); for (let i = 1; i < keys.length; i++) { diff --git a/aio/tests/e2e/src/app.e2e-spec.ts b/aio/tests/e2e/src/app.e2e-spec.ts index c96220249ae9..442c840ff0d3 100644 --- a/aio/tests/e2e/src/app.e2e-spec.ts +++ b/aio/tests/e2e/src/app.e2e-spec.ts @@ -144,7 +144,7 @@ describe('site App', () => { it('should have contributors listed in each group', async () => { // WebDriver calls `scrollIntoView()` on the element to bring it into the visible area of the // browser, before clicking it. By default, this aligns the top of the element to the top of - // the window. As a result, the element may end up behing the fixed top menu, thus being + // the window. As a result, the element may end up behind the fixed top menu, thus being // unclickable. To avoid this, we click the element directly using JavaScript instead. const clickButton = (elementFinder: ElementFinder) => browser.executeScript('arguments[0].click()', elementFinder); diff --git a/aio/tools/examples/shared/boilerplate/common/src/styles.css b/aio/tools/examples/shared/boilerplate/common/src/styles.css index 1e9f1c865d87..0584e4a79343 100644 --- a/aio/tools/examples/shared/boilerplate/common/src/styles.css +++ b/aio/tools/examples/shared/boilerplate/common/src/styles.css @@ -4,20 +4,23 @@ } h1 { color: #264D73; - font-size: 250%; + font-size: 2.5rem; } h2, h3 { color: #444; font-weight: lighter; } +h3 { + font-size: 1.3rem; +} body { - padding: .5em; + padding: .5rem; max-width: 1000px; margin: auto; } @media (min-width: 600px) { body { - padding: 2em; + padding: 2rem; } } body, input[text] { @@ -30,13 +33,17 @@ a { button { background-color: #eee; border: none; - padding: 5px 10px; border-radius: 4px; cursor: pointer; color: black; + font-size: 1.2rem; + padding: 1rem; + margin-right: 1rem; + margin-bottom: 1rem; } button:hover { - background-color: #cfd8dc; + background-color: black; + color: white; } button:disabled { background-color: #eee; @@ -64,3 +71,11 @@ nav a.active { background-color: black; color: white; } +hr { + margin: 1.5rem 0; +} +input[type="text"] { + box-sizing: border-box; + width: 100%; + padding: .5rem; +} diff --git a/aio/tools/transforms/angular-api-package/index.js b/aio/tools/transforms/angular-api-package/index.js index 555ecd0645ca..79eef8999637 100644 --- a/aio/tools/transforms/angular-api-package/index.js +++ b/aio/tools/transforms/angular-api-package/index.js @@ -86,7 +86,7 @@ module.exports = readTypeScriptModules.ignoreExportsMatching = [/^_|^ɵɵ|^VERSION$/]; readTypeScriptModules.hidePrivateMembers = true; - // NOTE: This list should be in sync with tools/public_api_guard/BUILD.bazel + // NOTE: This list should be in sync with the folders/files in `goldens/public-api`. readTypeScriptModules.sourceFiles = [ 'animations/index.ts', 'animations/browser/index.ts', @@ -101,6 +101,8 @@ module.exports = 'core/testing/index.ts', 'elements/index.ts', 'forms/index.ts', + 'localize/index.ts', + 'localize/init/index.ts', 'platform-browser/index.ts', 'platform-browser/animations/index.ts', 'platform-browser/testing/index.ts', diff --git a/dev-infra/build-worker.js b/dev-infra/build-worker.js index 9754ceb77dce..95491d4d5182 100644 --- a/dev-infra/build-worker.js +++ b/dev-infra/build-worker.js @@ -7,7 +7,6 @@ var fs = require('fs'); var path = require('path'); var chalk = _interopDefault(require('chalk')); require('inquirer'); -require('inquirer-autocomplete-prompt'); var shelljs = require('shelljs'); /** diff --git a/dev-infra/commit-message/BUILD.bazel b/dev-infra/commit-message/BUILD.bazel index ed4abcc30a3b..7ced3089f7fc 100644 --- a/dev-infra/commit-message/BUILD.bazel +++ b/dev-infra/commit-message/BUILD.bazel @@ -11,10 +11,12 @@ ts_library( visibility = ["//dev-infra:__subpackages__"], deps = [ "//dev-infra/utils", + "@npm//@types/conventional-commits-parser", "@npm//@types/inquirer", "@npm//@types/node", "@npm//@types/shelljs", "@npm//@types/yargs", + "@npm//conventional-commits-parser", "@npm//inquirer", "@npm//shelljs", "@npm//yargs", diff --git a/dev-infra/commit-message/builder.spec.ts b/dev-infra/commit-message/builder.spec.ts deleted file mode 100644 index 5b45ac4140c6..000000000000 --- a/dev-infra/commit-message/builder.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import * as config from '../utils/config'; -import * as console from '../utils/console'; - -import {buildCommitMessage} from './builder'; - - -describe('commit message building:', () => { - beforeEach(() => { - // stub logging calls to prevent noise in test log - spyOn(console, 'info').and.stub(); - // provide a configuration for DevInfra when loaded - spyOn(config, 'getConfig').and.returnValue({ - commitMessage: { - scopes: ['core'], - } - } as any); - }); - - it('creates a commit message with a scope', async () => { - buildPromptResponseSpies('fix', 'core', 'This is a summary'); - - expect(await buildCommitMessage()).toMatch(/^fix\(core\): This is a summary/); - }); - - it('creates a commit message without a scope', async () => { - buildPromptResponseSpies('build', false, 'This is a summary'); - - expect(await buildCommitMessage()).toMatch(/^build: This is a summary/); - }); -}); - - -/** Create spies to return the mocked selections from prompts. */ -function buildPromptResponseSpies(type: string, scope: string|false, summary: string) { - spyOn(console, 'promptAutocomplete') - .and.returnValues(Promise.resolve(type), Promise.resolve(scope)); - spyOn(console, 'promptInput').and.returnValue(Promise.resolve(summary)); -} diff --git a/dev-infra/commit-message/builder.ts b/dev-infra/commit-message/builder.ts deleted file mode 100644 index f663f3619d47..000000000000 --- a/dev-infra/commit-message/builder.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import {ListChoiceOptions} from 'inquirer'; - -import {info, promptAutocomplete, promptInput} from '../utils/console'; - -import {COMMIT_TYPES, CommitType, getCommitMessageConfig, ScopeRequirement} from './config'; - -/** Validate commit message at the provided file path. */ -export async function buildCommitMessage() { - // TODO(josephperrott): Add support for skipping wizard with local untracked config file - // TODO(josephperrott): Add default commit message information/commenting into generated messages - info('Just a few questions to start building the commit message!'); - - /** The commit message type. */ - const type = await promptForCommitMessageType(); - /** The commit message scope. */ - const scope = await promptForCommitMessageScopeForType(type); - /** The commit message summary. */ - const summary = await promptForCommitMessageSummary(); - - return `${type.name}${scope ? '(' + scope + ')' : ''}: ${summary}\n\n`; -} - -/** Prompts in the terminal for the commit message's type. */ -async function promptForCommitMessageType(): Promise { - info('The type of change in the commit. Allows a reader to know the effect of the change,'); - info('whether it brings a new feature, adds additional testing, documents the `project, etc.'); - - /** List of commit type options for the autocomplete prompt. */ - const typeOptions: ListChoiceOptions[] = - Object.values(COMMIT_TYPES).map(({description, name}) => { - return { - name: `${name} - ${description}`, - value: name, - short: name, - }; - }); - /** The key of a commit message type, selected by the user via prompt. */ - const typeName = await promptAutocomplete('Select a type for the commit:', typeOptions); - - return COMMIT_TYPES[typeName]; -} - -/** Prompts in the terminal for the commit message's scope. */ -async function promptForCommitMessageScopeForType(type: CommitType): Promise { - // If the commit type's scope requirement is forbidden, return early. - if (type.scope === ScopeRequirement.Forbidden) { - info(`Skipping scope selection as the '${type.name}' type does not allow scopes`); - return false; - } - /** Commit message configuration */ - const config = getCommitMessageConfig(); - - info('The area of the repository the changes in this commit most affects.'); - return await promptAutocomplete( - 'Select a scope for the commit:', config.commitMessage.scopes, - type.scope === ScopeRequirement.Optional ? '' : ''); -} - -/** Prompts in the terminal for the commit message's summary. */ -async function promptForCommitMessageSummary(): Promise { - info('Provide a short summary of what the changes in the commit do'); - return await promptInput('Provide a short summary of the commit'); -} diff --git a/dev-infra/commit-message/cli.ts b/dev-infra/commit-message/cli.ts index f952ab569c01..0ed65b71e3d2 100644 --- a/dev-infra/commit-message/cli.ts +++ b/dev-infra/commit-message/cli.ts @@ -10,14 +10,12 @@ import * as yargs from 'yargs'; import {RestoreCommitMessageModule} from './restore-commit-message/cli'; import {ValidateFileModule} from './validate-file/cli'; import {ValidateRangeModule} from './validate-range/cli'; -import {WizardModule} from './wizard/cli'; /** Build the parser for the commit-message commands. */ export function buildCommitMessageParser(localYargs: yargs.Argv) { return localYargs.help() .strict() .command(RestoreCommitMessageModule) - .command(WizardModule) .command(ValidateFileModule) .command(ValidateRangeModule); } diff --git a/dev-infra/commit-message/parse.spec.ts b/dev-infra/commit-message/parse.spec.ts index 22a79934a923..b1ec355a812f 100644 --- a/dev-infra/commit-message/parse.spec.ts +++ b/dev-infra/commit-message/parse.spec.ts @@ -6,27 +6,40 @@ * found in the LICENSE file at https://angular.io/license */ -import {parseCommitMessage, ParsedCommitMessage} from './parse'; +import {parseCommitMessage} from './parse'; const commitValues = { prefix: '', type: 'fix', + npmScope: '', scope: 'changed-area', summary: 'This is a short summary of the change', - body: 'This is a longer description of the change Closes #1', + body: 'This is a longer description of the change', + footer: 'Closes #1', }; -function buildCommitMessage(params = {}) { - const {prefix, type, scope, summary, body} = {...commitValues, ...params}; - return `${prefix}${type}${scope ? '(' + scope + ')' : ''}: ${summary}\n\n${body}`; +function buildCommitMessage(params: Partial = {}) { + const {prefix, npmScope, type, scope, summary, body, footer} = {...commitValues, ...params}; + const scopeSlug = npmScope ? `${npmScope}/${scope}` : scope; + return `${prefix}${type}${scopeSlug ? '(' + scopeSlug + ')' : ''}: ${summary}\n\n${body}\n\n${ + footer}`; } describe('commit message parsing:', () => { - it('parses the scope', () => { - const message = buildCommitMessage(); - expect(parseCommitMessage(message).scope).toBe(commitValues.scope); + describe('parses the scope', () => { + it('when only a scope is defined', () => { + const message = buildCommitMessage(); + expect(parseCommitMessage(message).scope).toBe(commitValues.scope); + expect(parseCommitMessage(message).npmScope).toBe(''); + }); + + it('when an npmScope and scope are defined', () => { + const message = buildCommitMessage({npmScope: 'myNpmPackage'}); + expect(parseCommitMessage(message).scope).toBe(commitValues.scope); + expect(parseCommitMessage(message).npmScope).toBe('myNpmPackage'); + }); }); it('parses the type', () => { @@ -45,12 +58,6 @@ describe('commit message parsing:', () => { expect(parseCommitMessage(message).body).toBe(commitValues.body); }); - it('parses the body without Github linking', () => { - const body = 'This has linking\nCloses #1'; - const message = buildCommitMessage({body}); - expect(parseCommitMessage(message).bodyWithoutLinking).toBe('This has linking\n'); - }); - it('parses the subject', () => { const message = buildCommitMessage(); expect(parseCommitMessage(message).subject).toBe(commitValues.summary); @@ -100,6 +107,71 @@ describe('commit message parsing:', () => { expect(parsedMessage.body) .toBe( 'This is line 1 of the actual body.\n' + - 'This is line 2 of the actual body (and it also contains a # but it not a comment).\n'); + 'This is line 2 of the actual body (and it also contains a # but it not a comment).'); + }); + + describe('parses breaking change notes', () => { + const summary = 'This breaks things'; + const description = 'This is how it breaks things.'; + + it('when only a summary is provided', () => { + const message = buildCommitMessage({ + footer: `BREAKING CHANGE: ${summary}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.breakingChanges[0].text).toBe(summary); + expect(parsedMessage.breakingChanges.length).toBe(1); + }); + + it('when only a description is provided', () => { + const message = buildCommitMessage({ + footer: `BREAKING CHANGE:\n\n${description}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.breakingChanges[0].text).toBe(description); + expect(parsedMessage.breakingChanges.length).toBe(1); + }); + + it('when a summary and description are provied', () => { + const message = buildCommitMessage({ + footer: `BREAKING CHANGE: ${summary}\n\n${description}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.breakingChanges[0].text).toBe(`${summary}\n\n${description}`); + expect(parsedMessage.breakingChanges.length).toBe(1); + }); + }); + + describe('parses deprecation notes', () => { + const summary = 'This will break things later'; + const description = 'This is a long winded explanation of why it \nwill break things later.'; + + + it('when only a summary is provided', () => { + const message = buildCommitMessage({ + footer: `DEPRECATED: ${summary}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.deprecations[0].text).toBe(summary); + expect(parsedMessage.deprecations.length).toBe(1); + }); + + it('when only a description is provided', () => { + const message = buildCommitMessage({ + footer: `DEPRECATED:\n\n${description}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.deprecations[0].text).toBe(description); + expect(parsedMessage.deprecations.length).toBe(1); + }); + + it('when a summary and description are provied', () => { + const message = buildCommitMessage({ + footer: `DEPRECATED: ${summary}\n\n${description}`, + }); + const parsedMessage = parseCommitMessage(message); + expect(parsedMessage.deprecations[0].text).toBe(`${summary}\n\n${description}`); + expect(parsedMessage.deprecations.length).toBe(1); + }); }); }); diff --git a/dev-infra/commit-message/parse.ts b/dev-infra/commit-message/parse.ts index bbd95502e775..365b7492b095 100644 --- a/dev-infra/commit-message/parse.ts +++ b/dev-infra/commit-message/parse.ts @@ -6,80 +6,129 @@ * found in the LICENSE file at https://angular.io/license */ +import {Commit as ParsedCommit, Options, sync as parse} from 'conventional-commits-parser'; + import {exec} from '../utils/shelljs'; -/** A parsed commit message. */ -export interface ParsedCommitMessage { + +/** A parsed commit, containing the information needed to validate the commit. */ +export interface Commit { + /** The full raw text of the commit. */ + fullText: string; + /** The header line of the commit, will be used in the changelog entries. */ header: string; + /** The full body of the commit, not including the footer. */ body: string; - bodyWithoutLinking: string; + /** The footer of the commit, containing issue references and note sections. */ + footer: string; + /** A list of the references to other issues made throughout the commit message. */ + references: ParsedCommit.Reference[]; + /** The type of the commit message. */ type: string; + /** The scope of the commit message. */ scope: string; + /** The npm scope of the commit message. */ + npmScope: string; + /** The subject of the commit message. */ subject: string; + /** A list of breaking change notes in the commit message. */ + breakingChanges: ParsedCommit.Note[]; + /** A list of deprecation notes in the commit message. */ + deprecations: ParsedCommit.Note[]; + /** Whether the commit is a fixup commit. */ isFixup: boolean; + /** Whether the commit is a squash commit. */ isSquash: boolean; + /** Whether the commit is a revert commit. */ isRevert: boolean; } +/** Markers used to denote the start of a note section in a commit. */ +enum NoteSections { + BREAKING_CHANGE = 'BREAKING CHANGE', + DEPRECATED = 'DEPRECATED', +} /** Regex determining if a commit is a fixup. */ const FIXUP_PREFIX_RE = /^fixup! /i; -/** Regex finding all github keyword links. */ -const GITHUB_LINKING_RE = /((closed?s?)|(fix(es)?(ed)?)|(resolved?s?))\s\#(\d+)/ig; /** Regex determining if a commit is a squash. */ const SQUASH_PREFIX_RE = /^squash! /i; /** Regex determining if a commit is a revert. */ const REVERT_PREFIX_RE = /^revert:? /i; -/** Regex determining the scope of a commit if provided. */ -const TYPE_SCOPE_RE = /^(\w+)(?:\(([^)]+)\))?\:\s(.+)$/; -/** Regex determining the entire header line of the commit. */ -const COMMIT_HEADER_RE = /^(.*)/i; -/** Regex determining the body of the commit. */ -const COMMIT_BODY_RE = /^.*\n\n([\s\S]*)$/; +/** + * Regex pattern for parsing the header line of a commit. + * + * Several groups are being matched to be used in the parsed commit object, being mapped to the + * `headerCorrespondence` object. + * + * The pattern can be broken down into component parts: + * - `(\w+)` - a capturing group discovering the type of the commit. + * - `(?:\((?:([^/]+)\/)?([^)]+)\))?` - a pair of capturing groups to capture the scope and, + * optionally the npmScope of the commit. + * - `(.*)` - a capturing group discovering the subject of the commit. + */ +const headerPattern = /^(\w+)(?:\((?:([^/]+)\/)?([^)]+)\))?: (.*)$/; +/** + * The property names used for the values extracted from the header via the `headerPattern` regex. + */ +const headerCorrespondence = ['type', 'npmScope', 'scope', 'subject']; +/** + * Configuration options for the commit parser. + * + * NOTE: An extended type from `Options` must be used because the current + * @types/conventional-commits-parser version does not include the `notesPattern` field. + */ +const parseOptions: Options&{notesPattern: (keywords: string) => RegExp} = { + commentChar: '#', + headerPattern, + headerCorrespondence, + noteKeywords: [NoteSections.BREAKING_CHANGE, NoteSections.DEPRECATED], + notesPattern: (keywords: string) => new RegExp(`(${keywords})(?:: ?)(.*)`), +}; -/** Parse a full commit message into its composite parts. */ -export function parseCommitMessage(commitMsg: string): ParsedCommitMessage { - // Ignore comments (i.e. lines starting with `#`). Comments are automatically removed by git and - // should not be considered part of the final commit message. - commitMsg = commitMsg.split('\n').filter(line => !line.startsWith('#')).join('\n'); - let header = ''; - let body = ''; - let bodyWithoutLinking = ''; - let type = ''; - let scope = ''; - let subject = ''; +/** Parse a full commit message into its composite parts. */ +export function parseCommitMessage(fullText: string): Commit { + /** The commit message text with the fixup and squash markers stripped out. */ + const strippedCommitMsg = fullText.replace(FIXUP_PREFIX_RE, '') + .replace(SQUASH_PREFIX_RE, '') + .replace(REVERT_PREFIX_RE, ''); + /** The initially parsed commit. */ + const commit = parse(strippedCommitMsg, parseOptions); + /** A list of breaking change notes from the commit. */ + const breakingChanges: ParsedCommit.Note[] = []; + /** A list of deprecation notes from the commit. */ + const deprecations: ParsedCommit.Note[] = []; - if (COMMIT_HEADER_RE.test(commitMsg)) { - header = COMMIT_HEADER_RE.exec(commitMsg)![1] - .replace(FIXUP_PREFIX_RE, '') - .replace(SQUASH_PREFIX_RE, ''); - } - if (COMMIT_BODY_RE.test(commitMsg)) { - body = COMMIT_BODY_RE.exec(commitMsg)![1]; - bodyWithoutLinking = body.replace(GITHUB_LINKING_RE, ''); - } + // Extract the commit message notes by marked types into their respective lists. + commit.notes.forEach((note: ParsedCommit.Note) => { + if (note.title === NoteSections.BREAKING_CHANGE) { + return breakingChanges.push(note); + } + if (note.title === NoteSections.DEPRECATED) { + return deprecations.push(note); + } + }); - if (TYPE_SCOPE_RE.test(header)) { - const parsedCommitHeader = TYPE_SCOPE_RE.exec(header)!; - type = parsedCommitHeader[1]; - scope = parsedCommitHeader[2]; - subject = parsedCommitHeader[3]; - } return { - header, - body, - bodyWithoutLinking, - type, - scope, - subject, - isFixup: FIXUP_PREFIX_RE.test(commitMsg), - isSquash: SQUASH_PREFIX_RE.test(commitMsg), - isRevert: REVERT_PREFIX_RE.test(commitMsg), + fullText, + breakingChanges, + deprecations, + body: commit.body || '', + footer: commit.footer || '', + header: commit.header || '', + references: commit.references, + scope: commit.scope || '', + subject: commit.subject || '', + type: commit.type || '', + npmScope: commit.npmScope || '', + isFixup: FIXUP_PREFIX_RE.test(fullText), + isSquash: SQUASH_PREFIX_RE.test(fullText), + isRevert: REVERT_PREFIX_RE.test(fullText), }; } /** Retrieve and parse each commit message in a provide range. */ -export function parseCommitMessagesForRange(range: string): ParsedCommitMessage[] { +export function parseCommitMessagesForRange(range: string): Commit[] { /** A random number used as a split point in the git log result. */ const randomValueSeparator = `${Math.random()}`; /** diff --git a/dev-infra/commit-message/restore-commit-message/cli.ts b/dev-infra/commit-message/restore-commit-message/cli.ts index 6f4a2dacdcd3..09e0c8354d66 100644 --- a/dev-infra/commit-message/restore-commit-message/cli.ts +++ b/dev-infra/commit-message/restore-commit-message/cli.ts @@ -8,7 +8,7 @@ import {Arguments, Argv, CommandModule} from 'yargs'; -import {CommitMsgSource} from '../commit-message-source'; +import {CommitMsgSource} from './commit-message-source'; import {restoreCommitMessage} from './restore-commit-message'; diff --git a/dev-infra/commit-message/commit-message-draft.ts b/dev-infra/commit-message/restore-commit-message/commit-message-draft.ts similarity index 100% rename from dev-infra/commit-message/commit-message-draft.ts rename to dev-infra/commit-message/restore-commit-message/commit-message-draft.ts diff --git a/dev-infra/commit-message/commit-message-source.ts b/dev-infra/commit-message/restore-commit-message/commit-message-source.ts similarity index 100% rename from dev-infra/commit-message/commit-message-source.ts rename to dev-infra/commit-message/restore-commit-message/commit-message-source.ts diff --git a/dev-infra/commit-message/restore-commit-message/restore-commit-message.ts b/dev-infra/commit-message/restore-commit-message/restore-commit-message.ts index 8008728d0bca..d2551732bed8 100644 --- a/dev-infra/commit-message/restore-commit-message/restore-commit-message.ts +++ b/dev-infra/commit-message/restore-commit-message/restore-commit-message.ts @@ -10,8 +10,8 @@ import {writeFileSync} from 'fs'; import {debug, log} from '../../utils/console'; -import {loadCommitMessageDraft} from '../commit-message-draft'; -import {CommitMsgSource} from '../commit-message-source'; +import {loadCommitMessageDraft} from './commit-message-draft'; +import {CommitMsgSource} from './commit-message-source'; /** * Restore the commit message draft to the git to be used as the default commit message. diff --git a/dev-infra/commit-message/validate-file/validate-file.ts b/dev-infra/commit-message/validate-file/validate-file.ts index 459fa52fa95f..965b0c6a5c5d 100644 --- a/dev-infra/commit-message/validate-file/validate-file.ts +++ b/dev-infra/commit-message/validate-file/validate-file.ts @@ -11,7 +11,7 @@ import {resolve} from 'path'; import {getRepoBaseDir} from '../../utils/config'; import {error, green, info, log, red, yellow} from '../../utils/console'; -import {deleteCommitMessageDraft, saveCommitMessageDraft} from '../commit-message-draft'; +import {deleteCommitMessageDraft, saveCommitMessageDraft} from '../restore-commit-message/commit-message-draft'; import {printValidationErrors, validateCommitMessage} from '../validate'; /** Validate commit message at the provided file path. */ diff --git a/dev-infra/commit-message/validate-range/validate-range.ts b/dev-infra/commit-message/validate-range/validate-range.ts index 56158e74deff..226f5bd6d05b 100644 --- a/dev-infra/commit-message/validate-range/validate-range.ts +++ b/dev-infra/commit-message/validate-range/validate-range.ts @@ -6,15 +6,14 @@ * found in the LICENSE file at https://angular.io/license */ import {error, info} from '../../utils/console'; - -import {parseCommitMessagesForRange, ParsedCommitMessage} from '../parse'; +import {Commit, parseCommitMessagesForRange} from '../parse'; import {printValidationErrors, validateCommitMessage, ValidateCommitMessageOptions} from '../validate'; // Whether the provided commit is a fixup commit. -const isNonFixup = (commit: ParsedCommitMessage) => !commit.isFixup; +const isNonFixup = (commit: Commit) => !commit.isFixup; // Extracts commit header (first line of commit message). -const extractCommitHeader = (commit: ParsedCommitMessage) => commit.header; +const extractCommitHeader = (commit: Commit) => commit.header; /** Validate all commits in a provided git commit range. */ export function validateCommitRange(range: string) { diff --git a/dev-infra/commit-message/validate.spec.ts b/dev-infra/commit-message/validate.spec.ts index 24fb996698c2..3e9aa01ff296 100644 --- a/dev-infra/commit-message/validate.spec.ts +++ b/dev-infra/commit-message/validate.spec.ts @@ -63,7 +63,7 @@ describe('validate-commit-message.js', () => { }); it('should skip max length limit for URLs', () => { - const msg = 'fix(compiler): this is just an usual commit message tile\n\n' + + const msg = 'fix(compiler): this is just a usual commit message title\n\n' + 'This is a normal commit message body which does not exceed the max length\n' + 'limit. For more details see the following super long URL:\n\n' + 'https://github.com/angular/components/commit/e2ace018ddfad10608e0e32932c43dcfef4095d7#diff-9879d6db96fd29134fc802214163b95a'; @@ -263,5 +263,72 @@ describe('validate-commit-message.js', () => { VALID); }); }); + + describe('breaking change', () => { + it('should allow valid breaking change commit descriptions', () => { + const msgWithSummary = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE: This is a summary of a breaking change.'; + expectValidationResult(validateCommitMessage(msgWithSummary), VALID); + + const msgWithDescription = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE:\n\n' + + 'This is a full description of the breaking change.'; + expectValidationResult(validateCommitMessage(msgWithDescription), VALID); + + const msgWithSummaryAndDescription = + 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE: This is a summary of a breaking change.\n\n' + + 'This is a full description of the breaking change.'; + expectValidationResult(validateCommitMessage(msgWithSummaryAndDescription), VALID); + + const msgWithNonBreaking = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is not a\n' + + 'breaking change commit.'; + expectValidationResult(validateCommitMessage(msgWithNonBreaking), VALID); + }); + + it('should fail for non-valid breaking change commit descriptions', () => { + const msgWithSummary = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE This is a summary of a breaking change.'; + expectValidationResult( + validateCommitMessage(msgWithSummary), INVALID, + [`The commit message body contains an invalid breaking change description.`]); + + const msgWithPlural = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGES: This is a summary of a breaking change.'; + expectValidationResult( + validateCommitMessage(msgWithPlural), INVALID, + [`The commit message body contains an invalid breaking change description.`]); + + const msgWithDescription = 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE:\n' + + 'This is a full description of the breaking change.'; + expectValidationResult( + validateCommitMessage(msgWithDescription), INVALID, + [`The commit message body contains an invalid breaking change description.`]); + + const msgWithSummaryAndDescription = + 'feat(compiler): this is just a usual commit message title\n\n' + + 'This is a normal commit message body which does not exceed the max length\n' + + 'limit. For more details see the following super long URL:\n\n' + + 'BREAKING CHANGE\n\n' + + 'This is a full description of the breaking change.'; + expectValidationResult( + validateCommitMessage(msgWithSummaryAndDescription), INVALID, + [`The commit message body contains an invalid breaking change description.`]); + }); + }); }); }); diff --git a/dev-infra/commit-message/validate.ts b/dev-infra/commit-message/validate.ts index 578f5999738a..0aa30c5aa132 100644 --- a/dev-infra/commit-message/validate.ts +++ b/dev-infra/commit-message/validate.ts @@ -5,10 +5,11 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ + import {error} from '../utils/console'; import {COMMIT_TYPES, getCommitMessageConfig, ScopeRequirement} from './config'; -import {parseCommitMessage, ParsedCommitMessage} from './parse'; +import {Commit, parseCommitMessage} from './parse'; /** Options for commit message validation. */ export interface ValidateCommitMessageOptions { @@ -20,15 +21,25 @@ export interface ValidateCommitMessageOptions { export interface ValidateCommitMessageResult { valid: boolean; errors: string[]; - commit: ParsedCommitMessage; + commit: Commit; } /** Regex matching a URL for an entire commit body line. */ const COMMIT_BODY_URL_LINE_RE = /^https?:\/\/.*$/; +/** + * Regex matching a breaking change. + * + * - Starts with BREAKING CHANGE + * - Followed by a colon + * - Followed by a single space or two consecutive new lines + * + * NB: Anything after `BREAKING CHANGE` is optional to facilitate the validation. + */ +const COMMIT_BODY_BREAKING_CHANGE_RE = /^BREAKING CHANGE(:( |\n{2}))?/m; /** Validate a commit message against using the local repo's config. */ export function validateCommitMessage( - commitMsg: string|ParsedCommitMessage, + commitMsg: string|Commit, options: ValidateCommitMessageOptions = {}): ValidateCommitMessageResult { const config = getCommitMessageConfig().commitMessage; const commit = typeof commitMsg === 'string' ? parseCommitMessage(commitMsg) : commitMsg; @@ -36,8 +47,6 @@ export function validateCommitMessage( /** Perform the validation checks against the parsed commit. */ function validateCommitAndCollectErrors() { - // TODO(josephperrott): Remove early return calls when commit message errors are found - //////////////////////////////////// // Checking revert, squash, fixup // //////////////////////////////////// @@ -123,25 +132,38 @@ export function validateCommitMessage( ////////////////////////// if (!config.minBodyLengthTypeExcludes?.includes(commit.type) && - commit.bodyWithoutLinking.trim().length < config.minBodyLength) { + commit.body.trim().length < config.minBodyLength) { errors.push(`The commit message body does not meet the minimum length of ${ config.minBodyLength} characters`); return false; } const bodyByLine = commit.body.split('\n'); - const lineExceedsMaxLength = bodyByLine.some(line => { + const lineExceedsMaxLength = bodyByLine.some((line: string) => { // Check if any line exceeds the max line length limit. The limit is ignored for // lines that just contain an URL (as these usually cannot be wrapped or shortened). return line.length > config.maxLineLength && !COMMIT_BODY_URL_LINE_RE.test(line); }); if (lineExceedsMaxLength) { - errors.push( - `The commit message body contains lines greater than ${config.maxLineLength} characters`); + errors.push(`The commit message body contains lines greater than ${ + config.maxLineLength} characters.`); return false; } + // Breaking change + // Check if the commit message contains a valid break change description. + // https://github.com/angular/angular/blob/88fbc066775ab1a2f6a8c75f933375b46d8fa9a4/CONTRIBUTING.md#commit-message-footer + const hasBreakingChange = COMMIT_BODY_BREAKING_CHANGE_RE.exec(commit.fullText); + if (hasBreakingChange !== null) { + const [, breakingChangeDescription] = hasBreakingChange; + if (!breakingChangeDescription) { + // Not followed by :, space or two consecutive new lines, + errors.push(`The commit message body contains an invalid breaking change description.`); + return false; + } + } + return true; } @@ -160,4 +182,9 @@ export function printValidationErrors(errors: string[], print = error) { print(); print(''); print(); + print(`BREAKING CHANGE: `); + print(); + print(``); + print(); + print(); } diff --git a/dev-infra/commit-message/wizard/cli.ts b/dev-infra/commit-message/wizard/cli.ts deleted file mode 100644 index b4cc94cfa69f..000000000000 --- a/dev-infra/commit-message/wizard/cli.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Arguments, Argv, CommandModule} from 'yargs'; - -import {CommitMsgSource} from '../commit-message-source'; - -import {runWizard} from './wizard'; - - -export interface WizardOptions { - filePath: string; - commitSha: string|undefined; - source: CommitMsgSource|undefined; -} - -/** Builds the command. */ -function builder(yargs: Argv) { - return yargs - .positional('filePath', { - description: 'The file path to write the generated commit message into', - type: 'string', - demandOption: true, - }) - .positional('source', { - choices: ['message', 'template', 'merge', 'squash', 'commit'] as const, - description: 'The source of the commit message as described here: ' + - 'https://git-scm.com/docs/githooks#_prepare_commit_msg' - }) - .positional('commitSha', { - description: 'The commit sha if source is set to `commit`', - type: 'string', - }); -} - -/** Handles the command. */ -async function handler(args: Arguments) { - await runWizard(args); -} - -/** yargs command module describing the command. */ -export const WizardModule: CommandModule<{}, WizardOptions> = { - handler, - builder, - command: 'wizard [source] [commitSha]', - // Description: Run the wizard to build a base commit message before opening to complete. - // No describe is defiend to hide the command from the --help. - describe: false, -}; diff --git a/dev-infra/commit-message/wizard/wizard.ts b/dev-infra/commit-message/wizard/wizard.ts deleted file mode 100644 index 40623fed1025..000000000000 --- a/dev-infra/commit-message/wizard/wizard.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import {writeFileSync} from 'fs'; - -import {getUserConfig} from '../../utils/config'; -import {debug, info} from '../../utils/console'; - -import {buildCommitMessage} from '../builder'; -import {CommitMsgSource} from '../commit-message-source'; - - -/** The default commit message used if the wizard does not procude a commit message. */ -const defaultCommitMessage = `(): - -# \n\n`; - -export async function runWizard( - args: {filePath: string, source?: CommitMsgSource, commitSha?: string}) { - if (getUserConfig().commitMessage?.disableWizard) { - debug('Skipping commit message wizard due to enabled `commitMessage.disableWizard` option in'); - debug('user config.'); - process.exitCode = 0; - return; - } - - if (args.source !== undefined) { - info(`Skipping commit message wizard because the commit was created via '${ - args.source}' source`); - process.exitCode = 0; - return; - } - - // Set the default commit message to be updated if the user cancels out of the wizard in progress - writeFileSync(args.filePath, defaultCommitMessage); - - /** The generated commit message. */ - const commitMessage = await buildCommitMessage(); - writeFileSync(args.filePath, commitMessage); -} diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index 2c9464ced231..20b77696bfb7 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -8,7 +8,6 @@ var tslib = require('tslib'); var chalk = _interopDefault(require('chalk')); var fs = require('fs'); var inquirer = require('inquirer'); -var inquirerAutocomplete = require('inquirer-autocomplete-prompt'); var path = require('path'); var shelljs = require('shelljs'); var url = require('url'); @@ -20,6 +19,7 @@ var fetch = _interopDefault(require('node-fetch')); var semver = require('semver'); var multimatch = require('multimatch'); var yaml = require('yaml'); +var conventionalCommitsParser = require('conventional-commits-parser'); var cliProgress = require('cli-progress'); var os = require('os'); var minimatch = require('minimatch'); @@ -231,53 +231,6 @@ function promptConfirm(message, defaultValue) { }); }); } -function promptAutocomplete(message, choices, noChoiceText) { - return tslib.__awaiter(this, void 0, void 0, function () { - var prompt, result; - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - prompt = inquirer.createPromptModule({}).registerPrompt('autocomplete', inquirerAutocomplete); - if (noChoiceText) { - choices = tslib.__spreadArray([noChoiceText], tslib.__read(choices)); - } - return [4 /*yield*/, prompt({ - type: 'autocomplete', - name: 'result', - message: message, - source: function (_, input) { - if (!input) { - return Promise.resolve(choices); - } - return Promise.resolve(choices.filter(function (choice) { - if (typeof choice === 'string') { - return choice.includes(input); - } - return choice.name.includes(input); - })); - } - })]; - case 1: - result = (_a.sent()).result; - if (result === noChoiceText) { - return [2 /*return*/, false]; - } - return [2 /*return*/, result]; - } - }); - }); -} -/** Prompts the user for one line of input. */ -function promptInput(message) { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, inquirer.prompt({ type: 'input', name: 'result', message: message })]; - case 1: return [2 /*return*/, (_a.sent()).result]; - } - }); - }); -} /** * Supported levels for logging functions. * @@ -1731,56 +1684,84 @@ const COMMIT_TYPES = { * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ +/** Markers used to denote the start of a note section in a commit. */ +var NoteSections; +(function (NoteSections) { + NoteSections["BREAKING_CHANGE"] = "BREAKING CHANGE"; + NoteSections["DEPRECATED"] = "DEPRECATED"; +})(NoteSections || (NoteSections = {})); /** Regex determining if a commit is a fixup. */ const FIXUP_PREFIX_RE = /^fixup! /i; -/** Regex finding all github keyword links. */ -const GITHUB_LINKING_RE = /((closed?s?)|(fix(es)?(ed)?)|(resolved?s?))\s\#(\d+)/ig; /** Regex determining if a commit is a squash. */ const SQUASH_PREFIX_RE = /^squash! /i; /** Regex determining if a commit is a revert. */ const REVERT_PREFIX_RE = /^revert:? /i; -/** Regex determining the scope of a commit if provided. */ -const TYPE_SCOPE_RE = /^(\w+)(?:\(([^)]+)\))?\:\s(.+)$/; -/** Regex determining the entire header line of the commit. */ -const COMMIT_HEADER_RE = /^(.*)/i; -/** Regex determining the body of the commit. */ -const COMMIT_BODY_RE = /^.*\n\n([\s\S]*)$/; +/** + * Regex pattern for parsing the header line of a commit. + * + * Several groups are being matched to be used in the parsed commit object, being mapped to the + * `headerCorrespondence` object. + * + * The pattern can be broken down into component parts: + * - `(\w+)` - a capturing group discovering the type of the commit. + * - `(?:\((?:([^/]+)\/)?([^)]+)\))?` - a pair of capturing groups to capture the scope and, + * optionally the npmScope of the commit. + * - `(.*)` - a capturing group discovering the subject of the commit. + */ +const headerPattern = /^(\w+)(?:\((?:([^/]+)\/)?([^)]+)\))?: (.*)$/; +/** + * The property names used for the values extracted from the header via the `headerPattern` regex. + */ +const headerCorrespondence = ['type', 'npmScope', 'scope', 'subject']; +/** + * Configuration options for the commit parser. + * + * NOTE: An extended type from `Options` must be used because the current + * @types/conventional-commits-parser version does not include the `notesPattern` field. + */ +const parseOptions = { + commentChar: '#', + headerPattern, + headerCorrespondence, + noteKeywords: [NoteSections.BREAKING_CHANGE, NoteSections.DEPRECATED], + notesPattern: (keywords) => new RegExp(`(${keywords})(?:: ?)(.*)`), +}; /** Parse a full commit message into its composite parts. */ -function parseCommitMessage(commitMsg) { - // Ignore comments (i.e. lines starting with `#`). Comments are automatically removed by git and - // should not be considered part of the final commit message. - commitMsg = commitMsg.split('\n').filter(line => !line.startsWith('#')).join('\n'); - let header = ''; - let body = ''; - let bodyWithoutLinking = ''; - let type = ''; - let scope = ''; - let subject = ''; - if (COMMIT_HEADER_RE.test(commitMsg)) { - header = COMMIT_HEADER_RE.exec(commitMsg)[1] - .replace(FIXUP_PREFIX_RE, '') - .replace(SQUASH_PREFIX_RE, ''); - } - if (COMMIT_BODY_RE.test(commitMsg)) { - body = COMMIT_BODY_RE.exec(commitMsg)[1]; - bodyWithoutLinking = body.replace(GITHUB_LINKING_RE, ''); - } - if (TYPE_SCOPE_RE.test(header)) { - const parsedCommitHeader = TYPE_SCOPE_RE.exec(header); - type = parsedCommitHeader[1]; - scope = parsedCommitHeader[2]; - subject = parsedCommitHeader[3]; - } +function parseCommitMessage(fullText) { + /** The commit message text with the fixup and squash markers stripped out. */ + const strippedCommitMsg = fullText.replace(FIXUP_PREFIX_RE, '') + .replace(SQUASH_PREFIX_RE, '') + .replace(REVERT_PREFIX_RE, ''); + /** The initially parsed commit. */ + const commit = conventionalCommitsParser.sync(strippedCommitMsg, parseOptions); + /** A list of breaking change notes from the commit. */ + const breakingChanges = []; + /** A list of deprecation notes from the commit. */ + const deprecations = []; + // Extract the commit message notes by marked types into their respective lists. + commit.notes.forEach((note) => { + if (note.title === NoteSections.BREAKING_CHANGE) { + return breakingChanges.push(note); + } + if (note.title === NoteSections.DEPRECATED) { + return deprecations.push(note); + } + }); return { - header, - body, - bodyWithoutLinking, - type, - scope, - subject, - isFixup: FIXUP_PREFIX_RE.test(commitMsg), - isSquash: SQUASH_PREFIX_RE.test(commitMsg), - isRevert: REVERT_PREFIX_RE.test(commitMsg), + fullText, + breakingChanges, + deprecations, + body: commit.body || '', + footer: commit.footer || '', + header: commit.header || '', + references: commit.references, + scope: commit.scope || '', + subject: commit.subject || '', + type: commit.type || '', + npmScope: commit.npmScope || '', + isFixup: FIXUP_PREFIX_RE.test(fullText), + isSquash: SQUASH_PREFIX_RE.test(fullText), + isRevert: REVERT_PREFIX_RE.test(fullText), }; } /** Retrieve and parse each commit message in a provide range. */ @@ -1817,6 +1798,16 @@ function parseCommitMessagesForRange(range) { */ /** Regex matching a URL for an entire commit body line. */ const COMMIT_BODY_URL_LINE_RE = /^https?:\/\/.*$/; +/** + * Regex matching a breaking change. + * + * - Starts with BREAKING CHANGE + * - Followed by a colon + * - Followed by a single space or two consecutive new lines + * + * NB: Anything after `BREAKING CHANGE` is optional to facilitate the validation. + */ +const COMMIT_BODY_BREAKING_CHANGE_RE = /^BREAKING CHANGE(:( |\n{2}))?/m; /** Validate a commit message against using the local repo's config. */ function validateCommitMessage(commitMsg, options = {}) { const config = getCommitMessageConfig().commitMessage; @@ -1824,11 +1815,10 @@ function validateCommitMessage(commitMsg, options = {}) { const errors = []; /** Perform the validation checks against the parsed commit. */ function validateCommitAndCollectErrors() { - // TODO(josephperrott): Remove early return calls when commit message errors are found - var _a; //////////////////////////////////// // Checking revert, squash, fixup // //////////////////////////////////// + var _a; // All revert commits are considered valid. if (commit.isRevert) { return true; @@ -1892,20 +1882,32 @@ function validateCommitMessage(commitMsg, options = {}) { // Checking commit body // ////////////////////////// if (!((_a = config.minBodyLengthTypeExcludes) === null || _a === void 0 ? void 0 : _a.includes(commit.type)) && - commit.bodyWithoutLinking.trim().length < config.minBodyLength) { + commit.body.trim().length < config.minBodyLength) { errors.push(`The commit message body does not meet the minimum length of ${config.minBodyLength} characters`); return false; } const bodyByLine = commit.body.split('\n'); - const lineExceedsMaxLength = bodyByLine.some(line => { + const lineExceedsMaxLength = bodyByLine.some((line) => { // Check if any line exceeds the max line length limit. The limit is ignored for // lines that just contain an URL (as these usually cannot be wrapped or shortened). return line.length > config.maxLineLength && !COMMIT_BODY_URL_LINE_RE.test(line); }); if (lineExceedsMaxLength) { - errors.push(`The commit message body contains lines greater than ${config.maxLineLength} characters`); + errors.push(`The commit message body contains lines greater than ${config.maxLineLength} characters.`); return false; } + // Breaking change + // Check if the commit message contains a valid break change description. + // https://github.com/angular/angular/blob/88fbc066775ab1a2f6a8c75f933375b46d8fa9a4/CONTRIBUTING.md#commit-message-footer + const hasBreakingChange = COMMIT_BODY_BREAKING_CHANGE_RE.exec(commit.fullText); + if (hasBreakingChange !== null) { + const [, breakingChangeDescription] = hasBreakingChange; + if (!breakingChangeDescription) { + // Not followed by :, space or two consecutive new lines, + errors.push(`The commit message body contains an invalid breaking change description.`); + return false; + } + } return true; } return { valid: validateCommitAndCollectErrors(), errors, commit }; @@ -1921,6 +1923,11 @@ function printValidationErrors(errors, print = error) { print(); print(''); print(); + print(`BREAKING CHANGE: `); + print(); + print(``); + print(); + print(); } /** @@ -2098,135 +2105,11 @@ const ValidateRangeModule = { describe: 'Validate a range of commit messages', }; -/** Validate commit message at the provided file path. */ -function buildCommitMessage() { - return tslib.__awaiter(this, void 0, void 0, function* () { - // TODO(josephperrott): Add support for skipping wizard with local untracked config file - // TODO(josephperrott): Add default commit message information/commenting into generated messages - info('Just a few questions to start building the commit message!'); - /** The commit message type. */ - const type = yield promptForCommitMessageType(); - /** The commit message scope. */ - const scope = yield promptForCommitMessageScopeForType(type); - /** The commit message summary. */ - const summary = yield promptForCommitMessageSummary(); - return `${type.name}${scope ? '(' + scope + ')' : ''}: ${summary}\n\n`; - }); -} -/** Prompts in the terminal for the commit message's type. */ -function promptForCommitMessageType() { - return tslib.__awaiter(this, void 0, void 0, function* () { - info('The type of change in the commit. Allows a reader to know the effect of the change,'); - info('whether it brings a new feature, adds additional testing, documents the `project, etc.'); - /** List of commit type options for the autocomplete prompt. */ - const typeOptions = Object.values(COMMIT_TYPES).map(({ description, name }) => { - return { - name: `${name} - ${description}`, - value: name, - short: name, - }; - }); - /** The key of a commit message type, selected by the user via prompt. */ - const typeName = yield promptAutocomplete('Select a type for the commit:', typeOptions); - return COMMIT_TYPES[typeName]; - }); -} -/** Prompts in the terminal for the commit message's scope. */ -function promptForCommitMessageScopeForType(type) { - return tslib.__awaiter(this, void 0, void 0, function* () { - // If the commit type's scope requirement is forbidden, return early. - if (type.scope === ScopeRequirement.Forbidden) { - info(`Skipping scope selection as the '${type.name}' type does not allow scopes`); - return false; - } - /** Commit message configuration */ - const config = getCommitMessageConfig(); - info('The area of the repository the changes in this commit most affects.'); - return yield promptAutocomplete('Select a scope for the commit:', config.commitMessage.scopes, type.scope === ScopeRequirement.Optional ? '' : ''); - }); -} -/** Prompts in the terminal for the commit message's summary. */ -function promptForCommitMessageSummary() { - return tslib.__awaiter(this, void 0, void 0, function* () { - info('Provide a short summary of what the changes in the commit do'); - return yield promptInput('Provide a short summary of the commit'); - }); -} - -/** The default commit message used if the wizard does not procude a commit message. */ -const defaultCommitMessage = `(): - -# \n\n`; -function runWizard(args) { - var _a; - return tslib.__awaiter(this, void 0, void 0, function* () { - if ((_a = getUserConfig().commitMessage) === null || _a === void 0 ? void 0 : _a.disableWizard) { - debug('Skipping commit message wizard due to enabled `commitMessage.disableWizard` option in'); - debug('user config.'); - process.exitCode = 0; - return; - } - if (args.source !== undefined) { - info(`Skipping commit message wizard because the commit was created via '${args.source}' source`); - process.exitCode = 0; - return; - } - // Set the default commit message to be updated if the user cancels out of the wizard in progress - fs.writeFileSync(args.filePath, defaultCommitMessage); - /** The generated commit message. */ - const commitMessage = yield buildCommitMessage(); - fs.writeFileSync(args.filePath, commitMessage); - }); -} - -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** Builds the command. */ -function builder$4(yargs) { - return yargs - .positional('filePath', { - description: 'The file path to write the generated commit message into', - type: 'string', - demandOption: true, - }) - .positional('source', { - choices: ['message', 'template', 'merge', 'squash', 'commit'], - description: 'The source of the commit message as described here: ' + - 'https://git-scm.com/docs/githooks#_prepare_commit_msg' - }) - .positional('commitSha', { - description: 'The commit sha if source is set to `commit`', - type: 'string', - }); -} -/** Handles the command. */ -function handler$4(args) { - return tslib.__awaiter(this, void 0, void 0, function* () { - yield runWizard(args); - }); -} -/** yargs command module describing the command. */ -const WizardModule = { - handler: handler$4, - builder: builder$4, - command: 'wizard [source] [commitSha]', - // Description: Run the wizard to build a base commit message before opening to complete. - // No describe is defiend to hide the command from the --help. - describe: false, -}; - /** Build the parser for the commit-message commands. */ function buildCommitMessageParser(localYargs) { return localYargs.help() .strict() .command(RestoreCommitMessageModule) - .command(WizardModule) .command(ValidateFileModule) .command(ValidateRangeModule); } @@ -2908,7 +2791,7 @@ function printTargetBranchesForPr(prNumber) { * found in the LICENSE file at https://angular.io/license */ /** Builds the command. */ -function builder$5(yargs) { +function builder$4(yargs) { return yargs.positional('pr', { description: 'The pull request number', type: 'number', @@ -2916,15 +2799,15 @@ function builder$5(yargs) { }); } /** Handles the command. */ -function handler$5({ pr }) { +function handler$4({ pr }) { return tslib.__awaiter(this, void 0, void 0, function* () { yield printTargetBranchesForPr(pr); }); } /** yargs command module describing the command. */ const CheckTargetBranchesModule = { - handler: handler$5, - builder: builder$5, + handler: handler$4, + builder: builder$4, command: 'check-target-branches ', describe: 'Check a PR to determine what branches it is currently targeting', }; @@ -3129,11 +3012,11 @@ function checkOutPullRequestLocally(prNumber, githubToken, opts = {}) { * found in the LICENSE file at https://angular.io/license */ /** Builds the checkout pull request command. */ -function builder$6(yargs) { +function builder$5(yargs) { return addGithubTokenOption(yargs).positional('prNumber', { type: 'number', demandOption: true }); } /** Handles the checkout pull request command. */ -function handler$6({ prNumber, githubToken }) { +function handler$5({ prNumber, githubToken }) { return tslib.__awaiter(this, void 0, void 0, function* () { const prCheckoutOptions = { allowIfMaintainerCannotModify: true, branchName: `pr-${prNumber}` }; yield checkOutPullRequestLocally(prNumber, githubToken, prCheckoutOptions); @@ -3141,8 +3024,8 @@ function handler$6({ prNumber, githubToken }) { } /** yargs command module for checking out a PR */ const CheckoutCommandModule = { - handler: handler$6, - builder: builder$6, + handler: handler$5, + builder: builder$5, command: 'checkout ', describe: 'Checkout a PR from the upstream repo', }; @@ -4293,7 +4176,7 @@ function createPullRequestMergeTask(githubToken, flags) { * found in the LICENSE file at https://angular.io/license */ /** Builds the command. */ -function builder$7(yargs) { +function builder$6(yargs) { return addGithubTokenOption(yargs) .help() .strict() @@ -4309,7 +4192,7 @@ function builder$7(yargs) { }); } /** Handles the command. */ -function handler$7(_a) { +function handler$6(_a) { var pr = _a.pr, githubToken = _a.githubToken, branchPrompt = _a.branchPrompt; return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__generator(this, function (_b) { @@ -4324,8 +4207,8 @@ function handler$7(_a) { } /** yargs command module describing the command. */ var MergeCommandModule = { - handler: handler$7, - builder: builder$7, + handler: handler$6, + builder: builder$6, command: 'merge ', describe: 'Merge a PR into its targeted branches.', }; @@ -4959,7 +4842,7 @@ function buildReleaseOutput() { * found in the LICENSE file at https://angular.io/license */ /** Yargs command builder for configuring the `ng-dev release build` command. */ -function builder$8(argv) { +function builder$7(argv) { return argv.option('json', { type: 'boolean', description: 'Whether the built packages should be printed to stdout as JSON.', @@ -4967,7 +4850,7 @@ function builder$8(argv) { }); } /** Yargs command handler for building a release. */ -function handler$8(args) { +function handler$7(args) { return tslib.__awaiter(this, void 0, void 0, function* () { const { npmPackages } = getReleaseConfig(); let builtPackages = yield buildReleaseOutput(); @@ -5002,8 +4885,8 @@ function handler$8(args) { } /** CLI command module for building release output. */ const ReleaseBuildCommandModule = { - builder: builder$8, - handler: handler$8, + builder: builder$7, + handler: handler$7, command: 'build', describe: 'Builds the release output for the current branch.', }; @@ -6602,11 +6485,11 @@ class ReleaseTool { * found in the LICENSE file at https://angular.io/license */ /** Yargs command builder for configuring the `ng-dev release publish` command. */ -function builder$9(argv) { +function builder$8(argv) { return addGithubTokenOption(argv); } /** Yargs command handler for staging a release. */ -function handler$9(args) { +function handler$8(args) { return tslib.__awaiter(this, void 0, void 0, function* () { const config = getConfig(); const releaseConfig = getReleaseConfig(config); @@ -6630,8 +6513,8 @@ function handler$9(args) { } /** CLI command module for publishing a release. */ const ReleasePublishCommandModule = { - builder: builder$9, - handler: handler$9, + builder: builder$8, + handler: handler$8, command: 'publish', describe: 'Publish new releases and configure version branches.', }; @@ -6643,7 +6526,7 @@ const ReleasePublishCommandModule = { * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -function builder$a(args) { +function builder$9(args) { return args .positional('tagName', { type: 'string', @@ -6657,7 +6540,7 @@ function builder$a(args) { }); } /** Yargs command handler for building a release. */ -function handler$a(args) { +function handler$9(args) { return tslib.__awaiter(this, void 0, void 0, function* () { const { targetVersion: rawVersion, tagName } = args; const { npmPackages, publishRegistry } = getReleaseConfig(); @@ -6689,8 +6572,8 @@ function handler$a(args) { } /** CLI command module for setting an NPM dist tag. */ const ReleaseSetDistTagCommand = { - builder: builder$a, - handler: handler$a, + builder: builder$9, + handler: handler$9, command: 'set-dist-tag ', describe: 'Sets a given NPM dist tag for all release packages.', }; @@ -6769,22 +6652,22 @@ function getCurrentGitUser() { * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -function builder$b(args) { +function builder$a(args) { return args.option('mode', { demandOption: true, description: 'Whether the env-stamp should be built for a snapshot or release', choices: ['snapshot', 'release'] }); } -function handler$b({ mode }) { +function handler$a({ mode }) { return tslib.__awaiter(this, void 0, void 0, function* () { buildEnvStamp(mode); }); } /** CLI command module for building the environment stamp. */ const BuildEnvStampCommand = { - builder: builder$b, - handler: handler$b, + builder: builder$a, + handler: handler$a, command: 'build-env-stamp', describe: 'Build the environment stamping information', }; diff --git a/dev-infra/pr/rebase/BUILD.bazel b/dev-infra/pr/rebase/BUILD.bazel index 6b420d8f6f23..13089d1cbfbe 100644 --- a/dev-infra/pr/rebase/BUILD.bazel +++ b/dev-infra/pr/rebase/BUILD.bazel @@ -11,9 +11,11 @@ ts_library( deps = [ "//dev-infra/commit-message", "//dev-infra/utils", + "@npm//@types/conventional-commits-parser", "@npm//@types/inquirer", "@npm//@types/node", "@npm//@types/yargs", + "@npm//conventional-commits-parser", "@npm//inquirer", "@npm//typed-graphqlify", "@npm//yargs", diff --git a/dev-infra/pr/rebase/index.ts b/dev-infra/pr/rebase/index.ts index 48aecbbc37a2..7fbe88517d67 100644 --- a/dev-infra/pr/rebase/index.ts +++ b/dev-infra/pr/rebase/index.ts @@ -7,8 +7,8 @@ */ import {types as graphQLTypes} from 'typed-graphqlify'; -import {parseCommitMessagesForRange, ParsedCommitMessage} from '../../commit-message/parse'; +import {Commit, parseCommitMessagesForRange} from '../../commit-message/parse'; import {getConfig, NgDevConfig} from '../../utils/config'; import {error, info, promptConfirm} from '../../utils/console'; import {addTokenToGitHttpsUrl} from '../../utils/git/github-urls'; @@ -95,8 +95,7 @@ export async function rebasePr( const commits = parseCommitMessagesForRange(`${commonAncestorSha}..HEAD`); - let squashFixups = - commits.filter((commit: ParsedCommitMessage) => commit.isFixup).length === 0 ? + let squashFixups = commits.filter((commit: Commit) => commit.isFixup).length === 0 ? false : await promptConfirm( `PR #${prNumber} contains fixup commits, would you like to squash them during rebase?`, diff --git a/dev-infra/tmpl-package.json b/dev-infra/tmpl-package.json index 04714dc7a563..5a283b205a7c 100644 --- a/dev-infra/tmpl-package.json +++ b/dev-infra/tmpl-package.json @@ -16,9 +16,9 @@ "brotli": "", "chalk": "", "cli-progress": "", + "conventional-commits-parser": "", "glob": "", "inquirer": "", - "inquirer-autocomplete-prompt": "", "minimatch": "", "multimatch": "", "node-fetch": "", diff --git a/dev-infra/utils/BUILD.bazel b/dev-infra/utils/BUILD.bazel index 122ad9fdf2b2..2b3404c485f7 100644 --- a/dev-infra/utils/BUILD.bazel +++ b/dev-infra/utils/BUILD.bazel @@ -21,7 +21,6 @@ ts_library( "@npm//@types/yargs", "@npm//chalk", "@npm//inquirer", - "@npm//inquirer-autocomplete-prompt", "@npm//shelljs", "@npm//tslib", "@npm//typed-graphqlify", diff --git a/dev-infra/utils/console.ts b/dev-infra/utils/console.ts index 283aeec98268..d07b9e140ad8 100644 --- a/dev-infra/utils/console.ts +++ b/dev-infra/utils/console.ts @@ -8,8 +8,7 @@ import chalk from 'chalk'; import {writeFileSync} from 'fs'; -import {createPromptModule, ListChoiceOptions, prompt} from 'inquirer'; -import * as inquirerAutocomplete from 'inquirer-autocomplete-prompt'; +import {prompt} from 'inquirer'; import {join} from 'path'; import {Arguments} from 'yargs'; @@ -33,47 +32,6 @@ export async function promptConfirm(message: string, defaultValue = false): Prom .result; } -/** Prompts the user to select an option from a filterable autocomplete list. */ -export async function promptAutocomplete( - message: string, choices: (string|ListChoiceOptions)[]): Promise; -/** - * Prompts the user to select an option from a filterable autocomplete list, with an option to - * choose no value. - */ -export async function promptAutocomplete( - message: string, choices: (string|ListChoiceOptions)[], - noChoiceText?: string): Promise; -export async function promptAutocomplete( - message: string, choices: (string|ListChoiceOptions)[], - noChoiceText?: string): Promise { - // Creates a local prompt module with an autocomplete prompt type. - const prompt = createPromptModule({}).registerPrompt('autocomplete', inquirerAutocomplete); - if (noChoiceText) { - choices = [noChoiceText, ...choices]; - } - // `prompt` must be cast as `any` as the autocomplete typings are not available. - const result = (await (prompt as any)({ - type: 'autocomplete', - name: 'result', - message, - source: (_: any, input: string) => { - if (!input) { - return Promise.resolve(choices); - } - return Promise.resolve(choices.filter(choice => { - if (typeof choice === 'string') { - return choice.includes(input); - } - return choice.name!.includes(input); - })); - } - })).result; - if (result === noChoiceText) { - return false; - } - return result; -} - /** Prompts the user for one line of input. */ export async function promptInput(message: string): Promise { return (await prompt<{result: string}>({type: 'input', name: 'result', message})).result; diff --git a/goldens/public-api/compiler-cli/error_code.d.ts b/goldens/public-api/compiler-cli/error_code.d.ts index ccfbd47e710e..9116012fe49e 100644 --- a/goldens/public-api/compiler-cli/error_code.d.ts +++ b/goldens/public-api/compiler-cli/error_code.d.ts @@ -38,5 +38,6 @@ export declare enum ErrorCode { INLINE_TCB_REQUIRED = 8900, INLINE_TYPE_CTOR_REQUIRED = 8901, INJECTABLE_DUPLICATE_PROV = 9001, - SUGGEST_STRICT_TEMPLATES = 10001 + SUGGEST_STRICT_TEMPLATES = 10001, + SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002 } diff --git a/goldens/public-api/router/router.d.ts b/goldens/public-api/router/router.d.ts index b1aada813d77..a8bd2ceadf34 100644 --- a/goldens/public-api/router/router.d.ts +++ b/goldens/public-api/router/router.d.ts @@ -3,7 +3,7 @@ export declare class ActivatedRoute { component: Type | string | null; data: Observable; get firstChild(): ActivatedRoute | null; - fragment: Observable; + fragment: Observable; outlet: string; get paramMap(): Observable; params: Observable; @@ -23,7 +23,7 @@ export declare class ActivatedRouteSnapshot { component: Type | string | null; data: Data; get firstChild(): ActivatedRouteSnapshot | null; - fragment: string; + fragment: string | null; outlet: string; get paramMap(): ParamMap; params: Params; diff --git a/integration/ngcc/test.sh b/integration/ngcc/test.sh index 76bfbf9e4bf5..3da1013682ac 100755 --- a/integration/ngcc/test.sh +++ b/integration/ngcc/test.sh @@ -97,7 +97,7 @@ assertSucceeded "Expected 'ngcc' to log 'Compiling'." grep "import [*] as ɵngcc0 from './src/r3_symbols';" node_modules/@angular/core/core.d.ts assertSucceeded "Expected 'ngcc' to add an import for 'src/r3_symbols' in '@angular/core' typings." - grep "static ɵinj: ɵngcc0.ɵɵInjectorDef;" node_modules/@angular/core/core.d.ts + grep "static ɵinj: ɵngcc0.ɵɵInjectorDeclaration;" node_modules/@angular/core/core.d.ts assertSucceeded "Expected 'ngcc' to add a definition for 'ApplicationModule.ɵinj' in '@angular/core' typings." diff --git a/package.json b/package.json index 405e2e536e56..da4544559e45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-srcs", - "version": "12.0.0-next.5", + "version": "12.0.0-next.6", "private": true, "description": "Angular - a web framework for modern web apps", "homepage": "https://github.com/angular/angular", @@ -48,6 +48,7 @@ "@babel/cli": "^7.8.4", "@babel/core": "^7.8.6", "@babel/generator": "^7.8.6", + "@babel/parser": "^7.0.0", "@babel/preset-env": "^7.10.2", "@babel/template": "^7.8.6", "@babel/traverse": "^7.8.6", @@ -61,7 +62,6 @@ "@microsoft/api-extractor": "7.7.11", "@octokit/rest": "16.28.7", "@octokit/types": "^5.0.1", - "tmp": "0.0.33", "@schematics/angular": "11.0.0-rc.1", "@types/angular": "^1.6.47", "@types/babel__core": "^7.1.6", @@ -73,14 +73,13 @@ "@types/chai": "^4.1.2", "@types/convert-source-map": "^1.5.1", "@types/diff": "^3.5.1", + "@types/events": "3.0.0", "@types/fs-extra": "4.0.2", "@types/hammerjs": "2.0.35", "@types/inquirer": "^7.3.0", "@types/jasmine": "3.5.10", "@types/jasmine-ajax": "^3.3.1", "@types/jasminewd2": "^2.0.8", - "@babel/parser": "^7.0.0", - "@types/events": "3.0.0", "@types/minimist": "^1.2.0", "@types/multimatch": "^4.0.0", "@types/node": "^12.11.1", @@ -151,6 +150,7 @@ "sourcemap-codec": "^1.4.8", "systemjs": "0.18.10", "terser": "^4.4.0", + "tmp": "0.0.33", "tsickle": "0.38.1", "tslib": "^2.1.0", "tslint": "6.1.3", @@ -167,6 +167,7 @@ "@bazel/ibazel": "^0.12.3", "@octokit/graphql": "^4.3.1", "@types/cli-progress": "^3.4.2", + "@types/conventional-commits-parser": "^3.0.1", "@types/minimist": "^1.2.0", "@yarnpkg/lockfile": "^1.1.0", "browserstacktunnel-wrapper": "^2.0.4", @@ -177,6 +178,7 @@ "cldrjs": "0.5.0", "cli-progress": "^3.7.0", "conventional-changelog": "^2.0.3", + "conventional-commits-parser": "^3.2.1", "entities": "1.1.1", "firebase-tools": "^7.11.0", "firefox-profile": "1.0.3", @@ -185,7 +187,6 @@ "gulp-conventional-changelog": "^2.0.35", "husky": "5.0.1", "inquirer": "^7.3.3", - "inquirer-autocomplete-prompt": "^1.0.2", "karma-browserstack-launcher": "^1.3.0", "karma-sauce-launcher": "^2.0.2", "madge": "^3.6.0", diff --git a/packages/bazel/index.bzl b/packages/bazel/index.bzl index 6f28d7db8785..3c43d9f1cc6d 100644 --- a/packages/bazel/index.bzl +++ b/packages/bazel/index.bzl @@ -12,5 +12,6 @@ load("//packages/bazel/src:ng_module.bzl", _ng_module = "ng_module_macro") ng_module = _ng_module ng_package = _ng_package + # DO NOT ADD PUBLIC API without including in the documentation generation # Run `yarn bazel build //packages/bazel/docs` to verify diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index 7c18c555dcc2..d8ad4635bdde 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -26,9 +26,19 @@ load( "tsc_wrapped_tsconfig", ) +# enable_perf_logging controls whether Ivy's performance tracing system will be enabled for any +# compilation which includes this provider. +NgPerfInfo = provider(fields = ["enable_perf_logging"]) + _FLAT_DTS_FILE_SUFFIX = ".bundle.d.ts" _R3_SYMBOLS_DTS_FILE = "src/r3_symbols.d.ts" +def is_perf_requested(ctx): + enable_perf_logging = ctx.attr.perf_flag != None and ctx.attr.perf_flag[NgPerfInfo].enable_perf_logging == True + if enable_perf_logging and not is_ivy_enabled(ctx): + fail("Angular View Engine does not support performance tracing") + return enable_perf_logging + def is_ivy_enabled(ctx): """Determine if the ivy compiler should be used to by the ng_module. @@ -278,6 +288,15 @@ def _expected_outs(ctx): else: i18n_messages_files = [] + dev_perf_files = [] + prod_perf_files = [] + + # In Ivy mode, dev and prod builds both produce a .json output containing performance metrics + # from the compiler for that build. + if is_perf_requested(ctx): + dev_perf_files = [ctx.actions.declare_file(ctx.label.name + "_perf_dev.json")] + prod_perf_files = [ctx.actions.declare_file(ctx.label.name + "_perf_prod.json")] + return struct( closure_js = closure_js_files, devmode_js = devmode_js_files, @@ -288,6 +307,8 @@ def _expected_outs(ctx): dts_bundles = dts_bundles, bundle_index_typings = bundle_index_typings, i18n_messages = i18n_messages_files, + dev_perf_files = dev_perf_files, + prod_perf_files = prod_perf_files, ) # Determines if we need to generate View Engine shims (.ngfactory and .ngsummary files) @@ -336,6 +357,15 @@ def _ngc_tsconfig(ctx, files, srcs, **kwargs): "_useManifestPathsAsModuleName": (not _is_bazel()), } + if is_perf_requested(ctx): + # In Ivy mode, set the `tracePerformance` Angular compiler option to enable performance + # metric output. + if "devmode_manifest" in kwargs: + perf_path = outs.dev_perf_files[0].path + else: + perf_path = outs.prod_perf_files[0].path + angular_compiler_options["tracePerformance"] = perf_path + if _should_produce_flat_module_outs(ctx): angular_compiler_options["flatModuleId"] = ctx.attr.module_name angular_compiler_options["flatModuleOutFile"] = _flat_module_out_file(ctx) @@ -519,6 +549,7 @@ def _compile_action( outputs, dts_bundles_out, messages_out, + perf_out, tsconfig_file, node_opts, compile_mode): @@ -563,12 +594,12 @@ def _compile_action( def _prodmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts): outs = _expected_outs(ctx) - return _compile_action(ctx, inputs, outputs + outs.closure_js, None, outs.i18n_messages, tsconfig_file, node_opts, "prodmode") + return _compile_action(ctx, inputs, outputs + outs.closure_js + outs.prod_perf_files, None, outs.i18n_messages, outs.prod_perf_files, tsconfig_file, node_opts, "prodmode") def _devmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts): outs = _expected_outs(ctx) - compile_action_outputs = outputs + outs.devmode_js + outs.declarations + outs.summaries + outs.metadata - _compile_action(ctx, inputs, compile_action_outputs, outs.dts_bundles, None, tsconfig_file, node_opts, "devmode") + compile_action_outputs = outputs + outs.devmode_js + outs.declarations + outs.summaries + outs.metadata + outs.dev_perf_files + _compile_action(ctx, inputs, compile_action_outputs, outs.dts_bundles, None, outs.dev_perf_files, tsconfig_file, node_opts, "devmode") def _ts_expected_outs(ctx, label, srcs_files = []): # rules_typescript expects a function with two or more arguments, but our @@ -711,6 +742,16 @@ NG_MODULE_ATTRIBUTES = { executable = True, cfg = "host", ), + # In the angular/angular monorepo, //tools:defaults.bzl wraps the ng_module rule in a macro + # which sets this attribute to the //packages/compiler-cli:ng_perf flag. + # This is done to avoid exposing the flag to user projects, which would require: + # * defining the flag within @angular/bazel and referencing it correctly here, and + # * committing to the flag and its semantics (including the format of perf JSON files) + # as something users can depend upon. + "perf_flag": attr.label( + providers = [NgPerfInfo], + doc = "Private API to control production of performance metric JSON files", + ), "_supports_workers": attr.bool(default = True), } diff --git a/packages/bazel/src/ng_perf.bzl b/packages/bazel/src/ng_perf.bzl new file mode 100644 index 000000000000..9fb0cc2343b0 --- /dev/null +++ b/packages/bazel/src/ng_perf.bzl @@ -0,0 +1,20 @@ +# Copyright Google LLC All Rights Reserved. +# +# Use of this source code is governed by an MIT-style license that can be +# found in the LICENSE file at https://angular.io/license + +load(":ng_module.bzl", "NgPerfInfo") + +def _ng_perf_flag_impl(ctx): + return NgPerfInfo(enable_perf_logging = ctx.build_setting_value) + +# `ng_perf_flag` is a special `build_setting` rule which ultimately enables a command-line boolean +# flag to control whether the `ng_module` rule produces performance tracing JSON files (in Ivy mode) +# as declared outputs. +# +# It does this via the `NgPerfInfo` provider and the `perf_flag` attriubute on `ng_module`. For more +# details, see: https://docs.bazel.build/versions/master/skylark/config.html +ng_perf_flag = rule( + implementation = _ng_perf_flag_impl, + build_setting = config.bool(flag = True), +) diff --git a/packages/bazel/src/ngc-wrapped/BUILD.bazel b/packages/bazel/src/ngc-wrapped/BUILD.bazel index 41b26525a603..198caa660462 100644 --- a/packages/bazel/src/ngc-wrapped/BUILD.bazel +++ b/packages/bazel/src/ngc-wrapped/BUILD.bazel @@ -16,6 +16,7 @@ ts_library( ], deps = [ "//packages/compiler-cli", + "//packages/compiler-cli/src/ngtsc/perf", "@npm//@bazel/typescript", "@npm//@types/node", "@npm//tsickle", diff --git a/packages/bazel/src/ngc-wrapped/index.ts b/packages/bazel/src/ngc-wrapped/index.ts index 44dd4b11000c..477a1a38d2bb 100644 --- a/packages/bazel/src/ngc-wrapped/index.ts +++ b/packages/bazel/src/ngc-wrapped/index.ts @@ -7,6 +7,7 @@ */ import * as ng from '@angular/compiler-cli'; +import {PerfPhase} from '@angular/compiler-cli/src/ngtsc/perf'; import {BazelOptions, CachedFileLoader, CompilerHost, constructManifest, debug, FileCache, FileLoader, parseTsconfig, resolveNormalizedPath, runAsWorker, runWorkerLoop, UncachedFileLoader} from '@bazel/typescript'; import * as fs from 'fs'; import * as path from 'path'; @@ -515,6 +516,12 @@ function gatherDiagnosticsForInputsOnly( options: ng.CompilerOptions, bazelOpts: BazelOptions, ngProgram: ng.Program): (ng.Diagnostic|ts.Diagnostic)[] { const tsProgram = ngProgram.getTsProgram(); + + // For the Ivy compiler, track the amount of time spent fetching TypeScript diagnostics. + let previousPhase = PerfPhase.Unaccounted; + if (ngProgram instanceof ng.NgtscProgram) { + previousPhase = ngProgram.compiler.perfRecorder.phase(PerfPhase.TypeScriptDiagnostics); + } const diagnostics: (ng.Diagnostic|ts.Diagnostic)[] = []; // These checks mirror ts.getPreEmitDiagnostics, with the important // exception of avoiding b/30708240, which is that if you call @@ -529,6 +536,11 @@ function gatherDiagnosticsForInputsOnly( diagnostics.push(...tsProgram.getSyntacticDiagnostics(sf)); diagnostics.push(...tsProgram.getSemanticDiagnostics(sf)); } + + if (ngProgram instanceof ng.NgtscProgram) { + ngProgram.compiler.perfRecorder.phase(previousPhase); + } + if (!diagnostics.length) { // only gather the angular diagnostics if we have no diagnostics // in any other files. diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index 5e57f02cd6dc..fe4758ee91fa 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -2,6 +2,10 @@ package(default_visibility = ["//visibility:public"]) load("//tools:defaults.bzl", "pkg_npm", "ts_api_guardian_test", "ts_config", "ts_library") +# Load ng_perf_flag explicitly from ng_perf.bzl as it's private API, and not exposed to other +# consumers of @angular/bazel. +load("//packages/bazel/src:ng_perf.bzl", "ng_perf_flag") + ts_config( name = "tsconfig", src = "tsconfig-build.json", @@ -88,3 +92,9 @@ ts_api_guardian_test( ], golden = "angular/goldens/public-api/compiler-cli/compiler_options.d.ts", ) + +# Controls whether the Ivy compiler produces performance traces as part of each build +ng_perf_flag( + name = "ng_perf", + build_setting_default = False, +) diff --git a/packages/compiler-cli/index.ts b/packages/compiler-cli/index.ts index e74cedd96b51..1247ebc2f4c5 100644 --- a/packages/compiler-cli/index.ts +++ b/packages/compiler-cli/index.ts @@ -22,5 +22,6 @@ export {CompilerOptions as AngularCompilerOptions} from './src/transformers/api' export {ngToTsDiagnostic} from './src/transformers/util'; export {NgTscPlugin} from './src/ngtsc/tsc_plugin'; +export {NgtscProgram} from './src/ngtsc/program'; setFileSystem(new NodeJSFileSystem()); diff --git a/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts b/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts index b2fb42c1135b..54f2b08dc4ac 100644 --- a/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts +++ b/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ import {ConstantPool} from '@angular/compiler'; +import {NOOP_PERF_RECORDER} from '@angular/compiler-cli/src/ngtsc/perf'; import * as ts from 'typescript'; import {ParsedConfiguration} from '../../..'; @@ -89,7 +90,7 @@ export class DecorationAnalyzer { fullRegistry = new CompoundMetadataRegistry([this.metaRegistry, this.scopeRegistry]); evaluator = new PartialEvaluator(this.reflectionHost, this.typeChecker, /* dependencyTracker */ null); - importGraph = new ImportGraph(this.typeChecker); + importGraph = new ImportGraph(this.typeChecker, NOOP_PERF_RECORDER); cycleAnalyzer = new CycleAnalyzer(this.importGraph); injectableRegistry = new InjectableClassRegistry(this.reflectionHost); typeCheckScopeRegistry = new TypeCheckScopeRegistry(this.scopeRegistry, this.fullMetaReader); @@ -104,7 +105,8 @@ export class DecorationAnalyzer { /* i18nNormalizeLineEndingsInICUs */ false, this.moduleResolver, this.cycleAnalyzer, CycleHandlingStrategy.UseRemoteScoping, this.refEmitter, NOOP_DEFAULT_IMPORT_RECORDER, NOOP_DEPENDENCY_TRACKER, this.injectableRegistry, - /* semanticDepGraphUpdater */ null, !!this.compilerOptions.annotateForClosureCompiler), + /* semanticDepGraphUpdater */ null, !!this.compilerOptions.annotateForClosureCompiler, + NOOP_PERF_RECORDER), // See the note in ngtsc about why this cast is needed. // clang-format off @@ -117,23 +119,26 @@ export class DecorationAnalyzer { // version 10, undecorated classes that use Angular features are no longer handled // in ngtsc, but we want to ensure compatibility in ngcc for outdated libraries that // have not migrated to explicit decorators. See: https://hackmd.io/@alx/ryfYYuvzH. - /* compileUndecoratedClassesWithAngularFeatures */ true + /* compileUndecoratedClassesWithAngularFeatures */ true, + NOOP_PERF_RECORDER ) as DecoratorHandler, // clang-format on // Pipe handler must be before injectable handler in list so pipe factories are printed // before injectable factories (so injectable factories can delegate to them) new PipeDecoratorHandler( this.reflectionHost, this.evaluator, this.metaRegistry, this.scopeRegistry, - NOOP_DEFAULT_IMPORT_RECORDER, this.injectableRegistry, this.isCore), + NOOP_DEFAULT_IMPORT_RECORDER, this.injectableRegistry, this.isCore, NOOP_PERF_RECORDER), new InjectableDecoratorHandler( this.reflectionHost, NOOP_DEFAULT_IMPORT_RECORDER, this.isCore, - /* strictCtorDeps */ false, this.injectableRegistry, /* errorOnDuplicateProv */ false), + /* strictCtorDeps */ false, this.injectableRegistry, NOOP_PERF_RECORDER, + /* errorOnDuplicateProv */ false), new NgModuleDecoratorHandler( this.reflectionHost, this.evaluator, this.fullMetaReader, this.fullRegistry, this.scopeRegistry, this.referencesRegistry, this.isCore, /* routeAnalyzer */ null, this.refEmitter, /* factoryTracker */ null, NOOP_DEFAULT_IMPORT_RECORDER, - !!this.compilerOptions.annotateForClosureCompiler, this.injectableRegistry), + !!this.compilerOptions.annotateForClosureCompiler, this.injectableRegistry, + NOOP_PERF_RECORDER), ]; compiler = new NgccTraitCompiler(this.handlers, this.reflectionHost); migrations: Migration[] = [ diff --git a/packages/compiler-cli/ngcc/src/host/esm5_host.ts b/packages/compiler-cli/ngcc/src/host/esm5_host.ts index 5af9c9f12391..9cd7c758a8eb 100644 --- a/packages/compiler-cli/ngcc/src/host/esm5_host.ts +++ b/packages/compiler-cli/ngcc/src/host/esm5_host.ts @@ -382,6 +382,12 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * return _super.apply(this, tslib.__spread(arguments)) || this; * ``` * + * or, since TypeScript 4.2 it would be + * + * ``` + * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + * ``` + * * Such constructs can be still considered as synthetic delegate constructors as they are * the product of a common TypeScript to ES5 synthetic constructor, just being downleveled * to ES5 using `tsc`. See: https://github.com/angular/angular/issues/38453. @@ -413,7 +419,10 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * ``` * var _this = _super.apply(this, tslib.__spread(arguments)) || this; * ``` - * + * or using the syntax emitted since TypeScript 4.2: + * ``` + * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + * ``` * * @param statement a statement that may be a synthesized super call * @returns true if the statement looks like a synthesized super call @@ -447,6 +456,10 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * ``` * return _super.apply(this, tslib.__spread(arguments)) || this; * ``` + * or using the syntax emitted since TypeScript 4.2: + * ``` + * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + * ``` * * @param statement a statement that may be a synthesized super call * @returns true if the statement looks like a synthesized super call @@ -473,6 +486,10 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * ``` * _super.apply(this, tslib.__spread(arguments)) || this; * ``` + * or using the syntax emitted since TypeScript 4.2: + * ``` + * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + * ``` * * @param expression an expression that may represent a default super call * @returns true if the expression corresponds with the above form @@ -500,7 +517,8 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * This structure is generated by TypeScript when transforming ES2015 to ES5, see * https://github.com/Microsoft/TypeScript/blob/v3.2.2/src/compiler/transformers/es2015.ts#L1148-L1163 * - * Additionally, we also handle cases where `arguments` are wrapped by a TypeScript spread helper. + * Additionally, we also handle cases where `arguments` are wrapped by a TypeScript spread + * helper. * This can happen if ES2015 class output contain auto-generated constructors due to class * members. The ES2015 output will be using `super(...arguments)` to delegate to the superclass, * but once downleveled to ES5, the spread operator will be persisted through a TypeScript spread @@ -510,6 +528,12 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { * _super.apply(this, __spread(arguments)) || this; * ``` * + * or, since TypeScript 4.2 it would be + * + * ``` + * _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + * ``` + * * More details can be found in: https://github.com/angular/angular/issues/38453. * * @param expression an expression that may represent a default super call @@ -538,32 +562,79 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost { // The other scenario we intend to detect: The `arguments` variable might be wrapped with the // TypeScript spread helper (either through tslib or inlined). This can happen if an explicit // delegate constructor uses `super(...arguments)` in ES2015 and is downleveled to ES5 using - // `--downlevelIteration`. The output in such cases would not directly pass the function - // `arguments` to the `super` call, but wrap it in a TS spread helper. The output would match - // the following pattern: `super.apply(this, tslib.__spread(arguments))`. We check for such - // constructs below, but perform the detection of the call expression definition as last as - // that is the most expensive operation here. - if (!ts.isCallExpression(argumentsExpr) || argumentsExpr.arguments.length !== 1 || - !isArgumentsIdentifier(argumentsExpr.arguments[0])) { + // `--downlevelIteration`. + return this.isSpreadArgumentsExpression(argumentsExpr); + } + + /** + * Determines if the provided expression is one of the following call expressions: + * + * 1. `__spread(arguments)` + * 2. `__spreadArray([], __read(arguments))` + * + * The tslib helpers may have been emitted inline as in the above example, or they may be read + * from a namespace import. + */ + private isSpreadArgumentsExpression(expression: ts.Expression): boolean { + const call = this.extractKnownHelperCall(expression); + if (call === null) { return false; } - const argumentsCallExpr = argumentsExpr.expression; - let argumentsCallDeclaration: Declaration|null = null; - - // The `__spread` helper could be globally available, or accessed through a namespaced - // import. Hence we support a property access here as long as it resolves to the actual - // known TypeScript spread helper. - if (ts.isIdentifier(argumentsCallExpr)) { - argumentsCallDeclaration = this.getDeclarationOfIdentifier(argumentsCallExpr); - } else if ( - ts.isPropertyAccessExpression(argumentsCallExpr) && - ts.isIdentifier(argumentsCallExpr.name)) { - argumentsCallDeclaration = this.getDeclarationOfIdentifier(argumentsCallExpr.name); + if (call.helper === KnownDeclaration.TsHelperSpread) { + // `__spread(arguments)` + return call.args.length === 1 && isArgumentsIdentifier(call.args[0]); + } else if (call.helper === KnownDeclaration.TsHelperSpreadArray) { + // `__spreadArray([], __read(arguments))` + if (call.args.length !== 2) { + return false; + } + + const firstArg = call.args[0]; + if (!ts.isArrayLiteralExpression(firstArg) || firstArg.elements.length !== 0) { + return false; + } + + const secondArg = this.extractKnownHelperCall(call.args[1]); + if (secondArg === null || secondArg.helper !== KnownDeclaration.TsHelperRead) { + return false; + } + + return secondArg.args.length === 1 && isArgumentsIdentifier(secondArg.args[0]); + } else { + return false; + } + } + + /** + * Inspects the provided expression and determines if it corresponds with a known helper function + * as receiver expression. + */ + private extractKnownHelperCall(expression: ts.Expression): + {helper: KnownDeclaration, args: ts.NodeArray}|null { + if (!ts.isCallExpression(expression)) { + return null; + } + + const receiverExpr = expression.expression; + + // The helper could be globally available, or accessed through a namespaced import. Hence we + // support a property access here as long as it resolves to the actual known TypeScript helper. + let receiver: Declaration|null = null; + if (ts.isIdentifier(receiverExpr)) { + receiver = this.getDeclarationOfIdentifier(receiverExpr); + } else if (ts.isPropertyAccessExpression(receiverExpr) && ts.isIdentifier(receiverExpr.name)) { + receiver = this.getDeclarationOfIdentifier(receiverExpr.name); + } + + if (receiver === null || receiver.known === null) { + return null; } - return argumentsCallDeclaration !== null && - argumentsCallDeclaration.known === KnownDeclaration.TsHelperSpread; + return { + helper: receiver.known, + args: expression.arguments, + }; } } diff --git a/packages/compiler-cli/ngcc/test/host/commonjs_host_spec.ts b/packages/compiler-cli/ngcc/test/host/commonjs_host_spec.ts index 419fcf76d2b0..3143a8b15d5c 100644 --- a/packages/compiler-cli/ngcc/test/host/commonjs_host_spec.ts +++ b/packages/compiler-cli/ngcc/test/host/commonjs_host_spec.ts @@ -1530,11 +1530,15 @@ exports.MissingClass2 = MissingClass2; break; case 'inlined': fileHeader = - `var __spread = (this && this.__spread) || function (...args) { /* ... */ }`; + `var __spread = (this && this.__spread) || function (...args) { /* ... */ };\n` + + `var __spreadArray = (this && this.__spreadArray) || function (...args) { /* ... */ };\n` + + `var __read = (this && this.__read) || function (...args) { /* ... */ };\n`; break; case 'inlined_with_suffix': fileHeader = - `var __spread$1 = (this && this.__spread$1) || function (...args) { /* ... */ }`; + `var __spread$1 = (this && this.__spread$1) || function (...args) { /* ... */ };\n` + + `var __spreadArray$1 = (this && this.__spreadArray$1) || function (...args) { /* ... */ };\n` + + `var __read$2 = (this && this.__read$2) || function (...args) { /* ... */ };\n`; break; } const file = { @@ -1635,6 +1639,17 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray([], __read(arguments))) || this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1646,6 +1661,17 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1657,6 +1683,17 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); + describe('with class member assignment', () => { it('recognizes delegate super call using inline spread helper', () => { const parameters = getConstructorParameters( @@ -1671,6 +1708,19 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1684,6 +1734,19 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1696,6 +1759,19 @@ exports.MissingClass2 = MissingClass2; expect(parameters).toBeNull(); }); + + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); }); it('handles the case where a unique name was generated for _super or _this', () => { diff --git a/packages/compiler-cli/ngcc/test/host/esm5_host_spec.ts b/packages/compiler-cli/ngcc/test/host/esm5_host_spec.ts index 4595d7db56da..b6521969bf68 100644 --- a/packages/compiler-cli/ngcc/test/host/esm5_host_spec.ts +++ b/packages/compiler-cli/ngcc/test/host/esm5_host_spec.ts @@ -1485,18 +1485,22 @@ runInEachFileSystem(() => { switch (mode) { case 'imported': - fileHeader = `import {__spread} from 'tslib';`; + fileHeader = `import {__spread, __spreadArray, __read} from 'tslib';`; break; case 'imported_namespace': fileHeader = `import * as tslib from 'tslib';`; break; case 'inlined': fileHeader = - `var __spread = (this && this.__spread) || function (...args) { /* ... */ }`; + `var __spread = (this && this.__spread) || function (...args) { /* ... */ };\n` + + `var __spreadArray = (this && this.__spreadArray) || function (...args) { /* ... */ };\n` + + `var __read = (this && this.__read) || function (...args) { /* ... */ };\n`; break; case 'inlined_with_suffix': fileHeader = - `var __spread$1 = (this && this.__spread$1) || function (...args) { /* ... */ }`; + `var __spread$1 = (this && this.__spread$1) || function (...args) { /* ... */ };\n` + + `var __spreadArray$1 = (this && this.__spreadArray$1) || function (...args) { /* ... */ };\n` + + `var __read$2 = (this && this.__read$2) || function (...args) { /* ... */ };\n`; break; } @@ -1595,6 +1599,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray([], __read(arguments))) || this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1606,6 +1621,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1617,6 +1643,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray([], __read(arguments))) || this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using namespace imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1628,6 +1665,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using namespace imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + }`, + 'imported_namespace'); + + expect(parameters).toBeNull(); + }); + describe('with class member assignment', () => { it('recognizes delegate super call using inline spread helper', () => { const parameters = getConstructorParameters( @@ -1642,6 +1690,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1655,6 +1716,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1668,6 +1742,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using namespace imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1680,6 +1767,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + + it('recognizes delegate super call using namespace imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'imported_namespace'); + + expect(parameters).toBeNull(); + }); }); it('handles the case where a unique name was generated for _super or _this', () => { diff --git a/packages/compiler-cli/ngcc/test/host/umd_host_spec.ts b/packages/compiler-cli/ngcc/test/host/umd_host_spec.ts index 359219cbdfd5..b7114b3bc063 100644 --- a/packages/compiler-cli/ngcc/test/host/umd_host_spec.ts +++ b/packages/compiler-cli/ngcc/test/host/umd_host_spec.ts @@ -1784,6 +1784,8 @@ runInEachFileSystem(() => { }(this, (function (exports) { 'use strict'; var __spread = (this && this.__spread) || function (...args) { /* ... */ } + var __spreadArray = (this && this.__spreadArray) || function (...args) { /* ... */ } + var __read = (this && this.__read) || function (...args) { /* ... */ } `; break; case 'inlined_with_suffix': @@ -1795,6 +1797,8 @@ runInEachFileSystem(() => { }(this, (function (exports) { 'use strict'; var __spread$1 = (this && this.__spread$1) || function (...args) { /* ... */ } + var __spreadArray$1 = (this && this.__spreadArray$1) || function (...args) { /* ... */ } + var __read$2 = (this && this.__read$2) || function (...args) { /* ... */ } `; break; } @@ -1897,6 +1901,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray([], __read(arguments))) || this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1908,6 +1923,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1919,6 +1945,17 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + return _super.apply(this, tslib_1.__spreadArray([], tslib.__read(arguments))) || this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); + describe('with class member assignment', () => { it('recognizes delegate super call using inline spread helper', () => { const parameters = getConstructorParameters( @@ -1933,6 +1970,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using inline spread helper with suffix', () => { const parameters = getConstructorParameters( ` @@ -1946,6 +1996,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + it('recognizes delegate super call using inline spreadArray helper with suffix', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, __spreadArray$1([], __read$2(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'inlined_with_suffix'); + + expect(parameters).toBeNull(); + }); + it('recognizes delegate super call using imported spread helper', () => { const parameters = getConstructorParameters( ` @@ -1958,6 +2021,19 @@ runInEachFileSystem(() => { expect(parameters).toBeNull(); }); + + it('recognizes delegate super call using imported spreadArray helper', () => { + const parameters = getConstructorParameters( + ` + function TestClass() { + var _this = _super.apply(this, tslib_1.__spreadArray([], tslib.__read(arguments))) || this; + _this.synthesizedProperty = null; + return _this; + }`, + 'imported'); + + expect(parameters).toBeNull(); + }); }); it('handles the case where a unique name was generated for _super or _this', () => { diff --git a/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts b/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts index 1cab9d890203..be13353b9d90 100644 --- a/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts +++ b/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts @@ -348,6 +348,84 @@ runInEachFileSystem(() => { }); }); + it(`should be able to detect synthesized constructors in ES5 with downlevelIteration enabled (imported helpers)`, + () => { + setupAngularCoreEsm5(); + compileIntoApf( + 'test-package', { + '/index.ts': ` + import {Injectable} from '@angular/core'; + + @Injectable() + export class Base {} + + @Injectable() + export class SubClass extends Base { + constructor() { + // Note: mimic the situation where TS is first emitted into ES2015, resulting + // in the spread super call below, and then downleveled into ES5 using the + // "downlevelIteration" option. + super(...arguments); + this.foo = 'bar'; + } + } + `, + }, + {importHelpers: true, noEmitHelpers: true, downlevelIteration: true}); + + mainNgcc({ + basePath: '/node_modules', + targetEntryPointPath: 'test-package', + propertiesToConsider: ['esm5'], + }); + + const jsContents = fs.readFile(_(`/node_modules/test-package/esm5/src/index.js`)); + // Verify that the ES5 bundle does contain the expected downleveling syntax. + expect(jsContents).toContain('__spreadArray([], __read(arguments))'); + expect(jsContents) + .toContain( + 'var ɵSubClass_BaseFactory = /*@__PURE__*/ ɵngcc0.ɵɵgetInheritedFactory(SubClass);'); + }); + + it(`should be able to detect synthesized constructors in ES5 with downlevelIteration enabled (emitted helpers)`, + () => { + setupAngularCoreEsm5(); + compileIntoApf( + 'test-package', { + '/index.ts': ` + import {Injectable} from '@angular/core'; + + @Injectable() + export class Base {} + + @Injectable() + export class SubClass extends Base { + constructor() { + // Note: mimic the situation where TS is first emitted into ES2015, resulting + // in the spread super call below, and then downleveled into ES5 using the + // "downlevelIteration" option. + super(...arguments); + this.foo = 'bar'; + } + } + `, + }, + {importHelpers: false, noEmitHelpers: false, downlevelIteration: true}); + + mainNgcc({ + basePath: '/node_modules', + targetEntryPointPath: 'test-package', + propertiesToConsider: ['esm5'], + }); + + const jsContents = fs.readFile(_(`/node_modules/test-package/esm5/src/index.js`)); + // Verify that the ES5 bundle does contain the expected downleveling syntax. + expect(jsContents).toContain('__spreadArray([], __read(arguments))'); + expect(jsContents) + .toContain( + 'var ɵSubClass_BaseFactory = /*@__PURE__*/ ɵngcc0.ɵɵgetInheritedFactory(SubClass);'); + }); + it('should not add `const` in ES5 generated code', () => { setupAngularCoreEsm5(); compileIntoFlatEs5Package('test-package', { @@ -774,7 +852,8 @@ runInEachFileSystem(() => { expect(dtsContents) .toContain(`export declare class ${exportedName} extends PlatformLocation`); // And that ngcc's modifications to that class use the correct (exported) name - expect(dtsContents).toContain(`static ɵfac: ɵngcc0.ɵɵFactoryDef<${exportedName}, never>`); + expect(dtsContents) + .toContain(`static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<${exportedName}, never>`); }); it('should include constructor metadata in factory definitions', () => { @@ -787,7 +866,7 @@ runInEachFileSystem(() => { const dtsContents = fs.readFile(_('/node_modules/@angular/common/common.d.ts')); expect(dtsContents) .toContain( - `static ɵfac: ɵngcc0.ɵɵFactoryDef`); + `static ɵfac: ɵngcc0.ɵɵFactoryDeclaration`); }); it('should add generic type for ModuleWithProviders and generate exports for private modules', @@ -2193,7 +2272,7 @@ runInEachFileSystem(() => { const dtsContents = fs.readFile(_(`/node_modules/test-package/index.d.ts`)); expect(dtsContents) .toContain( - 'static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta;'); + 'static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration;'); }); it('should generate a component definition with CopyDefinitionFeature for an undecorated child component', @@ -2233,7 +2312,7 @@ runInEachFileSystem(() => { const dtsContents = fs.readFile(_(`/node_modules/test-package/index.d.ts`)); expect(dtsContents) .toContain( - 'static ɵcmp: ɵngcc0.ɵɵComponentDefWithMeta;'); + 'static ɵcmp: ɵngcc0.ɵɵComponentDeclaration;'); }); it('should generate directive definitions with CopyDefinitionFeature for undecorated child directives in a long inheritance chain', @@ -2269,13 +2348,13 @@ runInEachFileSystem(() => { const dtsContents = fs.readFile(_(`/node_modules/test-package/index.d.ts`)); expect(dtsContents) .toContain( - 'static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta;'); + 'static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration;'); expect(dtsContents) .toContain( - 'static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta;'); + 'static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration;'); expect(dtsContents) .toContain( - 'static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta;'); + 'static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration;'); }); }); diff --git a/packages/compiler-cli/ngcc/test/rendering/dts_renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/dts_renderer_spec.ts index 1577026df64e..44e4160faaf9 100644 --- a/packages/compiler-cli/ngcc/test/rendering/dts_renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/dts_renderer_spec.ts @@ -141,7 +141,7 @@ runInEachFileSystem(() => { result.find(f => f.path === _('/node_modules/test-package/typings/file.d.ts'))!; expect(typingsFile.contents) .toContain( - 'foo(x: number): number;\n static ɵfac: ɵngcc0.ɵɵFactoryDef;\n static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta'); + 'foo(x: number): number;\n static ɵfac: ɵngcc0.ɵɵFactoryDeclaration;\n static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration'); }); it('should render imports into typings files', () => { diff --git a/packages/compiler-cli/src/ngtsc/annotations/BUILD.bazel b/packages/compiler-cli/src/ngtsc/annotations/BUILD.bazel index 002755aad5f7..b10a14584e93 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/annotations/BUILD.bazel @@ -18,6 +18,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/indexer", "//packages/compiler-cli/src/ngtsc/metadata", "//packages/compiler-cli/src/ngtsc/partial_evaluator", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/routing", "//packages/compiler-cli/src/ngtsc/scope", diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts index de37e283d28b..597d70d3d0c4 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts @@ -18,6 +18,7 @@ import {extractSemanticTypeParameters, isArrayEqual, isReferenceEqual, SemanticD import {IndexingContext} from '../../indexer'; import {ClassPropertyMapping, ComponentResources, DirectiveMeta, DirectiveTypeCheckMeta, extractDirectiveTypeCheckMeta, InjectableClassRegistry, MetadataReader, MetadataRegistry, Resource, ResourceRegistry} from '../../metadata'; import {EnumValue, PartialEvaluator, ResolvedValue} from '../../partial_evaluator'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, DeclarationNode, Decorator, ReflectionHost, reflectObjectLiteral} from '../../reflection'; import {ComponentScopeReader, LocalModuleScopeRegistry, TypeCheckScopeRegistry} from '../../scope'; import {AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerFlags, HandlerPrecedence, ResolveResult} from '../../transform'; @@ -208,7 +209,7 @@ export class ComponentDecoratorHandler implements private depTracker: DependencyTracker|null, private injectableRegistry: InjectableClassRegistry, private semanticDepGraphUpdater: SemanticDepGraphUpdater|null, - private annotateForClosureCompiler: boolean) {} + private annotateForClosureCompiler: boolean, private perf: PerfRecorder) {} private literalCache = new Map(); private elementSchemaRegistry = new DomElementSchemaRegistry(); @@ -309,6 +310,7 @@ export class ComponentDecoratorHandler implements analyze( node: ClassDeclaration, decorator: Readonly, flags: HandlerFlags = HandlerFlags.NONE): AnalysisOutput { + this.perf.eventCount(PerfEvent.AnalyzeComponent); const containingFile = node.getSourceFile().fileName; this.literalCache.delete(decorator); diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts b/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts index fd03d1b92ee5..86cc55d0d3d4 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts @@ -16,6 +16,7 @@ import {areTypeParametersEqual, extractSemanticTypeParameters, isArrayEqual, isS import {BindingPropertyName, ClassPropertyMapping, ClassPropertyName, DirectiveTypeCheckMeta, InjectableClassRegistry, MetadataReader, MetadataRegistry, TemplateGuardMeta} from '../../metadata'; import {extractDirectiveTypeCheckMeta} from '../../metadata/src/util'; import {DynamicValue, EnumValue, PartialEvaluator} from '../../partial_evaluator'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, ClassMember, ClassMemberKind, Decorator, filterToMembersWithDecorator, ReflectionHost, reflectObjectLiteral} from '../../reflection'; import {LocalModuleScopeRegistry} from '../../scope'; import {AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerFlags, HandlerPrecedence, ResolveResult} from '../../transform'; @@ -180,7 +181,7 @@ export class DirectiveDecoratorHandler implements private injectableRegistry: InjectableClassRegistry, private isCore: boolean, private semanticDepGraphUpdater: SemanticDepGraphUpdater|null, private annotateForClosureCompiler: boolean, - private compileUndecoratedClassesWithAngularFeatures: boolean) {} + private compileUndecoratedClassesWithAngularFeatures: boolean, private perf: PerfRecorder) {} readonly precedence = HandlerPrecedence.PRIMARY; readonly name = DirectiveDecoratorHandler.name; @@ -211,6 +212,8 @@ export class DirectiveDecoratorHandler implements return {diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)]}; } + this.perf.eventCount(PerfEvent.AnalyzeDirective); + const directiveResult = extractDirectiveMetadata( node, decorator, this.reflector, this.evaluator, this.defaultImportRecorder, this.isCore, flags, this.annotateForClosureCompiler); diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts b/packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts index 4e689a696117..0f420934e069 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts @@ -12,6 +12,7 @@ import * as ts from 'typescript'; import {ErrorCode, FatalDiagnosticError} from '../../diagnostics'; import {DefaultImportRecorder} from '../../imports'; import {InjectableClassRegistry} from '../../metadata'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, Decorator, ReflectionHost, reflectObjectLiteral} from '../../reflection'; import {AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence} from '../../transform'; @@ -34,7 +35,7 @@ export class InjectableDecoratorHandler implements constructor( private reflector: ReflectionHost, private defaultImportRecorder: DefaultImportRecorder, private isCore: boolean, private strictCtorDeps: boolean, - private injectableRegistry: InjectableClassRegistry, + private injectableRegistry: InjectableClassRegistry, private perf: PerfRecorder, /** * What to do if the injectable already contains a ɵprov property. * @@ -64,6 +65,8 @@ export class InjectableDecoratorHandler implements analyze(node: ClassDeclaration, decorator: Readonly): AnalysisOutput { + this.perf.eventCount(PerfEvent.AnalyzeInjectable); + const meta = extractInjectableMetadata(node, decorator, this.reflector); const decorators = this.reflector.getDecoratorsOfDeclaration(node); diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts index 52aac200bb9c..ac8f3562cc94 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts @@ -14,6 +14,7 @@ import {DefaultImportRecorder, Reference, ReferenceEmitter} from '../../imports' import {isArrayEqual, isReferenceEqual, isSymbolEqual, SemanticReference, SemanticSymbol} from '../../incremental/semantic_graph'; import {InjectableClassRegistry, MetadataReader, MetadataRegistry} from '../../metadata'; import {PartialEvaluator, ResolvedValue} from '../../partial_evaluator'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, Decorator, isNamedClassDeclaration, ReflectionHost, reflectObjectLiteral, typeNodeToValueExpr} from '../../reflection'; import {NgModuleRouteAnalyzer} from '../../routing'; import {LocalModuleScopeRegistry, ScopeData} from '../../scope'; @@ -131,7 +132,8 @@ export class NgModuleDecoratorHandler implements private factoryTracker: FactoryTracker|null, private defaultImportRecorder: DefaultImportRecorder, private annotateForClosureCompiler: boolean, - private injectableRegistry: InjectableClassRegistry, private localeId?: string) {} + private injectableRegistry: InjectableClassRegistry, private perf: PerfRecorder, + private localeId?: string) {} readonly precedence = HandlerPrecedence.PRIMARY; readonly name = NgModuleDecoratorHandler.name; @@ -154,6 +156,8 @@ export class NgModuleDecoratorHandler implements analyze(node: ClassDeclaration, decorator: Readonly): AnalysisOutput { + this.perf.eventCount(PerfEvent.AnalyzeNgModule); + const name = node.name.text; if (decorator.args === null || decorator.args.length > 1) { throw new FatalDiagnosticError( diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/pipe.ts b/packages/compiler-cli/src/ngtsc/annotations/src/pipe.ts index a19b5bae5906..102aa1bd4748 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/pipe.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/pipe.ts @@ -14,6 +14,7 @@ import {DefaultImportRecorder, Reference} from '../../imports'; import {SemanticSymbol} from '../../incremental/semantic_graph'; import {InjectableClassRegistry, MetadataRegistry} from '../../metadata'; import {PartialEvaluator} from '../../partial_evaluator'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, Decorator, ReflectionHost, reflectObjectLiteral} from '../../reflection'; import {LocalModuleScopeRegistry} from '../../scope'; import {AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult} from '../../transform'; @@ -55,7 +56,8 @@ export class PipeDecoratorHandler implements private reflector: ReflectionHost, private evaluator: PartialEvaluator, private metaRegistry: MetadataRegistry, private scopeRegistry: LocalModuleScopeRegistry, private defaultImportRecorder: DefaultImportRecorder, - private injectableRegistry: InjectableClassRegistry, private isCore: boolean) {} + private injectableRegistry: InjectableClassRegistry, private isCore: boolean, + private perf: PerfRecorder) {} readonly precedence = HandlerPrecedence.PRIMARY; readonly name = PipeDecoratorHandler.name; @@ -78,6 +80,8 @@ export class PipeDecoratorHandler implements analyze(clazz: ClassDeclaration, decorator: Readonly): AnalysisOutput { + this.perf.eventCount(PerfEvent.AnalyzePipe); + const name = clazz.name.text; const type = wrapTypeReference(this.reflector, clazz); const internalType = new WrappedNodeExpr(this.reflector.getInternalNameOfClass(clazz)); diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/BUILD.bazel b/packages/compiler-cli/src/ngtsc/annotations/test/BUILD.bazel index ba62f6e73c3d..88a4280c2e73 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/annotations/test/BUILD.bazel @@ -20,6 +20,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/incremental:api", "//packages/compiler-cli/src/ngtsc/metadata", "//packages/compiler-cli/src/ngtsc/partial_evaluator", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/scope", "//packages/compiler-cli/src/ngtsc/testing", diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/component_spec.ts b/packages/compiler-cli/src/ngtsc/annotations/test/component_spec.ts index da3f93532d65..ccd010802a29 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/component_spec.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/test/component_spec.ts @@ -16,6 +16,7 @@ import {runInEachFileSystem} from '../../file_system/testing'; import {ModuleResolver, NOOP_DEFAULT_IMPORT_RECORDER, ReferenceEmitter} from '../../imports'; import {CompoundMetadataReader, DtsMetadataReader, InjectableClassRegistry, LocalMetadataRegistry, ResourceRegistry} from '../../metadata'; import {PartialEvaluator} from '../../partial_evaluator'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {LocalModuleScopeRegistry, MetadataDtsModuleScopeResolver, TypeCheckScopeRegistry} from '../../scope'; import {getDeclaration, makeProgram} from '../../testing'; @@ -41,7 +42,7 @@ function setup(program: ts.Program, options: ts.CompilerOptions, host: ts.Compil const evaluator = new PartialEvaluator(reflectionHost, checker, /* dependencyTracker */ null); const moduleResolver = new ModuleResolver(program, options, host, /* moduleResolutionCache */ null); - const importGraph = new ImportGraph(checker); + const importGraph = new ImportGraph(checker, NOOP_PERF_RECORDER); const cycleAnalyzer = new CycleAnalyzer(importGraph); const metaRegistry = new LocalMetadataRegistry(); const dtsReader = new DtsMetadataReader(checker, reflectionHost); @@ -80,6 +81,7 @@ function setup(program: ts.Program, options: ts.CompilerOptions, host: ts.Compil injectableRegistry, /* semanticDepGraphUpdater */ null, /* annotateForClosureCompiler */ false, + NOOP_PERF_RECORDER, ); return {reflectionHost, handler}; } diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts b/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts index 294174542ff6..898a0a28eb3f 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/test/directive_spec.ts @@ -13,6 +13,7 @@ import {runInEachFileSystem} from '../../file_system/testing'; import {NOOP_DEFAULT_IMPORT_RECORDER, ReferenceEmitter} from '../../imports'; import {DtsMetadataReader, InjectableClassRegistry, LocalMetadataRegistry} from '../../metadata'; import {PartialEvaluator} from '../../partial_evaluator'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {ClassDeclaration, isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {LocalModuleScopeRegistry, MetadataDtsModuleScopeResolver} from '../../scope'; import {getDeclaration, makeProgram} from '../../testing'; @@ -171,7 +172,7 @@ runInEachFileSystem(() => { NOOP_DEFAULT_IMPORT_RECORDER, injectableRegistry, /*isCore*/ false, /*semanticDepGraphUpdater*/ null, /*annotateForClosureCompiler*/ false, - /*detectUndecoratedClassesWithAngularFeatures*/ false); + /*detectUndecoratedClassesWithAngularFeatures*/ false, NOOP_PERF_RECORDER); const DirNode = getDeclaration(program, _('/entry.ts'), dirName, isNamedClassDeclaration); diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/injectable_spec.ts b/packages/compiler-cli/src/ngtsc/annotations/test/injectable_spec.ts index eab3b82aa6bd..293fd2553348 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/injectable_spec.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/test/injectable_spec.ts @@ -10,6 +10,7 @@ import {absoluteFrom} from '../../file_system'; import {runInEachFileSystem} from '../../file_system/testing'; import {NOOP_DEFAULT_IMPORT_RECORDER} from '../../imports'; import {InjectableClassRegistry} from '../../metadata'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {getDeclaration, makeProgram} from '../../testing'; import {InjectableDecoratorHandler} from '../src/injectable'; @@ -70,7 +71,7 @@ function setupHandler(errorOnDuplicateProv: boolean) { const injectableRegistry = new InjectableClassRegistry(reflectionHost); const handler = new InjectableDecoratorHandler( reflectionHost, NOOP_DEFAULT_IMPORT_RECORDER, /* isCore */ false, - /* strictCtorDeps */ false, injectableRegistry, errorOnDuplicateProv); + /* strictCtorDeps */ false, injectableRegistry, NOOP_PERF_RECORDER, errorOnDuplicateProv); const TestClass = getDeclaration(program, ENTRY_FILE, 'TestClass', isNamedClassDeclaration); const ɵprov = reflectionHost.getMembersOfClass(TestClass).find(member => member.name === 'ɵprov'); if (ɵprov === undefined) { diff --git a/packages/compiler-cli/src/ngtsc/annotations/test/ng_module_spec.ts b/packages/compiler-cli/src/ngtsc/annotations/test/ng_module_spec.ts index ff621536bbcb..5e0387b1dbd0 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/test/ng_module_spec.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/test/ng_module_spec.ts @@ -14,6 +14,7 @@ import {runInEachFileSystem} from '../../file_system/testing'; import {LocalIdentifierStrategy, NOOP_DEFAULT_IMPORT_RECORDER, ReferenceEmitter} from '../../imports'; import {CompoundMetadataReader, DtsMetadataReader, InjectableClassRegistry, LocalMetadataRegistry} from '../../metadata'; import {PartialEvaluator} from '../../partial_evaluator'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {LocalModuleScopeRegistry, MetadataDtsModuleScopeResolver} from '../../scope'; import {getDeclaration, makeProgram} from '../../testing'; @@ -71,7 +72,8 @@ runInEachFileSystem(() => { const handler = new NgModuleDecoratorHandler( reflectionHost, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, /* isCore */ false, /* routeAnalyzer */ null, refEmitter, /* factoryTracker */ null, - NOOP_DEFAULT_IMPORT_RECORDER, /* annotateForClosureCompiler */ false, injectableRegistry); + NOOP_DEFAULT_IMPORT_RECORDER, /* annotateForClosureCompiler */ false, injectableRegistry, + NOOP_PERF_RECORDER); const TestModule = getDeclaration(program, _('/entry.ts'), 'TestModule', isNamedClassDeclaration); const detected = diff --git a/packages/compiler-cli/src/ngtsc/core/api/src/options.ts b/packages/compiler-cli/src/ngtsc/core/api/src/options.ts index fc86d664f146..661221d87a32 100644 --- a/packages/compiler-cli/src/ngtsc/core/api/src/options.ts +++ b/packages/compiler-cli/src/ngtsc/core/api/src/options.ts @@ -28,9 +28,8 @@ export interface TestOnlyOptions { /** * An option to enable ngtsc's internal performance tracing. * - * This should be a path to a JSON file where trace information will be written. An optional 'ts:' - * prefix will cause the trace to be written via the TS host instead of directly to the filesystem - * (not all hosts support this mode of operation). + * This should be a path to a JSON file where trace information will be written. This is sensitive + * to the compiler's working directory, and should likely be an absolute path. * * This is currently not exposed to users as the trace format is still unstable. */ diff --git a/packages/compiler-cli/src/ngtsc/core/src/compiler.ts b/packages/compiler-cli/src/ngtsc/core/src/compiler.ts index d483243aad94..f99ceb9ebb49 100644 --- a/packages/compiler-cli/src/ngtsc/core/src/compiler.ts +++ b/packages/compiler-cli/src/ngtsc/core/src/compiler.ts @@ -21,7 +21,9 @@ import {generateAnalysis, IndexedComponent, IndexingContext} from '../../indexer import {ComponentResources, CompoundMetadataReader, CompoundMetadataRegistry, DtsMetadataReader, InjectableClassRegistry, LocalMetadataRegistry, MetadataReader, ResourceRegistry} from '../../metadata'; import {ModuleWithProvidersScanner} from '../../modulewithproviders'; import {PartialEvaluator} from '../../partial_evaluator'; -import {NOOP_PERF_RECORDER, PerfRecorder} from '../../perf'; +import {ActivePerfRecorder} from '../../perf'; +import {PerfCheckpoint, PerfEvent, PerfPhase} from '../../perf/src/api'; +import {DelegatingPerfRecorder} from '../../perf/src/recorder'; import {DeclarationNode, isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {AdapterResourceLoader} from '../../resource'; import {entryPointKeyFor, NgModuleRouteAnalyzer} from '../../routing'; @@ -80,6 +82,7 @@ export interface FreshCompilationTicket { enableTemplateTypeChecker: boolean; usePoisonedData: boolean; tsProgram: ts.Program; + perfRecorder: ActivePerfRecorder; } /** @@ -95,12 +98,14 @@ export interface IncrementalTypeScriptCompilationTicket { newDriver: IncrementalDriver; enableTemplateTypeChecker: boolean; usePoisonedData: boolean; + perfRecorder: ActivePerfRecorder; } export interface IncrementalResourceCompilationTicket { kind: CompilationTicketKind.IncrementalResource; compiler: NgCompiler; modifiedResourceFiles: Set; + perfRecorder: ActivePerfRecorder; } /** @@ -119,8 +124,8 @@ export type CompilationTicket = FreshCompilationTicket|IncrementalTypeScriptComp export function freshCompilationTicket( tsProgram: ts.Program, options: NgCompilerOptions, incrementalBuildStrategy: IncrementalBuildStrategy, - typeCheckingProgramStrategy: TypeCheckingProgramStrategy, enableTemplateTypeChecker: boolean, - usePoisonedData: boolean): CompilationTicket { + typeCheckingProgramStrategy: TypeCheckingProgramStrategy, perfRecorder: ActivePerfRecorder|null, + enableTemplateTypeChecker: boolean, usePoisonedData: boolean): CompilationTicket { return { kind: CompilationTicketKind.Fresh, tsProgram, @@ -129,6 +134,7 @@ export function freshCompilationTicket( typeCheckingProgramStrategy, enableTemplateTypeChecker, usePoisonedData, + perfRecorder: perfRecorder ?? ActivePerfRecorder.zeroedToNow(), }; } @@ -139,8 +145,8 @@ export function freshCompilationTicket( export function incrementalFromCompilerTicket( oldCompiler: NgCompiler, newProgram: ts.Program, incrementalBuildStrategy: IncrementalBuildStrategy, - typeCheckingProgramStrategy: TypeCheckingProgramStrategy, - modifiedResourceFiles: Set): CompilationTicket { + typeCheckingProgramStrategy: TypeCheckingProgramStrategy, modifiedResourceFiles: Set, + perfRecorder: ActivePerfRecorder|null): CompilationTicket { const oldProgram = oldCompiler.getNextProgram(); const oldDriver = oldCompiler.incrementalStrategy.getIncrementalDriver(oldProgram); if (oldDriver === null) { @@ -148,11 +154,15 @@ export function incrementalFromCompilerTicket( // program. return freshCompilationTicket( newProgram, oldCompiler.options, incrementalBuildStrategy, typeCheckingProgramStrategy, - oldCompiler.enableTemplateTypeChecker, oldCompiler.usePoisonedData); + perfRecorder, oldCompiler.enableTemplateTypeChecker, oldCompiler.usePoisonedData); } - const newDriver = - IncrementalDriver.reconcile(oldProgram, oldDriver, newProgram, modifiedResourceFiles); + if (perfRecorder === null) { + perfRecorder = ActivePerfRecorder.zeroedToNow(); + } + + const newDriver = IncrementalDriver.reconcile( + oldProgram, oldDriver, newProgram, modifiedResourceFiles, perfRecorder); return { kind: CompilationTicketKind.IncrementalTypeScript, @@ -164,6 +174,7 @@ export function incrementalFromCompilerTicket( newDriver, oldProgram, newProgram, + perfRecorder, }; } @@ -175,9 +186,14 @@ export function incrementalFromDriverTicket( oldProgram: ts.Program, oldDriver: IncrementalDriver, newProgram: ts.Program, options: NgCompilerOptions, incrementalBuildStrategy: IncrementalBuildStrategy, typeCheckingProgramStrategy: TypeCheckingProgramStrategy, modifiedResourceFiles: Set, - enableTemplateTypeChecker: boolean, usePoisonedData: boolean): CompilationTicket { - const newDriver = - IncrementalDriver.reconcile(oldProgram, oldDriver, newProgram, modifiedResourceFiles); + perfRecorder: ActivePerfRecorder|null, enableTemplateTypeChecker: boolean, + usePoisonedData: boolean): CompilationTicket { + if (perfRecorder === null) { + perfRecorder = ActivePerfRecorder.zeroedToNow(); + } + + const newDriver = IncrementalDriver.reconcile( + oldProgram, oldDriver, newProgram, modifiedResourceFiles, perfRecorder); return { kind: CompilationTicketKind.IncrementalTypeScript, oldProgram, @@ -188,6 +204,7 @@ export function incrementalFromDriverTicket( typeCheckingProgramStrategy, enableTemplateTypeChecker, usePoisonedData, + perfRecorder, }; } @@ -197,6 +214,7 @@ export function resourceChangeTicket(compiler: NgCompiler, modifiedResourceFiles kind: CompilationTicketKind.IncrementalResource, compiler, modifiedResourceFiles, + perfRecorder: ActivePerfRecorder.zeroedToNow(), }; } @@ -245,16 +263,23 @@ export class NgCompiler { readonly ignoreForDiagnostics: Set; readonly ignoreForEmit: Set; + /** + * `NgCompiler` can be reused for multiple compilations (for resource-only changes), and each + * new compilation uses a fresh `PerfRecorder`. Thus, classes created with a lifespan of the + * `NgCompiler` use a `DelegatingPerfRecorder` so the `PerfRecorder` they write to can be updated + * with each fresh compilation. + */ + private delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder); + /** * Convert a `CompilationTicket` into an `NgCompiler` instance for the requested compilation. * * Depending on the nature of the compilation request, the `NgCompiler` instance may be reused * from a previous compilation and updated with any changes, it may be a new instance which - * incrementally reuses state from a previous compilation, or it may represent a fresh compilation - * entirely. + * incrementally reuses state from a previous compilation, or it may represent a fresh + * compilation entirely. */ - static fromTicket( - ticket: CompilationTicket, adapter: NgCompilerAdapter, perfRecorder?: PerfRecorder) { + static fromTicket(ticket: CompilationTicket, adapter: NgCompilerAdapter) { switch (ticket.kind) { case CompilationTicketKind.Fresh: return new NgCompiler( @@ -266,7 +291,7 @@ export class NgCompiler { IncrementalDriver.fresh(ticket.tsProgram), ticket.enableTemplateTypeChecker, ticket.usePoisonedData, - perfRecorder, + ticket.perfRecorder, ); case CompilationTicketKind.IncrementalTypeScript: return new NgCompiler( @@ -278,11 +303,11 @@ export class NgCompiler { ticket.newDriver, ticket.enableTemplateTypeChecker, ticket.usePoisonedData, - perfRecorder, + ticket.perfRecorder, ); case CompilationTicketKind.IncrementalResource: const compiler = ticket.compiler; - compiler.updateWithChangedResources(ticket.modifiedResourceFiles); + compiler.updateWithChangedResources(ticket.modifiedResourceFiles, ticket.perfRecorder); return compiler; } } @@ -296,7 +321,7 @@ export class NgCompiler { readonly incrementalDriver: IncrementalDriver, readonly enableTemplateTypeChecker: boolean, readonly usePoisonedData: boolean, - private perfRecorder: PerfRecorder = NOOP_PERF_RECORDER, + private livePerfRecorder: ActivePerfRecorder, ) { this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics); const incompatibleTypeCheckOptionsDiagnostic = verifyCompatibleTypeCheckOptions(this.options); @@ -312,9 +337,7 @@ export class NgCompiler { const moduleResolutionCache = ts.createModuleResolutionCache( this.adapter.getCurrentDirectory(), - // Note: this used to be an arrow-function closure. However, JS engines like v8 have some - // strange behaviors with retaining the lexical scope of the closure. Even if this function - // doesn't retain a reference to `this`, if other closures in the constructor here reference + // doen't retain a reference to `this`, if other closures in the constructor here reference // `this` internally then a closure created here would retain them. This can cause major // memory leak issues since the `moduleResolutionCache` is a long-lived object and finds its // way into all kinds of places inside TS internal objects. @@ -322,42 +345,66 @@ export class NgCompiler { this.moduleResolver = new ModuleResolver(tsProgram, this.options, this.adapter, moduleResolutionCache); this.resourceManager = new AdapterResourceLoader(adapter, this.options); - this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(tsProgram.getTypeChecker())); + this.cycleAnalyzer = + new CycleAnalyzer(new ImportGraph(tsProgram.getTypeChecker(), this.delegatingPerfRecorder)); this.incrementalStrategy.setIncrementalDriver(this.incrementalDriver, tsProgram); this.ignoreForDiagnostics = new Set(tsProgram.getSourceFiles().filter(sf => this.adapter.isShim(sf))); this.ignoreForEmit = this.adapter.ignoreForEmit; - } - private updateWithChangedResources(changedResources: Set): void { - if (this.compilation === null) { - // Analysis hasn't happened yet, so no update is necessary - any changes to resources will be - // captured by the inital analysis pass itself. - return; + let dtsFileCount = 0; + let nonDtsFileCount = 0; + for (const sf of tsProgram.getSourceFiles()) { + if (sf.isDeclarationFile) { + dtsFileCount++; + } else { + nonDtsFileCount++; + } } - this.resourceManager.invalidate(); + livePerfRecorder.eventCount(PerfEvent.InputDtsFile, dtsFileCount); + livePerfRecorder.eventCount(PerfEvent.InputTsFile, nonDtsFileCount); + } - const classesToUpdate = new Set(); - for (const resourceFile of changedResources) { - for (const templateClass of this.getComponentsWithTemplateFile(resourceFile)) { - classesToUpdate.add(templateClass); - } + get perfRecorder(): ActivePerfRecorder { + return this.livePerfRecorder; + } - for (const styleClass of this.getComponentsWithStyleFile(resourceFile)) { - classesToUpdate.add(styleClass); + private updateWithChangedResources( + changedResources: Set, perfRecorder: ActivePerfRecorder): void { + this.livePerfRecorder = perfRecorder; + this.delegatingPerfRecorder.target = perfRecorder; + + perfRecorder.inPhase(PerfPhase.ResourceUpdate, () => { + if (this.compilation === null) { + // Analysis hasn't happened yet, so no update is necessary - any changes to resources will + // be captured by the inital analysis pass itself. + return; } - } - for (const clazz of classesToUpdate) { - this.compilation.traitCompiler.updateResources(clazz); - if (!ts.isClassDeclaration(clazz)) { - continue; + this.resourceManager.invalidate(); + + const classesToUpdate = new Set(); + for (const resourceFile of changedResources) { + for (const templateClass of this.getComponentsWithTemplateFile(resourceFile)) { + classesToUpdate.add(templateClass); + } + + for (const styleClass of this.getComponentsWithStyleFile(resourceFile)) { + classesToUpdate.add(styleClass); + } } - this.compilation.templateTypeChecker.invalidateClass(clazz); - } + for (const clazz of classesToUpdate) { + this.compilation.traitCompiler.updateResources(clazz); + if (!ts.isClassDeclaration(clazz)) { + continue; + } + + this.compilation.templateTypeChecker.invalidateClass(clazz); + } + }); } /** @@ -481,33 +528,28 @@ export class NgCompiler { if (this.compilation !== null) { return; } - this.compilation = this.makeCompilation(); - const analyzeSpan = this.perfRecorder.start('analyze'); - const promises: Promise[] = []; - for (const sf of this.tsProgram.getSourceFiles()) { - if (sf.isDeclarationFile) { - continue; - } + await this.perfRecorder.inPhase(PerfPhase.Analysis, async () => { + this.compilation = this.makeCompilation(); - const analyzeFileSpan = this.perfRecorder.start('analyzeFile', sf); - let analysisPromise = this.compilation.traitCompiler.analyzeAsync(sf); - this.scanForMwp(sf); - if (analysisPromise === undefined) { - this.perfRecorder.stop(analyzeFileSpan); - } else if (this.perfRecorder.enabled) { - analysisPromise = analysisPromise.then(() => this.perfRecorder.stop(analyzeFileSpan)); - } - if (analysisPromise !== undefined) { - promises.push(analysisPromise); - } - } + const promises: Promise[] = []; + for (const sf of this.tsProgram.getSourceFiles()) { + if (sf.isDeclarationFile) { + continue; + } - await Promise.all(promises); + let analysisPromise = this.compilation.traitCompiler.analyzeAsync(sf); + this.scanForMwp(sf); + if (analysisPromise !== undefined) { + promises.push(analysisPromise); + } + } - this.perfRecorder.stop(analyzeSpan); + await Promise.all(promises); - this.resolveCompilation(this.compilation.traitCompiler); + this.perfRecorder.memory(PerfCheckpoint.Analysis); + this.resolveCompilation(this.compilation.traitCompiler); + }); } /** @@ -517,9 +559,7 @@ export class NgCompiler { */ listLazyRoutes(entryRoute?: string): LazyRoute[] { if (entryRoute) { - // Note: - // This resolution step is here to match the implementation of the old `AotCompilerHost` (see - // https://github.com/angular/angular/blob/50732e156/packages/compiler-cli/src/transformers/compiler_host.ts#L175-L188). + // htts://github.com/angular/angular/blob/50732e156/packages/compiler-cli/src/transformers/compiler_host.ts#L175-L188). // // `@angular/cli` will always call this API with an absolute path, so the resolution step is // not necessary, but keeping it backwards compatible in case someone else is using the API. @@ -573,7 +613,8 @@ export class NgCompiler { const before = [ ivyTransformFactory( compilation.traitCompiler, compilation.reflector, importRewriter, - compilation.defaultImportTracker, compilation.isCore, this.closureCompilerEnabled), + compilation.defaultImportTracker, this.delegatingPerfRecorder, compilation.isCore, + this.closureCompilerEnabled), aliasTransformFactory(compilation.traitCompiler.exportStatements), compilation.defaultImportTracker.importPreservingTransformer(), ]; @@ -618,28 +659,32 @@ export class NgCompiler { } private analyzeSync(): void { - const analyzeSpan = this.perfRecorder.start('analyze'); - this.compilation = this.makeCompilation(); - for (const sf of this.tsProgram.getSourceFiles()) { - if (sf.isDeclarationFile) { - continue; + this.perfRecorder.inPhase(PerfPhase.Analysis, () => { + this.compilation = this.makeCompilation(); + for (const sf of this.tsProgram.getSourceFiles()) { + if (sf.isDeclarationFile) { + continue; + } + this.compilation.traitCompiler.analyzeSync(sf); + this.scanForMwp(sf); } - const analyzeFileSpan = this.perfRecorder.start('analyzeFile', sf); - this.compilation.traitCompiler.analyzeSync(sf); - this.scanForMwp(sf); - this.perfRecorder.stop(analyzeFileSpan); - } - this.perfRecorder.stop(analyzeSpan); - this.resolveCompilation(this.compilation.traitCompiler); + this.perfRecorder.memory(PerfCheckpoint.Analysis); + + this.resolveCompilation(this.compilation.traitCompiler); + }); } private resolveCompilation(traitCompiler: TraitCompiler): void { - traitCompiler.resolve(); + this.perfRecorder.inPhase(PerfPhase.Resolve, () => { + traitCompiler.resolve(); - // At this point, analysis is complete and the compiler can now calculate which files need to - // be emitted, so do that. - this.incrementalDriver.recordSuccessfulAnalysis(traitCompiler); + // At this point, analysis is complete and the compiler can now calculate which files need to + // be emitted, so do that. + this.incrementalDriver.recordSuccessfulAnalysis(traitCompiler); + + this.perfRecorder.memory(PerfCheckpoint.Resolve); + }); } private get fullTemplateTypeCheck(): boolean { @@ -692,6 +737,10 @@ export class NgCompiler { strictLiteralTypes: true, enableTemplateTypeChecker: this.enableTemplateTypeChecker, useInlineTypeConstructors, + // Warnings for suboptimal type inference are only enabled if in Language Service mode + // (providing the full TemplateTypeChecker API) and if strict mode is not enabled. In strict + // mode, the user is in full control of type inference. + suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates, }; } else { typeCheckingConfig = { @@ -717,6 +766,9 @@ export class NgCompiler { strictLiteralTypes: false, enableTemplateTypeChecker: this.enableTemplateTypeChecker, useInlineTypeConstructors, + // In "basic" template type-checking mode, no warnings are produced since most things are + // not checked anyways. + suggestionsForSuboptimalTypeInference: false, }; } @@ -763,7 +815,6 @@ export class NgCompiler { const compilation = this.ensureAnalyzed(); // Get the diagnostics. - const typeCheckSpan = this.perfRecorder.start('typeCheckDiagnostics'); const diagnostics: ts.Diagnostic[] = []; for (const sf of this.tsProgram.getSourceFiles()) { if (sf.isDeclarationFile || this.adapter.isShim(sf)) { @@ -775,7 +826,6 @@ export class NgCompiler { } const program = this.typeCheckingProgramStrategy.getProgram(); - this.perfRecorder.stop(typeCheckSpan); this.incrementalStrategy.setIncrementalDriver(this.incrementalDriver, program); this.nextProgram = program; @@ -787,14 +837,12 @@ export class NgCompiler { const compilation = this.ensureAnalyzed(); // Get the diagnostics. - const typeCheckSpan = this.perfRecorder.start('typeCheckDiagnostics'); const diagnostics: ts.Diagnostic[] = []; if (!sf.isDeclarationFile && !this.adapter.isShim(sf)) { diagnostics.push(...compilation.templateTypeChecker.getDiagnosticsForFile(sf, optimizeFor)); } const program = this.typeCheckingProgramStrategy.getProgram(); - this.perfRecorder.stop(typeCheckSpan); this.incrementalStrategy.setIncrementalDriver(this.incrementalDriver, program); this.nextProgram = program; @@ -943,7 +991,8 @@ export class NgCompiler { this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, defaultImportTracker, this.incrementalDriver.depGraph, - injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled), + injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, + this.delegatingPerfRecorder), // TODO(alxhub): understand why the cast here is necessary (something to do with `null` // not being assignable to `unknown` when wrapped in `Readonly`). @@ -952,31 +1001,33 @@ export class NgCompiler { reflector, evaluator, metaRegistry, scopeRegistry, metaReader, defaultImportTracker, injectableRegistry, isCore, semanticDepGraphUpdater, this.closureCompilerEnabled, compileUndecoratedClassesWithAngularFeatures, + this.delegatingPerfRecorder, ) as Readonly>, // clang-format on // Pipe handler must be before injectable handler in list so pipe factories are printed // before injectable factories (so injectable factories can delegate to them) new PipeDecoratorHandler( reflector, evaluator, metaRegistry, scopeRegistry, defaultImportTracker, - injectableRegistry, isCore), + injectableRegistry, isCore, this.delegatingPerfRecorder), new InjectableDecoratorHandler( reflector, defaultImportTracker, isCore, this.options.strictInjectionParameters || false, - injectableRegistry), + injectableRegistry, this.delegatingPerfRecorder), new NgModuleDecoratorHandler( reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, isCore, routeAnalyzer, refEmitter, this.adapter.factoryTracker, defaultImportTracker, - this.closureCompilerEnabled, injectableRegistry, this.options.i18nInLocale), + this.closureCompilerEnabled, injectableRegistry, this.delegatingPerfRecorder, + this.options.i18nInLocale), ]; const traitCompiler = new TraitCompiler( - handlers, reflector, this.perfRecorder, this.incrementalDriver, + handlers, reflector, this.delegatingPerfRecorder, this.incrementalDriver, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater); const templateTypeChecker = new TemplateTypeCheckerImpl( this.tsProgram, this.typeCheckingProgramStrategy, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalDriver, - scopeRegistry, typeCheckScopeRegistry); + scopeRegistry, typeCheckScopeRegistry, this.delegatingPerfRecorder); return { isCore, diff --git a/packages/compiler-cli/src/ngtsc/core/test/compiler_test.ts b/packages/compiler-cli/src/ngtsc/core/test/compiler_test.ts index 785499527d11..e7f59a210358 100644 --- a/packages/compiler-cli/src/ngtsc/core/test/compiler_test.ts +++ b/packages/compiler-cli/src/ngtsc/core/test/compiler_test.ts @@ -25,8 +25,8 @@ function makeFreshCompiler( programStrategy: TypeCheckingProgramStrategy, incrementalStrategy: IncrementalBuildStrategy, enableTemplateTypeChecker: boolean, usePoisonedData: boolean): NgCompiler { const ticket = freshCompilationTicket( - program, options, incrementalStrategy, programStrategy, enableTemplateTypeChecker, - usePoisonedData); + program, options, incrementalStrategy, programStrategy, /* perfRecorder */ null, + enableTemplateTypeChecker, usePoisonedData); return NgCompiler.fromTicket(ticket, host); } diff --git a/packages/compiler-cli/src/ngtsc/cycles/BUILD.bazel b/packages/compiler-cli/src/ngtsc/cycles/BUILD.bazel index 78a4cbf391a5..b17665f899d4 100644 --- a/packages/compiler-cli/src/ngtsc/cycles/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/cycles/BUILD.bazel @@ -9,6 +9,7 @@ ts_library( ]), module_name = "@angular/compiler-cli/src/ngtsc/cycles", deps = [ + "//packages/compiler-cli/src/ngtsc/perf", "@npm//typescript", ], ) diff --git a/packages/compiler-cli/src/ngtsc/cycles/src/imports.ts b/packages/compiler-cli/src/ngtsc/cycles/src/imports.ts index 1696cab7a2b6..a04f04496537 100644 --- a/packages/compiler-cli/src/ngtsc/cycles/src/imports.ts +++ b/packages/compiler-cli/src/ngtsc/cycles/src/imports.ts @@ -8,6 +8,8 @@ import * as ts from 'typescript'; +import {PerfPhase, PerfRecorder} from '../../perf'; + /** * A cached graph of imports in the `ts.Program`. * @@ -17,7 +19,7 @@ import * as ts from 'typescript'; export class ImportGraph { private map = new Map>(); - constructor(private checker: ts.TypeChecker) {} + constructor(private checker: ts.TypeChecker, private perf: PerfRecorder) {} /** * List the direct (not transitive) imports of a given `ts.SourceFile`. @@ -99,26 +101,28 @@ export class ImportGraph { } private scanImports(sf: ts.SourceFile): Set { - const imports = new Set(); - // Look through the source file for import and export statements. - for (const stmt of sf.statements) { - if ((!ts.isImportDeclaration(stmt) && !ts.isExportDeclaration(stmt)) || - stmt.moduleSpecifier === undefined) { - continue; - } + return this.perf.inPhase(PerfPhase.CycleDetection, () => { + const imports = new Set(); + // Look through the source file for import and export statements. + for (const stmt of sf.statements) { + if ((!ts.isImportDeclaration(stmt) && !ts.isExportDeclaration(stmt)) || + stmt.moduleSpecifier === undefined) { + continue; + } - const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier); - if (symbol === undefined || symbol.valueDeclaration === undefined) { - // No symbol could be found to skip over this import/export. - continue; - } - const moduleFile = symbol.valueDeclaration; - if (ts.isSourceFile(moduleFile) && isLocalFile(moduleFile)) { - // Record this local import. - imports.add(moduleFile); + const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier); + if (symbol === undefined || symbol.valueDeclaration === undefined) { + // No symbol could be found to skip over this import/export. + continue; + } + const moduleFile = symbol.valueDeclaration; + if (ts.isSourceFile(moduleFile) && isLocalFile(moduleFile)) { + // Record this local import. + imports.add(moduleFile); + } } - } - return imports; + return imports; + }); } } diff --git a/packages/compiler-cli/src/ngtsc/cycles/test/BUILD.bazel b/packages/compiler-cli/src/ngtsc/cycles/test/BUILD.bazel index 8ba04d744645..21b3aaae0691 100644 --- a/packages/compiler-cli/src/ngtsc/cycles/test/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/cycles/test/BUILD.bazel @@ -13,6 +13,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/cycles", "//packages/compiler-cli/src/ngtsc/file_system", "//packages/compiler-cli/src/ngtsc/file_system/testing", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/testing", "@npm//typescript", ], diff --git a/packages/compiler-cli/src/ngtsc/cycles/test/analyzer_spec.ts b/packages/compiler-cli/src/ngtsc/cycles/test/analyzer_spec.ts index 388a1d9b6b6a..85b058dd8fcc 100644 --- a/packages/compiler-cli/src/ngtsc/cycles/test/analyzer_spec.ts +++ b/packages/compiler-cli/src/ngtsc/cycles/test/analyzer_spec.ts @@ -8,6 +8,7 @@ import * as ts from 'typescript'; import {absoluteFrom, getFileSystem, getSourceFileOrError} from '../../file_system'; import {runInEachFileSystem} from '../../file_system/testing'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {Cycle, CycleAnalyzer} from '../src/analyzer'; import {ImportGraph} from '../src/imports'; import {importPath, makeProgramFromGraph} from './util'; @@ -75,7 +76,7 @@ runInEachFileSystem(() => { const {program} = makeProgramFromGraph(getFileSystem(), graph); return { program, - analyzer: new CycleAnalyzer(new ImportGraph(program.getTypeChecker())), + analyzer: new CycleAnalyzer(new ImportGraph(program.getTypeChecker(), NOOP_PERF_RECORDER)), }; } }); diff --git a/packages/compiler-cli/src/ngtsc/cycles/test/imports_spec.ts b/packages/compiler-cli/src/ngtsc/cycles/test/imports_spec.ts index e4713f44f63d..f88500643ddf 100644 --- a/packages/compiler-cli/src/ngtsc/cycles/test/imports_spec.ts +++ b/packages/compiler-cli/src/ngtsc/cycles/test/imports_spec.ts @@ -8,6 +8,7 @@ import * as ts from 'typescript'; import {absoluteFrom, getFileSystem, getSourceFileOrError} from '../../file_system'; import {runInEachFileSystem} from '../../file_system/testing'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {ImportGraph} from '../src/imports'; import {importPath, makeProgramFromGraph} from './util'; @@ -86,7 +87,7 @@ runInEachFileSystem(() => { const {program} = makeProgramFromGraph(getFileSystem(), graph); return { program, - graph: new ImportGraph(program.getTypeChecker()), + graph: new ImportGraph(program.getTypeChecker(), NOOP_PERF_RECORDER), }; } diff --git a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts index 89292b56fa37..910abcbde66e 100644 --- a/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts +++ b/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.ts @@ -171,15 +171,22 @@ export enum ErrorCode { */ INJECTABLE_DUPLICATE_PROV = 9001, - // 10XXX error codes are reserved for diagnostics with category - // `ts.DiagnosticCategory.Suggestion`. These diagnostics are generated by - // language service. + // 10XXX error codes are reserved for diagnostics with categories other than + // `ts.DiagnosticCategory.Error`. These diagnostics are generated by the compiler when configured + // to do so by a tool such as the Language Service, or by the Language Service itself. /** * Suggest users to enable `strictTemplates` to make use of full capabilities * provided by Angular language service. */ SUGGEST_STRICT_TEMPLATES = 10001, + + /** + * Indicates that a particular structural directive provides advanced type narrowing + * functionality, but the current template type-checking configuration does not allow its usage in + * type inference. + */ + SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002, } /** diff --git a/packages/compiler-cli/src/ngtsc/imports/src/core.ts b/packages/compiler-cli/src/ngtsc/imports/src/core.ts index eae858337bbe..e952336dd9ff 100644 --- a/packages/compiler-cli/src/ngtsc/imports/src/core.ts +++ b/packages/compiler-cli/src/ngtsc/imports/src/core.ts @@ -59,11 +59,11 @@ const CORE_SUPPORTED_SYMBOLS = new Map([ ['ɵɵdefineNgModule', 'ɵɵdefineNgModule'], ['ɵɵsetNgModuleScope', 'ɵɵsetNgModuleScope'], ['ɵɵinject', 'ɵɵinject'], - ['ɵɵFactoryDef', 'ɵɵFactoryDef'], + ['ɵɵFactoryDeclaration', 'ɵɵFactoryDeclaration'], ['ɵsetClassMetadata', 'setClassMetadata'], ['ɵɵInjectableDef', 'ɵɵInjectableDef'], - ['ɵɵInjectorDef', 'ɵɵInjectorDef'], - ['ɵɵNgModuleDefWithMeta', 'ɵɵNgModuleDefWithMeta'], + ['ɵɵInjectorDeclaration', 'ɵɵInjectorDeclaration'], + ['ɵɵNgModuleDeclaration', 'ɵɵNgModuleDeclaration'], ['ɵNgModuleFactory', 'NgModuleFactory'], ['ɵnoSideEffects', 'ɵnoSideEffects'], ]); diff --git a/packages/compiler-cli/src/ngtsc/incremental/BUILD.bazel b/packages/compiler-cli/src/ngtsc/incremental/BUILD.bazel index 4b690eb29d04..0e89dfbed221 100644 --- a/packages/compiler-cli/src/ngtsc/incremental/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/incremental/BUILD.bazel @@ -14,6 +14,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/incremental/semantic_graph", "//packages/compiler-cli/src/ngtsc/metadata", "//packages/compiler-cli/src/ngtsc/partial_evaluator", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/scope", "//packages/compiler-cli/src/ngtsc/transform", diff --git a/packages/compiler-cli/src/ngtsc/incremental/src/state.ts b/packages/compiler-cli/src/ngtsc/incremental/src/state.ts index d247aeaa6d78..cd5f5fa431b2 100644 --- a/packages/compiler-cli/src/ngtsc/incremental/src/state.ts +++ b/packages/compiler-cli/src/ngtsc/incremental/src/state.ts @@ -9,6 +9,7 @@ import * as ts from 'typescript'; import {absoluteFrom, absoluteFromSourceFile, AbsoluteFsPath} from '../../file_system'; +import {PerfEvent, PerfPhase, PerfRecorder} from '../../perf'; import {ClassDeclaration} from '../../reflection'; import {ClassRecord, TraitCompiler} from '../../transform'; import {FileTypeCheckingData} from '../../typecheck/src/checker'; @@ -43,118 +44,122 @@ export class IncrementalDriver implements IncrementalBuild|null): IncrementalDriver { - // Initialize the state of the current build based on the previous one. - let state: PendingBuildState; - if (oldDriver.state.kind === BuildStateKind.Pending) { - // The previous build never made it past the pending state. Reuse it as the starting state for - // this build. - state = oldDriver.state; - } else { - let priorGraph: SemanticDepGraph|null = null; - if (oldDriver.state.lastGood !== null) { - priorGraph = oldDriver.state.lastGood.semanticDepGraph; - } - - // The previous build was successfully analyzed. `pendingEmit` is the only state carried - // forward into this build. - state = { - kind: BuildStateKind.Pending, - pendingEmit: oldDriver.state.pendingEmit, - pendingTypeCheckEmit: oldDriver.state.pendingTypeCheckEmit, - changedResourcePaths: new Set(), - changedTsPaths: new Set(), - lastGood: oldDriver.state.lastGood, - semanticDepGraphUpdater: new SemanticDepGraphUpdater(priorGraph), - }; - } - - // Merge the freshly modified resource files with any prior ones. - if (modifiedResourceFiles !== null) { - for (const resFile of modifiedResourceFiles) { - state.changedResourcePaths.add(absoluteFrom(resFile)); - } - } - - // Next, process the files in the new program, with a couple of goals: - // 1) Determine which TS files have changed, if any, and merge them into `changedTsFiles`. - // 2) Produce a list of TS files which no longer exist in the program (they've been deleted - // since the previous compilation). These need to be removed from the state tracking to avoid - // leaking memory. - - // All files in the old program, for easy detection of changes. - const oldFiles = new Set(oldProgram.getSourceFiles()); - - // Assume all the old files were deleted to begin with. Only TS files are tracked. - const deletedTsPaths = new Set(tsOnlyFiles(oldProgram).map(sf => sf.fileName)); - - for (const newFile of newProgram.getSourceFiles()) { - if (!newFile.isDeclarationFile) { - // This file exists in the new program, so remove it from `deletedTsPaths`. - deletedTsPaths.delete(newFile.fileName); + modifiedResourceFiles: Set|null, perf: PerfRecorder): IncrementalDriver { + return perf.inPhase(PerfPhase.Reconciliation, () => { + // Initialize the state of the current build based on the previous one. + let state: PendingBuildState; + if (oldDriver.state.kind === BuildStateKind.Pending) { + // The previous build never made it past the pending state. Reuse it as the starting state + // for this build. + state = oldDriver.state; + } else { + let priorGraph: SemanticDepGraph|null = null; + if (oldDriver.state.lastGood !== null) { + priorGraph = oldDriver.state.lastGood.semanticDepGraph; + } + + // The previous build was successfully analyzed. `pendingEmit` is the only state carried + // forward into this build. + state = { + kind: BuildStateKind.Pending, + pendingEmit: oldDriver.state.pendingEmit, + pendingTypeCheckEmit: oldDriver.state.pendingTypeCheckEmit, + changedResourcePaths: new Set(), + changedTsPaths: new Set(), + lastGood: oldDriver.state.lastGood, + semanticDepGraphUpdater: new SemanticDepGraphUpdater(priorGraph), + }; } - if (oldFiles.has(newFile)) { - // This file hasn't changed; no need to look at it further. - continue; + // Merge the freshly modified resource files with any prior ones. + if (modifiedResourceFiles !== null) { + for (const resFile of modifiedResourceFiles) { + state.changedResourcePaths.add(absoluteFrom(resFile)); + } } - // The file has changed since the last successful build. The appropriate reaction depends on - // what kind of file it is. - if (!newFile.isDeclarationFile) { - // It's a .ts file, so track it as a change. - state.changedTsPaths.add(newFile.fileName); - } else { - // It's a .d.ts file. Currently the compiler does not do a great job of tracking - // dependencies on .d.ts files, so bail out of incremental builds here and do a full build. - // This usually only happens if something in node_modules changes. - return IncrementalDriver.fresh(newProgram); + // Next, process the files in the new program, with a couple of goals: + // 1) Determine which TS files have changed, if any, and merge them into `changedTsFiles`. + // 2) Produce a list of TS files which no longer exist in the program (they've been deleted + // since the previous compilation). These need to be removed from the state tracking to + // avoid leaking memory. + + // All files in the old program, for easy detection of changes. + const oldFiles = new Set(oldProgram.getSourceFiles()); + + // Assume all the old files were deleted to begin with. Only TS files are tracked. + const deletedTsPaths = new Set(tsOnlyFiles(oldProgram).map(sf => sf.fileName)); + + for (const newFile of newProgram.getSourceFiles()) { + if (!newFile.isDeclarationFile) { + // This file exists in the new program, so remove it from `deletedTsPaths`. + deletedTsPaths.delete(newFile.fileName); + } + + if (oldFiles.has(newFile)) { + // This file hasn't changed; no need to look at it further. + continue; + } + + // The file has changed since the last successful build. The appropriate reaction depends on + // what kind of file it is. + if (!newFile.isDeclarationFile) { + // It's a .ts file, so track it as a change. + state.changedTsPaths.add(newFile.fileName); + } else { + // It's a .d.ts file. Currently the compiler does not do a great job of tracking + // dependencies on .d.ts files, so bail out of incremental builds here and do a full + // build. This usually only happens if something in node_modules changes. + return IncrementalDriver.fresh(newProgram); + } } - } - // The next step is to remove any deleted files from the state. - for (const filePath of deletedTsPaths) { - state.pendingEmit.delete(filePath); - state.pendingTypeCheckEmit.delete(filePath); + // The next step is to remove any deleted files from the state. + for (const filePath of deletedTsPaths) { + state.pendingEmit.delete(filePath); + state.pendingTypeCheckEmit.delete(filePath); - // Even if the file doesn't exist in the current compilation, it still might have been changed - // in a previous one, so delete it from the set of changed TS files, just in case. - state.changedTsPaths.delete(filePath); - } - - // Now, changedTsPaths contains physically changed TS paths. Use the previous program's logical - // dependency graph to determine logically changed files. - const depGraph = new FileDependencyGraph(); - - // If a previous compilation exists, use its dependency graph to determine the set of logically - // changed files. - let logicalChanges: Set|null = null; - if (state.lastGood !== null) { - // Extract the set of logically changed files. At the same time, this operation populates the - // current (fresh) dependency graph with information about those files which have not - // logically changed. - logicalChanges = depGraph.updateWithPhysicalChanges( - state.lastGood.depGraph, state.changedTsPaths, deletedTsPaths, - state.changedResourcePaths); - for (const fileName of state.changedTsPaths) { - logicalChanges.add(fileName); + // Even if the file doesn't exist in the current compilation, it still might have been + // changed in a previous one, so delete it from the set of changed TS files, just in case. + state.changedTsPaths.delete(filePath); } - // Any logically changed files need to be re-emitted. Most of the time this would happen - // regardless because the new dependency graph would _also_ identify the file as stale. - // However there are edge cases such as removing a component from an NgModule without adding - // it to another one, where the previous graph identifies the file as logically changed, but - // the new graph (which does not have that edge) fails to identify that the file should be - // re-emitted. - for (const change of logicalChanges) { - state.pendingEmit.add(change); - state.pendingTypeCheckEmit.add(change); + perf.eventCount(PerfEvent.SourceFilePhysicalChange, state.changedTsPaths.size); + + // Now, changedTsPaths contains physically changed TS paths. Use the previous program's + // logical dependency graph to determine logically changed files. + const depGraph = new FileDependencyGraph(); + + // If a previous compilation exists, use its dependency graph to determine the set of + // logically changed files. + let logicalChanges: Set|null = null; + if (state.lastGood !== null) { + // Extract the set of logically changed files. At the same time, this operation populates + // the current (fresh) dependency graph with information about those files which have not + // logically changed. + logicalChanges = depGraph.updateWithPhysicalChanges( + state.lastGood.depGraph, state.changedTsPaths, deletedTsPaths, + state.changedResourcePaths); + perf.eventCount(PerfEvent.SourceFileLogicalChange, logicalChanges.size); + for (const fileName of state.changedTsPaths) { + logicalChanges.add(fileName); + } + + // Any logically changed files need to be re-emitted. Most of the time this would happen + // regardless because the new dependency graph would _also_ identify the file as stale. + // However there are edge cases such as removing a component from an NgModule without adding + // it to another one, where the previous graph identifies the file as logically changed, but + // the new graph (which does not have that edge) fails to identify that the file should be + // re-emitted. + for (const change of logicalChanges) { + state.pendingEmit.add(change); + state.pendingTypeCheckEmit.add(change); + } } - } - - // `state` now reflects the initial pending state of the current compilation. - return new IncrementalDriver(state, depGraph, logicalChanges); + // `state` now reflects the initial pending state of the current compilation. + return new IncrementalDriver(state, depGraph, logicalChanges); + }); } static fresh(program: ts.Program): IncrementalDriver { diff --git a/packages/compiler-cli/src/ngtsc/metadata/test/dts_spec.ts b/packages/compiler-cli/src/ngtsc/metadata/test/dts_spec.ts index bb785afa46d4..c34de79b16c2 100644 --- a/packages/compiler-cli/src/ngtsc/metadata/test/dts_spec.ts +++ b/packages/compiler-cli/src/ngtsc/metadata/test/dts_spec.ts @@ -33,7 +33,7 @@ runInEachFileSystem(() => { export declare class TestDir { constructor(p0: ViewContainerRef); - static ɵdir: i0.ɵɵDirectiveDefWithMeta + static ɵdir: i0.ɵɵDirectiveDeclaration } ` }], @@ -67,7 +67,7 @@ runInEachFileSystem(() => { export declare class TestDir { constructor(p0: ViewContainerRef, p1: TemplateRef); - static ɵdir: i0.ɵɵDirectiveDefWithMeta + static ɵdir: i0.ɵɵDirectiveDeclaration } ` }], diff --git a/packages/compiler-cli/src/ngtsc/perf/BUILD.bazel b/packages/compiler-cli/src/ngtsc/perf/BUILD.bazel index f51e6b0a56a5..53af9b1c4ff2 100644 --- a/packages/compiler-cli/src/ngtsc/perf/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/perf/BUILD.bazel @@ -9,8 +9,6 @@ ts_library( ]), deps = [ "//packages:types", - "//packages/compiler-cli/src/ngtsc/file_system", - "//packages/compiler-cli/src/ngtsc/reflection", "@npm//@types/node", "@npm//typescript", ], diff --git a/packages/compiler-cli/src/ngtsc/perf/index.ts b/packages/compiler-cli/src/ngtsc/perf/index.ts index 9f5b7ce343c8..32b9762f9f18 100644 --- a/packages/compiler-cli/src/ngtsc/perf/index.ts +++ b/packages/compiler-cli/src/ngtsc/perf/index.ts @@ -6,6 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -export {PerfRecorder} from './src/api'; +export * from './src/api'; export {NOOP_PERF_RECORDER} from './src/noop'; -export {PerfTracker} from './src/tracking'; +export {ActivePerfRecorder, DelegatingPerfRecorder} from './src/recorder'; diff --git a/packages/compiler-cli/src/ngtsc/perf/src/api.ts b/packages/compiler-cli/src/ngtsc/perf/src/api.ts index a71780832482..39e2a44bc0f6 100644 --- a/packages/compiler-cli/src/ngtsc/perf/src/api.ts +++ b/packages/compiler-cli/src/ngtsc/perf/src/api.ts @@ -6,12 +6,362 @@ * found in the LICENSE file at https://angular.io/license */ -import {DeclarationNode} from '../../reflection'; +/** + * A phase of compilation for which time is tracked in a distinct bucket. + */ +export enum PerfPhase { + /** + * The "default" phase which tracks time not spent in any other phase. + */ + Unaccounted, + + /** + * Time spent setting up the compiler, before a TypeScript program is created. + * + * This includes operations like configuring the `ts.CompilerHost` and any wrappers. + */ + Setup, + + /** + * Time spent in `ts.createProgram`, including reading and parsing `ts.SourceFile`s in the + * `ts.CompilerHost`. + * + * This might be an incremental program creation operation. + */ + TypeScriptProgramCreate, + + /** + * Time spent reconciling the contents of an old `ts.Program` with the new incremental one. + * + * Only present in incremental compilations. + */ + Reconciliation, + + /** + * Time spent updating an `NgCompiler` instance with a resource-only change. + * + * Only present in incremental compilations where the change was resource-only. + */ + ResourceUpdate, + + /** + * Time spent calculating the plain TypeScript diagnostics (structural and semantic). + */ + TypeScriptDiagnostics, + + /** + * Time spent in Angular analysis of individual classes in the program. + */ + Analysis, + + /** + * Time spent in Angular global analysis (synthesis of analysis information into a complete + * understanding of the program). + */ + Resolve, + + /** + * Time spent building the import graph of the program in order to perform cycle detection. + */ + CycleDetection, + + /** + * Time spent generating the text of Type Check Blocks in order to perform template type checking. + */ + TcbGeneration, + + /** + * Time spent updating the `ts.Program` with new Type Check Block code. + */ + TcbUpdateProgram, + + /** + * Time spent by TypeScript performing its emit operations, including downleveling and writing + * output files. + */ + TypeScriptEmit, + + /** + * Time spent by Angular performing code transformations of ASTs as they're about to be emitted. + * + * This includes the actual code generation step for templates, and occurs during the emit phase + * (but is tracked separately from `TypeScriptEmit` time). + */ + Compile, + + /** + * Time spent performing a `TemplateTypeChecker` autocompletion operation. + */ + TtcAutocompletion, + + /** + * Time spent computing template type-checking diagnostics. + */ + TtcDiagnostics, + + /** + * Time spent getting a `Symbol` from the `TemplateTypeChecker`. + */ + TtcSymbol, + + /** + * Time spent by the Angular Language Service calculating a "get references" or a renaming + * operation. + */ + LsReferencesAndRenames, + + /** + * Time spent by the Angular Language Service calculating a "quick info" operation. + */ + LsQuickInfo, + + /** + * Time spent by the Angular Language Service calculating a "get type definition" or "get + * definition" operation. + */ + LsDefinition, + + /** + * Time spent by the Angular Language Service calculating a "get completions" (AKA autocomplete) + * operation. + */ + LsCompletions, + + /** + * Time spent by the Angular Language Service calculating a "view template typecheck block" + * operation. + */ + LsTcb, + + /** + * Time spent by the Angular Language Service calculating diagnostics. + */ + LsDiagnostics, + + /** + * Time spent by the Angular Language Service calculating a "get component locations for template" + * operation. + */ + LsComponentLocations, + + /** + * Tracks the number of `PerfPhase`s, and must appear at the end of the list. + */ + LAST, +} + +/** + * Represents some occurrence during compilation, and is tracked with a counter. + */ +export enum PerfEvent { + /** + * Counts the number of `.d.ts` files in the program. + */ + InputDtsFile, + + /** + * Counts the number of non-`.d.ts` files in the program. + */ + InputTsFile, + + /** + * An `@Component` class was analyzed. + */ + AnalyzeComponent, + + /** + * An `@Directive` class was analyzed. + */ + AnalyzeDirective, + + /** + * An `@Injectable` class was analyzed. + */ + AnalyzeInjectable, + /** + * An `@NgModule` class was analyzed. + */ + AnalyzeNgModule, + + /** + * An `@Pipe` class was analyzed. + */ + AnalyzePipe, + + /** + * A trait was analyzed. + * + * In theory, this should be the sum of the `Analyze` counters for each decorator type. + */ + TraitAnalyze, + + /** + * A trait had a prior analysis available from an incremental program, and did not need to be + * re-analyzed. + */ + TraitReuseAnalysis, + + /** + * A `ts.SourceFile` directly changed between the prior program and a new incremental compilation. + */ + SourceFilePhysicalChange, + + /** + * A `ts.SourceFile` did not physically changed, but according to the file dependency graph, has + * logically changed between the prior program and a new incremental compilation. + */ + SourceFileLogicalChange, + + /** + * A `ts.SourceFile` has not logically changed and all of its analysis results were thus available + * for reuse. + */ + SourceFileReuseAnalysis, + + /** + * A Type Check Block (TCB) was generated. + */ + GenerateTcb, + + /** + * A Type Check Block (TCB) could not be generated because inlining was disabled, and the block + * would've required inlining. + */ + SkipGenerateTcbNoInline, + + /** + * A `.ngtypecheck.ts` file could be reused from the previous program and did not need to be + * regenerated. + */ + ReuseTypeCheckFile, + + /** + * The template type-checking program required changes and had to be updated in an incremental + * step. + */ + UpdateTypeCheckProgram, + + /** + * The compiler was able to prove that a `ts.SourceFile` did not need to be re-emitted. + */ + EmitSkipSourceFile, + + /** + * A `ts.SourceFile` was emitted. + */ + EmitSourceFile, + + /** + * Tracks the number of `PrefEvent`s, and must appear at the end of the list. + */ + LAST, +} + +/** + * Represents a checkpoint during compilation at which the memory usage of the compiler should be + * recorded. + */ +export enum PerfCheckpoint { + /** + * The point at which the `PerfRecorder` was created, and ideally tracks memory used before any + * compilation structures are created. + */ + Initial, + + /** + * The point just after the `ts.Program` has been created. + */ + TypeScriptProgramCreate, + + /** + * The point just before Angular analysis starts. + * + * In the main usage pattern for the compiler, TypeScript diagnostics have been calculated at this + * point, so the `ts.TypeChecker` has fully ingested the current program, all `ts.Type` structures + * and `ts.Symbol`s have been created. + */ + PreAnalysis, + + /** + * The point just after Angular analysis completes. + */ + Analysis, + + /** + * The point just after Angular resolution is complete. + */ + Resolve, + + /** + * The point just after Type Check Blocks (TCBs) have been generated. + */ + TtcGeneration, + + /** + * The point just after the template type-checking program has been updated with any new TCBs. + */ + TtcUpdateProgram, + + /** + * The point just before emit begins. + * + * In the main usage pattern for the compiler, all template type-checking diagnostics have been + * requested at this point. + */ + PreEmit, + + /** + * The point just after the program has been fully emitted. + */ + Emit, + + /** + * Tracks the number of `PerfCheckpoint`s, and must appear at the end of the list. + */ + LAST, +} + +/** + * Records timing, memory, or counts at specific points in the compiler's operation. + */ export interface PerfRecorder { - readonly enabled: boolean; + /** + * Set the current phase of compilation. + * + * Time spent in the previous phase will be accounted to that phase. The caller is responsible for + * exiting the phase when work that should be tracked within it is completed, and either returning + * to the previous phase or transitioning to the next one directly. + * + * In general, prefer using `inPhase()` to instrument a section of code, as it automatically + * handles entering and exiting the phase. `phase()` should only be used when the former API + * cannot be cleanly applied to a particular operation. + * + * @returns the previous phase + */ + phase(phase: PerfPhase): PerfPhase; + + /** + * Run `fn` in the given `PerfPhase` and return the result. + * + * Enters `phase` before executing the given `fn`, then exits the phase and returns the result. + * Prefer this API to `phase()` where possible. + */ + inPhase(phase: PerfPhase, fn: () => T): T; + + /** + * Record the memory usage of the compiler at the given checkpoint. + */ + memory(after: PerfCheckpoint): void; + + /** + * Record that a specific event has occurred, possibly more than once. + */ + eventCount(event: PerfEvent, incrementBy?: number): void; - mark(name: string, node?: DeclarationNode, category?: string, detail?: string): void; - start(name: string, node?: DeclarationNode, category?: string, detail?: string): number; - stop(span: number): void; + /** + * Return the `PerfRecorder` to an empty state (clear all tracked statistics) and reset the zero + * point to the current time. + */ + reset(): void; } diff --git a/packages/compiler-cli/src/ngtsc/perf/src/noop.ts b/packages/compiler-cli/src/ngtsc/perf/src/noop.ts index 73f4384ddee4..8d5c8e0a416e 100644 --- a/packages/compiler-cli/src/ngtsc/perf/src/noop.ts +++ b/packages/compiler-cli/src/ngtsc/perf/src/noop.ts @@ -5,15 +5,23 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {DeclarationNode} from '../../reflection'; +import {PerfPhase, PerfRecorder} from './api'; -import {PerfRecorder} from './api'; +class NoopPerfRecorder implements PerfRecorder { + eventCount(): void {} -export const NOOP_PERF_RECORDER: PerfRecorder = { - enabled: false, - mark: (name: string, node: DeclarationNode, category?: string, detail?: string): void => {}, - start: (name: string, node: DeclarationNode, category?: string, detail?: string): number => { - return 0; - }, - stop: (span: number|false): void => {}, -}; + memory(): void {} + + phase(): PerfPhase { + return PerfPhase.Unaccounted; + } + + inPhase(phase: PerfPhase, fn: () => T): T { + return fn(); + } + + reset(): void {} +} + + +export const NOOP_PERF_RECORDER: PerfRecorder = new NoopPerfRecorder(); diff --git a/packages/compiler-cli/src/ngtsc/perf/src/recorder.ts b/packages/compiler-cli/src/ngtsc/perf/src/recorder.ts new file mode 100644 index 000000000000..b35bf79ae00e --- /dev/null +++ b/packages/compiler-cli/src/ngtsc/perf/src/recorder.ts @@ -0,0 +1,154 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/// + +import {PerfCheckpoint, PerfEvent, PerfPhase, PerfRecorder} from './api'; +import {HrTime, mark, timeSinceInMicros} from './clock'; + +/** + * Serializable performance data for the compilation, using string names. + */ +export interface PerfResults { + events: Record; + phases: Record; + memory: Record; +} + +/** + * A `PerfRecorder` that actively tracks performance statistics. + */ +export class ActivePerfRecorder implements PerfRecorder { + private counters: number[]; + private phaseTime: number[]; + private bytes: number[]; + + private currentPhase = PerfPhase.Unaccounted; + private currentPhaseEntered = this.zeroTime; + + /** + * Creates an `ActivePerfRecoder` with its zero point set to the current time. + */ + static zeroedToNow(): ActivePerfRecorder { + return new ActivePerfRecorder(mark()); + } + + private constructor(private zeroTime: HrTime) { + this.counters = Array(PerfEvent.LAST).fill(0); + this.phaseTime = Array(PerfPhase.LAST).fill(0); + this.bytes = Array(PerfCheckpoint.LAST).fill(0); + + // Take an initial memory snapshot before any other compilation work begins. + this.memory(PerfCheckpoint.Initial); + } + + reset(): void { + this.counters = Array(PerfEvent.LAST).fill(0); + this.phaseTime = Array(PerfPhase.LAST).fill(0); + this.bytes = Array(PerfCheckpoint.LAST).fill(0); + this.zeroTime = mark(); + this.currentPhase = PerfPhase.Unaccounted; + this.currentPhaseEntered = this.zeroTime; + } + + memory(after: PerfCheckpoint): void { + this.bytes[after] = process.memoryUsage().heapUsed; + } + + phase(phase: PerfPhase): PerfPhase { + const previous = this.currentPhase; + this.phaseTime[this.currentPhase] += timeSinceInMicros(this.currentPhaseEntered); + this.currentPhase = phase; + this.currentPhaseEntered = mark(); + return previous; + } + + inPhase(phase: PerfPhase, fn: () => T): T { + const previousPhase = this.phase(phase); + try { + return fn(); + } finally { + this.phase(previousPhase); + } + } + + eventCount(counter: PerfEvent, incrementBy: number = 1): void { + this.counters[counter] += incrementBy; + } + + /** + * Return the current performance metrics as a serializable object. + */ + finalize(): PerfResults { + // Track the last segment of time spent in `this.currentPhase` in the time array. + this.phase(PerfPhase.Unaccounted); + + const results: PerfResults = { + events: {}, + phases: {}, + memory: {}, + }; + + for (let i = 0; i < this.phaseTime.length; i++) { + if (this.phaseTime[i] > 0) { + results.phases[PerfPhase[i]] = this.phaseTime[i]; + } + } + + for (let i = 0; i < this.phaseTime.length; i++) { + if (this.counters[i] > 0) { + results.events[PerfEvent[i]] = this.counters[i]; + } + } + + for (let i = 0; i < this.bytes.length; i++) { + if (this.bytes[i] > 0) { + results.memory[PerfCheckpoint[i]] = this.bytes[i]; + } + } + + return results; + } +} + +/** + * A `PerfRecorder` that delegates to a target `PerfRecorder` which can be updated later. + * + * `DelegatingPerfRecorder` is useful when a compiler class that needs a `PerfRecorder` can outlive + * the current compilation. This is true for most compiler classes as resource-only changes reuse + * the same `NgCompiler` for a new compilation. + */ +export class DelegatingPerfRecorder implements PerfRecorder { + constructor(public target: PerfRecorder) {} + + eventCount(counter: PerfEvent, incrementBy?: number): void { + this.target.eventCount(counter, incrementBy); + } + + phase(phase: PerfPhase): PerfPhase { + return this.target.phase(phase); + } + + inPhase(phase: PerfPhase, fn: () => T): T { + // Note: this doesn't delegate to `this.target.inPhase` but instead is implemented manually here + // to avoid adding an additional frame of noise to the stack when debugging. + const previousPhase = this.target.phase(phase); + try { + return fn(); + } finally { + this.target.phase(previousPhase); + } + } + + memory(after: PerfCheckpoint): void { + this.target.memory(after); + } + + reset(): void { + this.target.reset(); + } +} diff --git a/packages/compiler-cli/src/ngtsc/perf/src/tracking.ts b/packages/compiler-cli/src/ngtsc/perf/src/tracking.ts deleted file mode 100644 index 732c8f03671e..000000000000 --- a/packages/compiler-cli/src/ngtsc/perf/src/tracking.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/// -import * as fs from 'fs'; -import * as ts from 'typescript'; -import {resolve} from '../../file_system'; -import {DeclarationNode} from '../../reflection'; -import {PerfRecorder} from './api'; -import {HrTime, mark, timeSinceInMicros} from './clock'; - -export class PerfTracker implements PerfRecorder { - private nextSpanId = 1; - private log: PerfLogEvent[] = []; - - readonly enabled = true; - - private constructor(private zeroTime: HrTime) {} - - static zeroedToNow(): PerfTracker { - return new PerfTracker(mark()); - } - - mark(name: string, node?: DeclarationNode, category?: string, detail?: string): void { - const msg = this.makeLogMessage(PerfLogEventType.MARK, name, node, category, detail, undefined); - this.log.push(msg); - } - - start(name: string, node?: DeclarationNode, category?: string, detail?: string): number { - const span = this.nextSpanId++; - const msg = this.makeLogMessage(PerfLogEventType.SPAN_OPEN, name, node, category, detail, span); - this.log.push(msg); - return span; - } - - stop(span: number): void { - this.log.push({ - type: PerfLogEventType.SPAN_CLOSE, - span, - stamp: timeSinceInMicros(this.zeroTime), - }); - } - - private makeLogMessage( - type: PerfLogEventType, name: string, node: DeclarationNode|undefined, - category: string|undefined, detail: string|undefined, span: number|undefined): PerfLogEvent { - const msg: PerfLogEvent = { - type, - name, - stamp: timeSinceInMicros(this.zeroTime), - }; - if (category !== undefined) { - msg.category = category; - } - if (detail !== undefined) { - msg.detail = detail; - } - if (span !== undefined) { - msg.span = span; - } - if (node !== undefined) { - msg.file = node.getSourceFile().fileName; - if (!ts.isSourceFile(node)) { - const name = ts.getNameOfDeclaration(node); - if (name !== undefined && ts.isIdentifier(name)) { - msg.declaration = name.text; - } - } - } - return msg; - } - - asJson(): unknown { - return this.log; - } - - serializeToFile(target: string, host: ts.CompilerHost): void { - const json = JSON.stringify(this.log, null, 2); - - if (target.startsWith('ts:')) { - target = target.substr('ts:'.length); - const outFile = resolve(host.getCurrentDirectory(), target); - host.writeFile(outFile, json, false); - } else { - const outFile = resolve(host.getCurrentDirectory(), target); - fs.writeFileSync(outFile, json); - } - } -} - -export interface PerfLogEvent { - name?: string; - span?: number; - file?: string; - declaration?: string; - type: PerfLogEventType; - category?: string; - detail?: string; - stamp: number; -} - -export enum PerfLogEventType { - SPAN_OPEN, - SPAN_CLOSE, - MARK, -} diff --git a/packages/compiler-cli/src/ngtsc/program.ts b/packages/compiler-cli/src/ngtsc/program.ts index 28345f581042..1eb8ae18e7d1 100644 --- a/packages/compiler-cli/src/ngtsc/program.ts +++ b/packages/compiler-cli/src/ngtsc/program.ts @@ -14,10 +14,10 @@ import {verifySupportedTypeScriptVersion} from '../typescript_support'; import {CompilationTicket, freshCompilationTicket, incrementalFromCompilerTicket, NgCompiler, NgCompilerHost} from './core'; import {NgCompilerOptions} from './core/api'; -import {absoluteFrom, AbsoluteFsPath} from './file_system'; +import {absoluteFrom, AbsoluteFsPath, getFileSystem} from './file_system'; import {TrackedIncrementalBuildStrategy} from './incremental'; import {IndexedComponent} from './indexer'; -import {NOOP_PERF_RECORDER, PerfRecorder, PerfTracker} from './perf'; +import {ActivePerfRecorder, PerfCheckpoint as PerfCheckpoint, PerfEvent, PerfPhase} from './perf'; import {DeclarationNode} from './reflection'; import {retagAllTsFiles, untagAllTsFiles} from './shims'; import {ReusedProgramStrategy} from './typecheck'; @@ -54,22 +54,20 @@ export class NgtscProgram implements api.Program { private reuseTsProgram: ts.Program; private closureCompilerEnabled: boolean; private host: NgCompilerHost; - private perfRecorder: PerfRecorder = NOOP_PERF_RECORDER; - private perfTracker: PerfTracker|null = null; private incrementalStrategy: TrackedIncrementalBuildStrategy; constructor( rootNames: ReadonlyArray, private options: NgCompilerOptions, delegateHost: api.CompilerHost, oldProgram?: NgtscProgram) { + const perfRecorder = ActivePerfRecorder.zeroedToNow(); + + perfRecorder.phase(PerfPhase.Setup); + // First, check whether the current TS version is supported. if (!options.disableTypeScriptVersionCheck) { verifySupportedTypeScriptVersion(); } - if (options.tracePerformance !== undefined) { - this.perfTracker = PerfTracker.zeroedToNow(); - this.perfRecorder = this.perfTracker; - } this.closureCompilerEnabled = !!options.annotateForClosureCompiler; const reuseProgram = oldProgram?.reuseTsProgram; @@ -83,9 +81,14 @@ export class NgtscProgram implements api.Program { retagAllTsFiles(reuseProgram); } - this.tsProgram = ts.createProgram(this.host.inputFiles, options, this.host, reuseProgram); + this.tsProgram = perfRecorder.inPhase( + PerfPhase.TypeScriptProgramCreate, + () => ts.createProgram(this.host.inputFiles, options, this.host, reuseProgram)); this.reuseTsProgram = this.tsProgram; + perfRecorder.phase(PerfPhase.Unaccounted); + perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate); + this.host.postProgramCreationCleanup(); // Shim tagging has served its purpose, and tags can now be removed from all `ts.SourceFile`s in @@ -111,7 +114,7 @@ export class NgtscProgram implements api.Program { let ticket: CompilationTicket; if (oldProgram === undefined) { ticket = freshCompilationTicket( - this.tsProgram, options, this.incrementalStrategy, reusedProgramStrategy, + this.tsProgram, options, this.incrementalStrategy, reusedProgramStrategy, perfRecorder, /* enableTemplateTypeChecker */ false, /* usePoisonedData */ false); } else { ticket = incrementalFromCompilerTicket( @@ -120,12 +123,13 @@ export class NgtscProgram implements api.Program { this.incrementalStrategy, reusedProgramStrategy, modifiedResourceFiles, + perfRecorder, ); } // Create the NgCompiler which will drive the rest of the compilation. - this.compiler = NgCompiler.fromTicket(ticket, this.host, this.perfRecorder); + this.compiler = NgCompiler.fromTicket(ticket, this.host); } getTsProgram(): ts.Program { @@ -138,49 +142,59 @@ export class NgtscProgram implements api.Program { getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken| undefined): readonly ts.Diagnostic[] { - return this.tsProgram.getOptionsDiagnostics(cancellationToken); + return this.compiler.perfRecorder.inPhase( + PerfPhase.TypeScriptDiagnostics, + () => this.tsProgram.getOptionsDiagnostics(cancellationToken)); } getTsSyntacticDiagnostics( sourceFile?: ts.SourceFile|undefined, cancellationToken?: ts.CancellationToken|undefined): readonly ts.Diagnostic[] { - const ignoredFiles = this.compiler.ignoreForDiagnostics; - if (sourceFile !== undefined) { - if (ignoredFiles.has(sourceFile)) { - return []; - } + return this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptDiagnostics, () => { + const ignoredFiles = this.compiler.ignoreForDiagnostics; + let res: readonly ts.Diagnostic[]; + if (sourceFile !== undefined) { + if (ignoredFiles.has(sourceFile)) { + return []; + } - return this.tsProgram.getSyntacticDiagnostics(sourceFile, cancellationToken); - } else { - const diagnostics: ts.Diagnostic[] = []; - for (const sf of this.tsProgram.getSourceFiles()) { - if (!ignoredFiles.has(sf)) { - diagnostics.push(...this.tsProgram.getSyntacticDiagnostics(sf, cancellationToken)); + res = this.tsProgram.getSyntacticDiagnostics(sourceFile, cancellationToken); + } else { + const diagnostics: ts.Diagnostic[] = []; + for (const sf of this.tsProgram.getSourceFiles()) { + if (!ignoredFiles.has(sf)) { + diagnostics.push(...this.tsProgram.getSyntacticDiagnostics(sf, cancellationToken)); + } } + res = diagnostics; } - return diagnostics; - } + return res; + }); } getTsSemanticDiagnostics( sourceFile?: ts.SourceFile|undefined, cancellationToken?: ts.CancellationToken|undefined): readonly ts.Diagnostic[] { - const ignoredFiles = this.compiler.ignoreForDiagnostics; - if (sourceFile !== undefined) { - if (ignoredFiles.has(sourceFile)) { - return []; - } + return this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptDiagnostics, () => { + const ignoredFiles = this.compiler.ignoreForDiagnostics; + let res: readonly ts.Diagnostic[]; + if (sourceFile !== undefined) { + if (ignoredFiles.has(sourceFile)) { + return []; + } - return this.tsProgram.getSemanticDiagnostics(sourceFile, cancellationToken); - } else { - const diagnostics: ts.Diagnostic[] = []; - for (const sf of this.tsProgram.getSourceFiles()) { - if (!ignoredFiles.has(sf)) { - diagnostics.push(...this.tsProgram.getSemanticDiagnostics(sf, cancellationToken)); + res = this.tsProgram.getSemanticDiagnostics(sourceFile, cancellationToken); + } else { + const diagnostics: ts.Diagnostic[] = []; + for (const sf of this.tsProgram.getSourceFiles()) { + if (!ignoredFiles.has(sf)) { + diagnostics.push(...this.tsProgram.getSemanticDiagnostics(sf, cancellationToken)); + } } + res = diagnostics; } - return diagnostics; - } + return res; + }); } getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken| @@ -235,73 +249,82 @@ export class NgtscProgram implements api.Program { emitCallback?: api.TsEmitCallback | undefined; mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback | undefined; }|undefined): ts.EmitResult { - const {transformers} = this.compiler.prepareEmit(); - const ignoreFiles = this.compiler.ignoreForEmit; - const emitCallback = opts && opts.emitCallback || defaultEmitCallback; - - const writeFile: ts.WriteFileCallback = - (fileName: string, data: string, writeByteOrderMark: boolean, - onError: ((message: string) => void)|undefined, - sourceFiles: ReadonlyArray|undefined) => { - if (sourceFiles !== undefined) { - // Record successful writes for any `ts.SourceFile` (that's not a declaration file) - // that's an input to this write. - for (const writtenSf of sourceFiles) { - if (writtenSf.isDeclarationFile) { - continue; + this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit); + + const res = this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptEmit, () => { + const {transformers} = this.compiler.prepareEmit(); + const ignoreFiles = this.compiler.ignoreForEmit; + const emitCallback = opts && opts.emitCallback || defaultEmitCallback; + + const writeFile: ts.WriteFileCallback = + (fileName: string, data: string, writeByteOrderMark: boolean, + onError: ((message: string) => void)|undefined, + sourceFiles: ReadonlyArray|undefined) => { + if (sourceFiles !== undefined) { + // Record successful writes for any `ts.SourceFile` (that's not a declaration file) + // that's an input to this write. + for (const writtenSf of sourceFiles) { + if (writtenSf.isDeclarationFile) { + continue; + } + + this.compiler.incrementalDriver.recordSuccessfulEmit(writtenSf); } - - this.compiler.incrementalDriver.recordSuccessfulEmit(writtenSf); } - } - this.host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); - }; + this.host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); + }; - const customTransforms = opts && opts.customTransformers; - const beforeTransforms = transformers.before || []; - const afterDeclarationsTransforms = transformers.afterDeclarations; + const customTransforms = opts && opts.customTransformers; + const beforeTransforms = transformers.before || []; + const afterDeclarationsTransforms = transformers.afterDeclarations; - if (customTransforms !== undefined && customTransforms.beforeTs !== undefined) { - beforeTransforms.push(...customTransforms.beforeTs); - } + if (customTransforms !== undefined && customTransforms.beforeTs !== undefined) { + beforeTransforms.push(...customTransforms.beforeTs); + } - const emitSpan = this.perfRecorder.start('emit'); - const emitResults: ts.EmitResult[] = []; + const emitResults: ts.EmitResult[] = []; - for (const targetSourceFile of this.tsProgram.getSourceFiles()) { - if (targetSourceFile.isDeclarationFile || ignoreFiles.has(targetSourceFile)) { - continue; - } + for (const targetSourceFile of this.tsProgram.getSourceFiles()) { + if (targetSourceFile.isDeclarationFile || ignoreFiles.has(targetSourceFile)) { + continue; + } + + if (this.compiler.incrementalDriver.safeToSkipEmit(targetSourceFile)) { + this.compiler.perfRecorder.eventCount(PerfEvent.EmitSkipSourceFile); + continue; + } - if (this.compiler.incrementalDriver.safeToSkipEmit(targetSourceFile)) { - continue; + this.compiler.perfRecorder.eventCount(PerfEvent.EmitSourceFile); + + emitResults.push(emitCallback({ + targetSourceFile, + program: this.tsProgram, + host: this.host, + options: this.options, + emitOnlyDtsFiles: false, + writeFile, + customTransformers: { + before: beforeTransforms, + after: customTransforms && customTransforms.afterTs, + afterDeclarations: afterDeclarationsTransforms, + } as any, + })); } - const fileEmitSpan = this.perfRecorder.start('emitFile', targetSourceFile); - emitResults.push(emitCallback({ - targetSourceFile, - program: this.tsProgram, - host: this.host, - options: this.options, - emitOnlyDtsFiles: false, - writeFile, - customTransformers: { - before: beforeTransforms, - after: customTransforms && customTransforms.afterTs, - afterDeclarations: afterDeclarationsTransforms, - } as any, - })); - this.perfRecorder.stop(fileEmitSpan); - } + this.compiler.perfRecorder.memory(PerfCheckpoint.Emit); - this.perfRecorder.stop(emitSpan); + // Run the emit, including a custom transformer that will downlevel the Ivy decorators in + // code. + return ((opts && opts.mergeEmitResultsCallback) || mergeEmitResults)(emitResults); + }); - if (this.perfTracker !== null && this.options.tracePerformance !== undefined) { - this.perfTracker.serializeToFile(this.options.tracePerformance, this.host); + // Record performance analysis information to disk if we've been asked to do so. + if (this.options.tracePerformance !== undefined) { + const perf = this.compiler.perfRecorder.finalize(); + getFileSystem().writeFile( + getFileSystem().resolve(this.options.tracePerformance), JSON.stringify(perf, null, 2)); } - - // Run the emit, including a custom transformer that will downlevel the Ivy decorators in code. - return ((opts && opts.mergeEmitResultsCallback) || mergeEmitResults)(emitResults); + return res; } getIndexedComponents(): Map { diff --git a/packages/compiler-cli/src/ngtsc/testing/fake_common/index.ts b/packages/compiler-cli/src/ngtsc/testing/fake_common/index.ts index 5d49dd7a8a0e..c32be348b147 100644 --- a/packages/compiler-cli/src/ngtsc/testing/fake_common/index.ts +++ b/packages/compiler-cli/src/ngtsc/testing/fake_common/index.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {NgIterable, TemplateRef, ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta, ɵɵPipeDefWithMeta} from '@angular/core'; +import {NgIterable, TemplateRef, ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration, ɵɵPipeDeclaration} from '@angular/core'; export interface NgForOfContext> { $implicit: T; @@ -36,7 +36,7 @@ export declare class NgForOf> { ngForTrackBy: TrackByFunction; ngForTemplate: TemplateRef>; - static ɵdir: ɵɵDirectiveDefWithMeta < NgForOf, '[ngFor][ngForOf]', never, { + static ɵdir: ɵɵDirectiveDeclaration < NgForOf, '[ngFor][ngForOf]', never, { 'ngForOf': 'ngForOf'; 'ngForTrackBy': 'ngForTrackBy'; 'ngForTemplate': 'ngForTemplate'; @@ -50,7 +50,7 @@ export declare class NgIf { ngIf: T; ngIfThen: TemplateRef>|null; ngIfElse: TemplateRef>|null; - static ɵdir: ɵɵDirectiveDefWithMeta < NgIf, '[ngIf]', never, { + static ɵdir: ɵɵDirectiveDeclaration < NgIf, '[ngIf]', never, { 'ngIf': 'ngIf'; 'ngIfThen': 'ngIfThen'; 'ngIfElse': 'ngIfElse'; @@ -64,7 +64,7 @@ export declare class NgTemplateOutlet { ngTemplateOutlet: TemplateRef|null; ngTemplateOutletContext: Object|null; - static ɵdir: ɵɵDirectiveDefWithMeta < NgTemplateOutlet, '[ngTemplateOutlet]', never, { + static ɵdir: ɵɵDirectiveDeclaration < NgTemplateOutlet, '[ngTemplateOutlet]', never, { 'ngTemplateOutlet': 'ngTemplateOutlet'; 'ngTemplateOutletContext': 'ngTemplateOutletContext'; } @@ -80,11 +80,11 @@ export declare class DatePipe { transform( value: Date|string|number|null|undefined, format?: string, timezone?: string, locale?: string): string|null; - static ɵpipe: ɵɵPipeDefWithMeta; + static ɵpipe: ɵɵPipeDeclaration; } export declare class CommonModule { - static ɵmod: ɵɵNgModuleDefWithMeta< + static ɵmod: ɵɵNgModuleDeclaration< CommonModule, [typeof NgForOf, typeof NgIf, typeof DatePipe, typeof NgTemplateOutlet], never, [typeof NgForOf, typeof NgIf, typeof DatePipe, typeof NgTemplateOutlet]>; } diff --git a/packages/compiler-cli/src/ngtsc/testing/fake_core/index.ts b/packages/compiler-cli/src/ngtsc/testing/fake_core/index.ts index f7a7b43eaaf9..35fe9a25755e 100644 --- a/packages/compiler-cli/src/ngtsc/testing/fake_core/index.ts +++ b/packages/compiler-cli/src/ngtsc/testing/fake_core/index.ts @@ -70,9 +70,10 @@ export interface SimpleChanges { [propName: string]: any; } -export type ɵɵNgModuleDefWithMeta = any; -export type ɵɵDirectiveDefWithMeta = any; -export type ɵɵPipeDefWithMeta = any; +export type ɵɵNgModuleDeclaration = unknown; +export type ɵɵDirectiveDeclaration = + unknown; +export type ɵɵPipeDeclaration = unknown; export enum ViewEncapsulation { Emulated = 0, diff --git a/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts b/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts index d3bae1c54aea..d26059c9b61f 100644 --- a/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts +++ b/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts @@ -13,7 +13,7 @@ import {ErrorCode, FatalDiagnosticError} from '../../diagnostics'; import {IncrementalBuild} from '../../incremental/api'; import {SemanticDepGraphUpdater, SemanticSymbol} from '../../incremental/semantic_graph'; import {IndexingContext} from '../../indexer'; -import {PerfRecorder} from '../../perf'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, DeclarationNode, Decorator, ReflectionHost} from '../../reflection'; import {ProgramTypeCheckAdapter, TypeCheckContext} from '../../typecheck/api'; import {getSourceFile, isExported} from '../../util/src/typescript'; @@ -124,6 +124,9 @@ export class TraitCompiler implements ProgramTypeCheckAdapter { this.adopt(priorRecord); } + this.perf.eventCount(PerfEvent.SourceFileReuseAnalysis); + this.perf.eventCount(PerfEvent.TraitReuseAnalysis, priorWork.length); + // Skip the rest of analysis, as this file's prior traits are being reused. return; } @@ -359,6 +362,8 @@ export class TraitCompiler implements ProgramTypeCheckAdapter { TraitState[trait.state]} (expected DETECTED)`); } + this.perf.eventCount(PerfEvent.TraitAnalyze); + // Attempt analysis. This could fail with a `FatalDiagnosticError`; catch it if it does. let result: AnalysisOutput; try { @@ -509,9 +514,6 @@ export class TraitCompiler implements ProgramTypeCheckAdapter { continue; } - const compileSpan = this.perf.start('compileClass', original); - - // `trait.resolution` is non-null asserted here because TypeScript does not recognize that // `Readonly` is nullable (as `unknown` itself is nullable) due to the way that // `Readonly` works. @@ -526,7 +528,6 @@ export class TraitCompiler implements ProgramTypeCheckAdapter { } const compileMatchRes = compileRes; - this.perf.stop(compileSpan); if (Array.isArray(compileMatchRes)) { for (const result of compileMatchRes) { if (!res.some(r => r.name === result.name)) { diff --git a/packages/compiler-cli/src/ngtsc/transform/src/transform.ts b/packages/compiler-cli/src/ngtsc/transform/src/transform.ts index 9dbeb1279fa2..c9a0d7bd10cf 100644 --- a/packages/compiler-cli/src/ngtsc/transform/src/transform.ts +++ b/packages/compiler-cli/src/ngtsc/transform/src/transform.ts @@ -10,6 +10,7 @@ import {ConstantPool} from '@angular/compiler'; import * as ts from 'typescript'; import {DefaultImportRecorder, ImportRewriter} from '../../imports'; +import {PerfPhase, PerfRecorder} from '../../perf'; import {Decorator, ReflectionHost} from '../../reflection'; import {ImportManager, RecordWrappedNodeExprFn, translateExpression, translateStatement, TranslatorOptions} from '../../translator'; import {visit, VisitListEntryResult, Visitor} from '../../util/src/visitor'; @@ -33,14 +34,16 @@ interface FileOverviewMeta { export function ivyTransformFactory( compilation: TraitCompiler, reflector: ReflectionHost, importRewriter: ImportRewriter, - defaultImportRecorder: DefaultImportRecorder, isCore: boolean, + defaultImportRecorder: DefaultImportRecorder, perf: PerfRecorder, isCore: boolean, isClosureCompilerEnabled: boolean): ts.TransformerFactory { const recordWrappedNodeExpr = createRecorderFn(defaultImportRecorder); return (context: ts.TransformationContext): ts.Transformer => { return (file: ts.SourceFile): ts.SourceFile => { - return transformIvySourceFile( - compilation, context, reflector, importRewriter, file, isCore, isClosureCompilerEnabled, - recordWrappedNodeExpr); + return perf.inPhase( + PerfPhase.Compile, + () => transformIvySourceFile( + compilation, context, reflector, importRewriter, file, isCore, + isClosureCompilerEnabled, recordWrappedNodeExpr)); }; }; } diff --git a/packages/compiler-cli/src/ngtsc/tsc_plugin.ts b/packages/compiler-cli/src/ngtsc/tsc_plugin.ts index e6ae2920caf6..292c472a19e4 100644 --- a/packages/compiler-cli/src/ngtsc/tsc_plugin.ts +++ b/packages/compiler-cli/src/ngtsc/tsc_plugin.ts @@ -12,7 +12,7 @@ import {CompilationTicket, freshCompilationTicket, incrementalFromDriverTicket, import {NgCompilerOptions, UnifiedModulesHost} from './core/api'; import {NodeJSFileSystem, setFileSystem} from './file_system'; import {PatchedProgramIncrementalBuildStrategy} from './incremental'; -import {NOOP_PERF_RECORDER} from './perf'; +import {ActivePerfRecorder, NOOP_PERF_RECORDER, PerfPhase} from './perf'; import {untagAllTsFiles} from './shims'; import {OptimizeFor} from './typecheck/api'; import {ReusedProgramStrategy} from './typecheck/src/augmented_program'; @@ -94,6 +94,13 @@ export class NgTscPlugin implements TscPlugin { ignoreForDiagnostics: Set, ignoreForEmit: Set, } { + // TODO(alxhub): we provide a `PerfRecorder` to the compiler, but because we're not driving the + // compilation, the information captured within it is incomplete, and may not include timings + // for phases such as emit. + // + // Additionally, nothing actually captures the perf results here, so recording stats at all is + // somewhat moot for now :) + const perfRecorder = ActivePerfRecorder.zeroedToNow(); if (this.host === null || this.options === null) { throw new Error('Lifecycle error: setupCompilation() before wrapHost().'); } @@ -115,15 +122,15 @@ export class NgTscPlugin implements TscPlugin { if (oldProgram === undefined || oldDriver === null) { ticket = freshCompilationTicket( - program, this.options, strategy, typeCheckStrategy, + program, this.options, strategy, typeCheckStrategy, perfRecorder, /* enableTemplateTypeChecker */ false, /* usePoisonedData */ false); } else { strategy.toNextBuildStrategy().getIncrementalDriver(oldProgram); ticket = incrementalFromDriverTicket( oldProgram, oldDriver, program, this.options, strategy, typeCheckStrategy, - modifiedResourceFiles, false, false); + modifiedResourceFiles, perfRecorder, false, false); } - this._compiler = NgCompiler.fromTicket(ticket, this.host, NOOP_PERF_RECORDER); + this._compiler = NgCompiler.fromTicket(ticket, this.host); return { ignoreForDiagnostics: this._compiler.ignoreForDiagnostics, ignoreForEmit: this._compiler.ignoreForEmit, @@ -146,6 +153,9 @@ export class NgTscPlugin implements TscPlugin { } createTransformers(): ts.CustomTransformers { + // The plugin consumer doesn't know about our perf tracing system, so we consider the emit phase + // as beginning now. + this.compiler.perfRecorder.phase(PerfPhase.TypeScriptEmit); return this.compiler.prepareEmit().transformers; } } diff --git a/packages/compiler-cli/src/ngtsc/typecheck/BUILD.bazel b/packages/compiler-cli/src/ngtsc/typecheck/BUILD.bazel index f1553346ed97..a258bcd9be12 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/typecheck/BUILD.bazel @@ -15,6 +15,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/imports", "//packages/compiler-cli/src/ngtsc/incremental:api", "//packages/compiler-cli/src/ngtsc/metadata", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/scope", "//packages/compiler-cli/src/ngtsc/shims", diff --git a/packages/compiler-cli/src/ngtsc/typecheck/api/api.ts b/packages/compiler-cli/src/ngtsc/typecheck/api/api.ts index 81b8c998e9a1..8f3c5a7d0750 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/api/api.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/api/api.ts @@ -275,6 +275,20 @@ export interface TypeCheckingConfig { * inlining, this must be set to `false`. */ useInlineTypeConstructors: boolean; + + /** + * Whether or not to produce diagnostic suggestions in cases where the compiler could have + * inferred a better type for a construct, but was prevented from doing so by the current type + * checking configuration. + * + * For example, if the compiler could have used a template context guard to infer a better type + * for a structural directive's context and `let-` variables, but the user is in + * `fullTemplateTypeCheck` mode and such guards are therefore disabled. + * + * This mode is useful for clients like the Language Service which want to inform users of + * opportunities to improve their own developer experience. + */ + suggestionsForSuboptimalTypeInference: boolean; } diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts index 2cbad7db1716..92ba82b43fde 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts @@ -12,6 +12,7 @@ import * as ts from 'typescript'; import {absoluteFrom, absoluteFromSourceFile, AbsoluteFsPath, getSourceFileOrError} from '../../file_system'; import {Reference, ReferenceEmitter} from '../../imports'; import {IncrementalBuild} from '../../incremental/api'; +import {PerfCheckpoint, PerfEvent, PerfPhase, PerfRecorder} from '../../perf'; import {ClassDeclaration, isNamedClassDeclaration, ReflectionHost} from '../../reflection'; import {ComponentScopeReader, TypeCheckScopeRegistry} from '../../scope'; import {isShim} from '../../shims'; @@ -82,7 +83,8 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { private compilerHost: Pick, private priorBuild: IncrementalBuild, private readonly componentScopeReader: ComponentScopeReader, - private readonly typeCheckScopeRegistry: TypeCheckScopeRegistry) {} + private readonly typeCheckScopeRegistry: TypeCheckScopeRegistry, + private readonly perf: PerfRecorder) {} getTemplate(component: ts.ClassDeclaration): TmplAstNode[]|null { const {data} = this.getLatestComponentState(component); @@ -181,69 +183,73 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { break; } - const sfPath = absoluteFromSourceFile(sf); - const fileRecord = this.state.get(sfPath)!; + return this.perf.inPhase(PerfPhase.TtcDiagnostics, () => { + const sfPath = absoluteFromSourceFile(sf); + const fileRecord = this.state.get(sfPath)!; - const typeCheckProgram = this.typeCheckingStrategy.getProgram(); + const typeCheckProgram = this.typeCheckingStrategy.getProgram(); - const diagnostics: (ts.Diagnostic|null)[] = []; - if (fileRecord.hasInlines) { - const inlineSf = getSourceFileOrError(typeCheckProgram, sfPath); - diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(inlineSf).map( - diag => convertDiagnostic(diag, fileRecord.sourceManager))); - } + const diagnostics: (ts.Diagnostic|null)[] = []; + if (fileRecord.hasInlines) { + const inlineSf = getSourceFileOrError(typeCheckProgram, sfPath); + diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(inlineSf).map( + diag => convertDiagnostic(diag, fileRecord.sourceManager))); + } - for (const [shimPath, shimRecord] of fileRecord.shimData) { - const shimSf = getSourceFileOrError(typeCheckProgram, shimPath); - diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map( - diag => convertDiagnostic(diag, fileRecord.sourceManager))); - diagnostics.push(...shimRecord.genesisDiagnostics); + for (const [shimPath, shimRecord] of fileRecord.shimData) { + const shimSf = getSourceFileOrError(typeCheckProgram, shimPath); + diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map( + diag => convertDiagnostic(diag, fileRecord.sourceManager))); + diagnostics.push(...shimRecord.genesisDiagnostics); - for (const templateData of shimRecord.templates.values()) { - diagnostics.push(...templateData.templateDiagnostics); + for (const templateData of shimRecord.templates.values()) { + diagnostics.push(...templateData.templateDiagnostics); + } } - } - return diagnostics.filter((diag: ts.Diagnostic|null): diag is ts.Diagnostic => diag !== null); + return diagnostics.filter((diag: ts.Diagnostic|null): diag is ts.Diagnostic => diag !== null); + }); } getDiagnosticsForComponent(component: ts.ClassDeclaration): ts.Diagnostic[] { this.ensureShimForComponent(component); - const sf = component.getSourceFile(); - const sfPath = absoluteFromSourceFile(sf); - const shimPath = this.typeCheckingStrategy.shimPathForComponent(component); + return this.perf.inPhase(PerfPhase.TtcDiagnostics, () => { + const sf = component.getSourceFile(); + const sfPath = absoluteFromSourceFile(sf); + const shimPath = this.typeCheckingStrategy.shimPathForComponent(component); - const fileRecord = this.getFileData(sfPath); + const fileRecord = this.getFileData(sfPath); - if (!fileRecord.shimData.has(shimPath)) { - return []; - } + if (!fileRecord.shimData.has(shimPath)) { + return []; + } - const templateId = fileRecord.sourceManager.getTemplateId(component); - const shimRecord = fileRecord.shimData.get(shimPath)!; + const templateId = fileRecord.sourceManager.getTemplateId(component); + const shimRecord = fileRecord.shimData.get(shimPath)!; - const typeCheckProgram = this.typeCheckingStrategy.getProgram(); + const typeCheckProgram = this.typeCheckingStrategy.getProgram(); - const diagnostics: (TemplateDiagnostic|null)[] = []; - if (shimRecord.hasInlines) { - const inlineSf = getSourceFileOrError(typeCheckProgram, sfPath); - diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(inlineSf).map( - diag => convertDiagnostic(diag, fileRecord.sourceManager))); - } + const diagnostics: (TemplateDiagnostic|null)[] = []; + if (shimRecord.hasInlines) { + const inlineSf = getSourceFileOrError(typeCheckProgram, sfPath); + diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(inlineSf).map( + diag => convertDiagnostic(diag, fileRecord.sourceManager))); + } - const shimSf = getSourceFileOrError(typeCheckProgram, shimPath); - diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map( - diag => convertDiagnostic(diag, fileRecord.sourceManager))); - diagnostics.push(...shimRecord.genesisDiagnostics); + const shimSf = getSourceFileOrError(typeCheckProgram, shimPath); + diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map( + diag => convertDiagnostic(diag, fileRecord.sourceManager))); + diagnostics.push(...shimRecord.genesisDiagnostics); - for (const templateData of shimRecord.templates.values()) { - diagnostics.push(...templateData.templateDiagnostics); - } + for (const templateData of shimRecord.templates.values()) { + diagnostics.push(...templateData.templateDiagnostics); + } - return diagnostics.filter( - (diag: TemplateDiagnostic|null): diag is TemplateDiagnostic => - diag !== null && diag.templateId === templateId); + return diagnostics.filter( + (diag: TemplateDiagnostic|null): diag is TemplateDiagnostic => + diag !== null && diag.templateId === templateId); + }); } getTypeCheckBlock(component: ts.ClassDeclaration): ts.Node|null { @@ -256,7 +262,8 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { if (engine === null) { return null; } - return engine.getGlobalCompletions(context); + return this.perf.inPhase( + PerfPhase.TtcAutocompletion, () => engine.getGlobalCompletions(context)); } getExpressionCompletionLocation( @@ -266,7 +273,8 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { if (engine === null) { return null; } - return engine.getExpressionCompletionLocation(ast); + return this.perf.inPhase( + PerfPhase.TtcAutocompletion, () => engine.getExpressionCompletionLocation(ast)); } invalidateClass(clazz: ts.ClassDeclaration): void { @@ -318,6 +326,7 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { return; } + this.perf.eventCount(PerfEvent.ReuseTypeCheckFile); this.state.set(sfPath, previousResults); } @@ -326,50 +335,55 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { return; } - const host = new WholeProgramTypeCheckingHost(this); - const ctx = this.newContext(host); + this.perf.inPhase(PerfPhase.TcbGeneration, () => { + const host = new WholeProgramTypeCheckingHost(this); + const ctx = this.newContext(host); - for (const sf of this.originalProgram.getSourceFiles()) { - if (sf.isDeclarationFile || isShim(sf)) { - continue; - } + for (const sf of this.originalProgram.getSourceFiles()) { + if (sf.isDeclarationFile || isShim(sf)) { + continue; + } - this.maybeAdoptPriorResultsForFile(sf); + this.maybeAdoptPriorResultsForFile(sf); - const sfPath = absoluteFromSourceFile(sf); - const fileData = this.getFileData(sfPath); - if (fileData.isComplete) { - continue; - } + const sfPath = absoluteFromSourceFile(sf); + const fileData = this.getFileData(sfPath); + if (fileData.isComplete) { + continue; + } - this.typeCheckAdapter.typeCheck(sf, ctx); + this.typeCheckAdapter.typeCheck(sf, ctx); - fileData.isComplete = true; - } + fileData.isComplete = true; + } - this.updateFromContext(ctx); - this.isComplete = true; + this.updateFromContext(ctx); + this.isComplete = true; + }); } private ensureAllShimsForOneFile(sf: ts.SourceFile): void { - this.maybeAdoptPriorResultsForFile(sf); + this.perf.inPhase(PerfPhase.TcbGeneration, () => { + this.maybeAdoptPriorResultsForFile(sf); - const sfPath = absoluteFromSourceFile(sf); + const sfPath = absoluteFromSourceFile(sf); - const fileData = this.getFileData(sfPath); - if (fileData.isComplete) { - // All data for this file is present and accounted for already. - return; - } + const fileData = this.getFileData(sfPath); + if (fileData.isComplete) { + // All data for this file is present and accounted for already. + return; + } - const host = new SingleFileTypeCheckingHost(sfPath, fileData, this.typeCheckingStrategy, this); - const ctx = this.newContext(host); + const host = + new SingleFileTypeCheckingHost(sfPath, fileData, this.typeCheckingStrategy, this); + const ctx = this.newContext(host); - this.typeCheckAdapter.typeCheck(sf, ctx); + this.typeCheckAdapter.typeCheck(sf, ctx); - fileData.isComplete = true; + fileData.isComplete = true; - this.updateFromContext(ctx); + this.updateFromContext(ctx); + }); } private ensureShimForComponent(component: ts.ClassDeclaration): void { @@ -399,7 +413,7 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { InliningMode.Error; return new TypeCheckContextImpl( this.config, this.compilerHost, this.typeCheckingStrategy, this.refEmitter, this.reflector, - host, inlining); + host, inlining, this.perf); } /** @@ -428,8 +442,14 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { private updateFromContext(ctx: TypeCheckContextImpl): void { const updates = ctx.finalize(); - this.typeCheckingStrategy.updateFiles(updates, UpdateMode.Incremental); - this.priorBuild.recordSuccessfulTypeCheck(this.state); + return this.perf.inPhase(PerfPhase.TcbUpdateProgram, () => { + if (updates.size > 0) { + this.perf.eventCount(PerfEvent.UpdateTypeCheckProgram); + } + this.typeCheckingStrategy.updateFiles(updates, UpdateMode.Incremental); + this.priorBuild.recordSuccessfulTypeCheck(this.state); + this.perf.memory(PerfCheckpoint.TtcUpdateProgram); + }); } getFileData(path: AbsoluteFsPath): FileTypeCheckingData { @@ -450,7 +470,7 @@ export class TemplateTypeCheckerImpl implements TemplateTypeChecker { if (builder === null) { return null; } - return builder.getSymbol(node); + return this.perf.inPhase(PerfPhase.TtcSymbol, () => builder.getSymbol(node)); } private getOrCreateSymbolBuilder(component: ts.ClassDeclaration): SymbolBuilder|null { diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/context.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/context.ts index 42bc6b79e93d..b06bdcfce35f 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/context.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/context.ts @@ -12,6 +12,7 @@ import * as ts from 'typescript'; import {absoluteFromSourceFile, AbsoluteFsPath} from '../../file_system'; import {NoopImportRewriter, Reference, ReferenceEmitter} from '../../imports'; +import {PerfEvent, PerfRecorder} from '../../perf'; import {ClassDeclaration, ReflectionHost} from '../../reflection'; import {ImportManager} from '../../translator'; import {ComponentToShimMappingStrategy, TemplateId, TemplateSourceMapping, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata} from '../api'; @@ -179,7 +180,7 @@ export class TypeCheckContextImpl implements TypeCheckContext { private compilerHost: Pick, private componentMappingStrategy: ComponentToShimMappingStrategy, private refEmitter: ReferenceEmitter, private reflector: ReflectionHost, - private host: TypeCheckingHost, private inlining: InliningMode) { + private host: TypeCheckingHost, private inlining: InliningMode, private perf: PerfRecorder) { if (inlining === InliningMode.Error && config.useInlineTypeConstructors) { // We cannot use inlining for type checking since this environment does not support it. throw new Error(`AssertionError: invalid inlining configuration.`); @@ -273,6 +274,7 @@ export class TypeCheckContextImpl implements TypeCheckContext { shimData.oobRecorder.requiresInlineTcb(templateId, ref.node); // Checking this template would be unsupported, so don't try. + this.perf.eventCount(PerfEvent.SkipGenerateTcbNoInline); return; } @@ -282,6 +284,7 @@ export class TypeCheckContextImpl implements TypeCheckContext { pipes, schemas, }; + this.perf.eventCount(PerfEvent.GenerateTcb); if (tcbRequiresInline) { // This class didn't meet the requirements for external type checking, so generate an inline // TCB for the class. diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/oob.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/oob.ts index aaec8d792774..446debb4ee2d 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/oob.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/oob.ts @@ -68,6 +68,12 @@ export interface OutOfBandDiagnosticRecorder { requiresInlineTypeConstructors( templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void; + + /** + * Report a warning when structural directives support context guards, but the current + * type-checking configuration prohibits their usage. + */ + suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void; } export class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecorder { @@ -174,6 +180,37 @@ export class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecor directives.map( dir => makeRelatedInformation(dir.name, `Requires an inline type constructor.`)))); } + + suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void { + const mapping = this.resolver.getSourceMapping(templateId); + + // Select one of the template variables that's most suitable for reporting the diagnostic. Any + // variable will do, but prefer one bound to the context's $implicit if present. + let diagnosticVar: TmplAstVariable|null = null; + for (const variable of variables) { + if (diagnosticVar === null || (variable.value === '' || variable.value === '$implicit')) { + diagnosticVar = variable; + } + } + if (diagnosticVar === null) { + // There is no variable on which to report the diagnostic. + return; + } + + let varIdentification = `'${diagnosticVar.name}'`; + if (variables.length === 2) { + varIdentification += ` (and 1 other)`; + } else if (variables.length > 2) { + varIdentification += ` (and ${variables.length - 1} others)`; + } + const message = + `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${ + varIdentification} will have type 'any' as a result.\n\nConsider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`; + + this._diagnostics.push(makeTemplateDiagnostic( + templateId, mapping, diagnosticVar.keySpan, ts.DiagnosticCategory.Suggestion, + ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message)); + } } function makeInlineDiagnostic( diff --git a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts index 6a6a6abdad93..bf384afc4523 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts @@ -286,11 +286,20 @@ class TcbTemplateBodyOp extends TcbOp { // The second kind of guard is a template context guard. This guard narrows the template // rendering context variable `ctx`. - if (dir.hasNgTemplateContextGuard && this.tcb.env.config.applyTemplateContextGuards) { - const ctx = this.scope.resolve(this.template); - const guardInvoke = tsCallMethod(dirId, 'ngTemplateContextGuard', [dirInstId, ctx]); - addParseSpanInfo(guardInvoke, this.template.sourceSpan); - directiveGuards.push(guardInvoke); + if (dir.hasNgTemplateContextGuard) { + if (this.tcb.env.config.applyTemplateContextGuards) { + const ctx = this.scope.resolve(this.template); + const guardInvoke = tsCallMethod(dirId, 'ngTemplateContextGuard', [dirInstId, ctx]); + addParseSpanInfo(guardInvoke, this.template.sourceSpan); + directiveGuards.push(guardInvoke); + } else if ( + this.template.variables.length > 0 && + this.tcb.env.config.suggestionsForSuboptimalTypeInference) { + // The compiler could have inferred a better type for the variables in this template, + // but was prevented from doing so by the type-checking configuration. Issue a warning + // diagnostic. + this.tcb.oobRecorder.suboptimalTypeInference(this.tcb.id, this.template.variables); + } } } } diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/BUILD.bazel b/packages/compiler-cli/src/ngtsc/typecheck/test/BUILD.bazel index 958d0c02fb2e..853ecffa1ae5 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/BUILD.bazel @@ -17,6 +17,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/imports", "//packages/compiler-cli/src/ngtsc/incremental", "//packages/compiler-cli/src/ngtsc/metadata", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/scope", "//packages/compiler-cli/src/ngtsc/shims", diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/test_utils.ts b/packages/compiler-cli/src/ngtsc/typecheck/test/test_utils.ts index e3935db0153f..71dc6a073e33 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/test_utils.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/test_utils.ts @@ -14,6 +14,7 @@ import {TestFile} from '../../file_system/testing'; import {AbsoluteModuleStrategy, LocalIdentifierStrategy, LogicalProjectStrategy, ModuleResolver, Reexport, Reference, ReferenceEmitter, RelativePathStrategy} from '../../imports'; import {NOOP_INCREMENTAL_BUILD} from '../../incremental'; import {ClassPropertyMapping, CompoundMetadataReader} from '../../metadata'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {ClassDeclaration, isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {ComponentScopeReader, LocalModuleScope, ScopeData, TypeCheckScopeRegistry} from '../../scope'; import {makeProgram} from '../../testing'; @@ -188,7 +189,8 @@ export const ALL_ENABLED_CONFIG: Readonly = { useContextGenericType: true, strictLiteralTypes: true, enableTemplateTypeChecker: false, - useInlineTypeConstructors: true + useInlineTypeConstructors: true, + suggestionsForSuboptimalTypeInference: false, }; // Remove 'ref' from TypeCheckableDirectiveMeta and add a 'selector' instead. @@ -272,6 +274,7 @@ export function tcb( strictLiteralTypes: true, enableTemplateTypeChecker: false, useInlineTypeConstructors: true, + suggestionsForSuboptimalTypeInference: false, ...config }; options = options || { @@ -513,7 +516,7 @@ export function setup(targets: TypeCheckingTarget[], overrides: { const templateTypeChecker = new TemplateTypeCheckerImpl( program, programStrategy, checkAdapter, fullConfig, emitter, reflectionHost, host, - NOOP_INCREMENTAL_BUILD, fakeScopeReader, typeCheckScopeRegistry); + NOOP_INCREMENTAL_BUILD, fakeScopeReader, typeCheckScopeRegistry, NOOP_PERF_RECORDER); return { templateTypeChecker, program, @@ -690,4 +693,5 @@ export class NoopOobRecorder implements OutOfBandDiagnosticRecorder { duplicateTemplateVar(): void {} requiresInlineTcb(): void {} requiresInlineTypeConstructors(): void {} + suboptimalTypeInference(): void {} } diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts b/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts index 5f06d3a3581b..9ccb53db849c 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts @@ -745,7 +745,8 @@ describe('type check blocks', () => { useContextGenericType: true, strictLiteralTypes: true, enableTemplateTypeChecker: false, - useInlineTypeConstructors: true + useInlineTypeConstructors: true, + suggestionsForSuboptimalTypeInference: false, }; describe('config.applyTemplateContextGuards', () => { diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/type_constructor_spec.ts b/packages/compiler-cli/src/ngtsc/typecheck/test/type_constructor_spec.ts index 4ac6638c0e71..6cd0410e3484 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/type_constructor_spec.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/type_constructor_spec.ts @@ -10,6 +10,7 @@ import * as ts from 'typescript'; import {absoluteFrom, AbsoluteFsPath, getFileSystem, getSourceFileOrError, LogicalFileSystem, NgtscCompilerHost} from '../../file_system'; import {runInEachFileSystem, TestFile} from '../../file_system/testing'; import {AbsoluteModuleStrategy, LocalIdentifierStrategy, LogicalProjectStrategy, ModuleResolver, Reference, ReferenceEmitter} from '../../imports'; +import {NOOP_PERF_RECORDER} from '../../perf'; import {isNamedClassDeclaration, TypeScriptReflectionHost} from '../../reflection'; import {getDeclaration, makeProgram} from '../../testing'; import {getRootDirs} from '../../util/src/typescript'; @@ -74,7 +75,7 @@ TestClass.ngTypeCtor({value: 'test'}); ]); const ctx = new TypeCheckContextImpl( ALL_ENABLED_CONFIG, host, new TestMappingStrategy(), emitter, reflectionHost, - new TestTypeCheckingHost(), InliningMode.InlineOps); + new TestTypeCheckingHost(), InliningMode.InlineOps, NOOP_PERF_RECORDER); const TestClass = getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration); const pendingFile = makePendingFile(); @@ -113,7 +114,7 @@ TestClass.ngTypeCtor({value: 'test'}); const pendingFile = makePendingFile(); const ctx = new TypeCheckContextImpl( ALL_ENABLED_CONFIG, host, new TestMappingStrategy(), emitter, reflectionHost, - new TestTypeCheckingHost(), InliningMode.InlineOps); + new TestTypeCheckingHost(), InliningMode.InlineOps, NOOP_PERF_RECORDER); const TestClass = getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration); ctx.addInlineTypeCtor( @@ -158,7 +159,7 @@ TestClass.ngTypeCtor({value: 'test'}); const pendingFile = makePendingFile(); const ctx = new TypeCheckContextImpl( ALL_ENABLED_CONFIG, host, new TestMappingStrategy(), emitter, reflectionHost, - new TestTypeCheckingHost(), InliningMode.InlineOps); + new TestTypeCheckingHost(), InliningMode.InlineOps, NOOP_PERF_RECORDER); const TestClass = getDeclaration(program, _('/main.ts'), 'TestClass', isNamedClassDeclaration); ctx.addInlineTypeCtor( diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/GOLDEN_PARTIAL.js index 8af31a6ed51d..141cc88c96e0 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/GOLDEN_PARTIAL.js @@ -41,13 +41,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class HostBindingComp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -93,13 +93,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class HostBindingComp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -130,13 +130,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -157,8 +157,8 @@ AbstractDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDE ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class AbstractDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -203,17 +203,17 @@ import * as i0 from "@angular/core"; export declare class SomeComp { prop: any; otherProp: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -258,17 +258,17 @@ import * as i0 from "@angular/core"; export declare class SomeComp { prop: any; otherProp: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -307,13 +307,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -352,13 +352,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -401,13 +401,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyApp { getFoo(): string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -452,8 +452,8 @@ export { Comp }; import * as i0 from "@angular/core"; export declare function Custom(): (target: any) => void; export declare class Comp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -484,12 +484,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/content_projection/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/content_projection/GOLDEN_PARTIAL.js index b79831460d03..5169d02fff30 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/content_projection/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/content_projection/GOLDEN_PARTIAL.js @@ -49,21 +49,21 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SimpleComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class ComplexComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -244,17 +244,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SimpleComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -293,17 +293,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SimpleComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -329,8 +329,8 @@ MyApp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: My import * as i0 from "@angular/core"; export declare class MyApp { show: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -352,7 +352,7 @@ SimpleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER" ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SimpleComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/lifecycle_hooks/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/lifecycle_hooks/GOLDEN_PARTIAL.js index 3f5de1ea6f78..a86a8dc64556 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/lifecycle_hooks/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/lifecycle_hooks/GOLDEN_PARTIAL.js @@ -26,13 +26,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -95,17 +95,17 @@ import { TemplateRef } from '@angular/core'; import * as i0 from "@angular/core"; export declare class IfDirective { constructor(template: TemplateRef); - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -151,13 +151,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -246,18 +246,18 @@ export declare class LifecycleComp { ngAfterViewInit(): void; ngAfterViewChecked(): void; ngOnDestroy(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class SimpleLayout { name1: string; name2: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class LifecycleModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/GOLDEN_PARTIAL.js index bd2c693e0f23..edf232bf2880 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/GOLDEN_PARTIAL.js @@ -62,24 +62,24 @@ import * as i0 from "@angular/core"; export declare class MyPipe implements PipeTransform, OnDestroy { transform(value: any, ...args: any[]): any; ngOnDestroy(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyPurePipe implements PipeTransform { transform(value: any, ...args: any[]): any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyApp { name: string; size: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -131,18 +131,18 @@ import * as i0 from "@angular/core"; export declare class MyPipe implements PipeTransform, OnDestroy { transform(value: any, ...args: any[]): any; ngOnDestroy(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyApp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -205,23 +205,23 @@ import * as i0 from "@angular/core"; export declare class MyPipe implements PipeTransform { constructor(changeDetectorRef: ChangeDetectorRef); transform(value: any, ...args: any[]): any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyOtherPipe implements PipeTransform { constructor(changeDetectorRef: ChangeDetectorRef); transform(value: any, ...args: any[]): any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyApp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/GOLDEN_PARTIAL.js index b7cbcb9b7581..cda3e7edf995 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/GOLDEN_PARTIAL.js @@ -19,8 +19,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -70,13 +70,13 @@ import * as i1 from "./some.directive"; export declare class ViewQueryComponent { someDir: SomeDirective; someDirs: QueryList; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -125,13 +125,13 @@ import * as i0 from "@angular/core"; export declare class ViewQueryComponent { myRef: any; myRefs: QueryList; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -155,8 +155,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -206,13 +206,13 @@ import * as i1 from "./some.directive"; export declare class ViewQueryComponent { someDir: SomeDirective; foo: ElementRef; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -236,8 +236,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -297,13 +297,13 @@ export declare class ViewQueryComponent { myRefs: QueryList; someDir: ElementRef; someDirs: QueryList>; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -327,8 +327,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -397,17 +397,17 @@ import * as i1 from "./some.directive"; export declare class ContentQueryComponent { someDir: SomeDirective; someDirList: QueryList; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -456,13 +456,13 @@ import * as i0 from "@angular/core"; export declare class ContentQueryComponent { myRef: any; myRefs: QueryList; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -486,8 +486,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -556,17 +556,17 @@ import * as i1 from "./some.directive"; export declare class ContentQueryComponent { someDir: SomeDirective; foo: ElementRef; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -590,8 +590,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -651,13 +651,13 @@ export declare class ContentQueryComponent { myRefs: QueryList; someDir: ElementRef; someDirs: QueryList>; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -681,8 +681,8 @@ SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -740,12 +740,12 @@ export declare class ContentQueryComponent { oldMyRefs: QueryList; someDirs: QueryList; oldSomeDirs: QueryList; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/template_variables/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/template_variables/GOLDEN_PARTIAL.js index 4fe14ef99fde..49cda2e157ef 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/template_variables/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/template_variables/GOLDEN_PARTIAL.js @@ -37,8 +37,8 @@ export declare class ForOfDirective { constructor(view: ViewContainerRef, template: TemplateRef); forOf: any[]; ngOnChanges(simpleChanges: SimpleChanges): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -80,13 +80,13 @@ export declare class MyComponent { items: { data: number; }[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -128,8 +128,8 @@ export declare class ForOfDirective { constructor(view: ViewContainerRef, template: TemplateRef); forOf: any[]; ngOnChanges(simpleChanges: SimpleChanges): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -171,13 +171,13 @@ export declare class MyComponent { items: { name: string; }[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -219,8 +219,8 @@ export declare class ForOfDirective { constructor(view: ViewContainerRef, template: TemplateRef); forOf: any[]; ngOnChanges(simpleChanges: SimpleChanges): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -288,13 +288,13 @@ export declare class MyComponent { description: string; }[]; }[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -336,7 +336,7 @@ export declare class ForOfDirective { constructor(view: ViewContainerRef, template: TemplateRef); forOf: any[]; ngOnChanges(simpleChanges: SimpleChanges): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/value_composition/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/value_composition/GOLDEN_PARTIAL.js index b47646b927cd..7a76af467486 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/value_composition/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/value_composition/GOLDEN_PARTIAL.js @@ -42,21 +42,21 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class ChildComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -95,17 +95,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class OtherDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -136,13 +136,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class SomeComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -181,17 +181,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class RouterOutlet { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class EmptyOutletComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -232,13 +232,13 @@ export declare class MyComponent { vcr: ViewContainerRef; cdr: ChangeDetectorRef; constructor(el: ElementRef, vcr: ViewContainerRef, cdr: ChangeDetectorRef); - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -283,18 +283,18 @@ import { TemplateRef } from '@angular/core'; import * as i0 from "@angular/core"; export declare class IfDirective { constructor(template: TemplateRef); - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { salutation: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -355,18 +355,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComp { names: string[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { customName: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -455,8 +455,8 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComp { names: string[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { n0: string; @@ -468,13 +468,13 @@ export declare class MyApp { n6: string; n7: string; n8: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -537,18 +537,18 @@ export declare class ObjectComp { config: { [key: string]: any; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -616,18 +616,18 @@ export declare class NestedComp { config: { [key: string]: any; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyApp { name: string; duration: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js index 7f38d8cf9da6..a2a5e0f6481e 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/elements/GOLDEN_PARTIAL.js @@ -29,13 +29,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -85,21 +85,21 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MathCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class InfinityCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -133,13 +133,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -173,13 +173,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -213,13 +213,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -250,13 +250,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -291,13 +291,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { id: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -378,13 +378,13 @@ export declare class DivDir { pipe: any; and: any; or: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class PipePipe { transform(v: any, a: any, a2: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { id: string; @@ -393,13 +393,13 @@ export declare class MyComponent { a: string; b: string; c: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -465,13 +465,13 @@ export declare class MyComponent { expandedWidth: string; collapsedWidth: string; getExpandedState(): string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -511,13 +511,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { error: boolean; color: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -557,13 +557,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -619,12 +619,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/GOLDEN_PARTIAL.js index e118bc288437..cb28e1939270 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/GOLDEN_PARTIAL.js @@ -18,9 +18,9 @@ BasicModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngI ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class BasicModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -73,22 +73,22 @@ import { PipeTransform } from '@angular/core'; import * as i0 from "@angular/core"; export declare class FooComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BarDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class QuxPipe implements PipeTransform { transform(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class FooModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -141,22 +141,22 @@ import { PipeTransform } from '@angular/core'; import * as i0 from "@angular/core"; export declare class FooComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BarDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class QuxPipe implements PipeTransform { transform(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class FooModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -218,23 +218,23 @@ FooModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImp ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class Thing { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class BaseService { protected thing: Thing; constructor(thing: Thing); - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class ChildService extends BaseService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class FooModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -307,35 +307,35 @@ AppModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImp ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class A1Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class A2Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class AModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class B1Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class B2Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -408,35 +408,35 @@ AppModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImp ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class A1Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class A2Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class AModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class B1Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class B2Component { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -502,20 +502,20 @@ const ɵBasicModule_BaseFactory = /*@__PURE__*/ i0.ɵɵgetInheritedFactory(Basic ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class Service { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class BaseModule { private service; constructor(service: Service); - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class BasicModule extends BaseModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -551,13 +551,13 @@ import { ModuleWithProviders } from '@angular/core'; import * as i0 from "@angular/core"; export declare function provideModule(): ModuleWithProviders; export declare class TestModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class ForwardModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/GOLDEN_PARTIAL.js index 715b3fc61ac3..fcbdab1ec4c7 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/GOLDEN_PARTIAL.js @@ -48,18 +48,18 @@ TodoModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngIm import * as i0 from "@angular/core"; export declare class MyApp { list: any[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class TodoComponent { data: any[]; myTitle: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class TodoModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/animations/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/animations/GOLDEN_PARTIAL.js index 203e455682ca..5705f06246e5 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/animations/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/animations/GOLDEN_PARTIAL.js @@ -28,13 +28,13 @@ import * as i0 from "@angular/core"; export declare class MyApp { exp: any; any: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -68,12 +68,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/hello_world/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/hello_world/GOLDEN_PARTIAL.js index e7d227745b7c..d2d57dbe196b 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/hello_world/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/hello_world/GOLDEN_PARTIAL.js @@ -38,12 +38,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/interpolations/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/interpolations/GOLDEN_PARTIAL.js index 042b8cc42ff7..873bd08dd959 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/interpolations/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler/interpolations/GOLDEN_PARTIAL.js @@ -33,12 +33,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyApp { list: any[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/attribute_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/attribute_bindings/GOLDEN_PARTIAL.js index 27a2235efdbf..b08a426cf3b0 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/attribute_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/attribute_bindings/GOLDEN_PARTIAL.js @@ -29,8 +29,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -64,8 +64,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -95,8 +95,8 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -130,8 +130,8 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -184,19 +184,19 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class CustomEl { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -232,8 +232,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -286,13 +286,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { doThings(): void; three: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -361,12 +361,12 @@ export declare class MyComponent { seven: any; eight: any; nine: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/host_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/host_bindings/GOLDEN_PARTIAL.js index cfaff9f20931..9cd2a831cde3 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/host_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/host_bindings/GOLDEN_PARTIAL.js @@ -33,13 +33,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class HostBindingDir { dirId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -73,13 +73,13 @@ export declare class HostBindingDir { getData?: () => { id: number; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -114,13 +114,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class HostBindingComp { id: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -155,13 +155,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class HostAttributeDir { required: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -192,13 +192,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class HostAttributeDir { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -250,17 +250,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class HostAttributeComp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class HostAttributeDir { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -288,8 +288,8 @@ import * as i0 from "@angular/core"; export declare class MyDirective { myTitle: string; myId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -323,8 +323,8 @@ import * as i0 from "@angular/core"; export declare class MyDirective { myTitle: string; myId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -349,8 +349,8 @@ MyDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ty ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -381,8 +381,8 @@ import * as i0 from "@angular/core"; export declare class MyDirective { expandedState: string; isSmall: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -413,8 +413,8 @@ import * as i0 from "@angular/core"; export declare class MyDirective { myTitle: string; myId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -448,8 +448,8 @@ import * as i0 from "@angular/core"; export declare class MyDirective { myTitle: string; myId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -474,8 +474,8 @@ MyDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ty ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -513,8 +513,8 @@ export declare class MyDirective { mousedown(): void; mouseup(): void; click(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -548,8 +548,8 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty import * as i0 from "@angular/core"; export declare class MyComponent { start(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -591,8 +591,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { start(): void; click(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -641,13 +641,13 @@ export declare class HostBindingDir { true: any; false: any; other: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -690,12 +690,12 @@ export declare class HostBindingDir { 'is-a': any; 'is-"b"': any; '"is-c"': any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/non_bindable_behavior/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/non_bindable_behavior/GOLDEN_PARTIAL.js index 62c19f9701dd..6b1d7722986b 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/non_bindable_behavior/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/non_bindable_behavior/GOLDEN_PARTIAL.js @@ -43,13 +43,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -95,13 +95,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -147,13 +147,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -195,12 +195,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/property_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/property_bindings/GOLDEN_PARTIAL.js index 1be3bd873572..8a222e2c40a2 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/property_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/property_bindings/GOLDEN_PARTIAL.js @@ -30,13 +30,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { title: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -76,13 +76,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -151,13 +151,13 @@ export declare class MyComponent { seven: any; eight: any; nine: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -197,13 +197,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { forValue: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -255,21 +255,21 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class AsyncPipe { transform(v: any): null | any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { myTitle: string; auth: () => { identity(): any; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -297,8 +297,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -341,17 +341,17 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class ButtonDir { al: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -396,17 +396,17 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class ButtonDir { al: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -448,8 +448,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { expansionState: string; myTitle: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -477,8 +477,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -546,25 +546,25 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class SpanDir { someProp: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class CustomEl { prop: any; otherProp: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -618,18 +618,18 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class SpanDir { someProp: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { myTitle: string; buttonId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/text_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/text_bindings/GOLDEN_PARTIAL.js index a8082c0da6f9..4534b509cbec 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/text_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings/text_bindings/GOLDEN_PARTIAL.js @@ -35,12 +35,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_di/di/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_di/di/GOLDEN_PARTIAL.js index ff207b1e9a6a..91b78312816b 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_di/di/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_di/di/GOLDEN_PARTIAL.js @@ -49,18 +49,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class MyComponent { constructor(name: string, s1: MyService, s2: MyService, s4: MyService, s3: MyService, s5: MyService, s6: MyService); - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -87,7 +87,7 @@ declare class MyDependency { } export declare class MyService { constructor(dep: MyDependency); - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export {}; @@ -120,7 +120,7 @@ declare class MyDependency { } export declare class MyService { constructor(dep: MyDependency); - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export {}; @@ -149,7 +149,7 @@ MyService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MyService, fac ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } @@ -181,7 +181,7 @@ MyService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MyService, fac ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } @@ -211,7 +211,7 @@ MyService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MyService, fac ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } @@ -248,7 +248,7 @@ MyService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MyService, fac ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyService { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } @@ -345,31 +345,31 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import { PipeTransform } from '@angular/core'; import * as i0 from "@angular/core"; declare class Service { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class MyPipe implements PipeTransform { constructor(service: Service); transform(value: any, ...args: any[]): any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class MyOtherPipe implements PipeTransform { constructor(service: Service); transform(value: any, ...args: any[]): any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; static ɵprov: i0.ɵɵInjectableDef; } export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export {}; diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_directives/matching/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_directives/matching/GOLDEN_PARTIAL.js index af95f00a3513..b5f1025129a1 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_directives/matching/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_directives/matching/GOLDEN_PARTIAL.js @@ -34,17 +34,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class I18nDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -99,25 +99,25 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class I18nDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class I18nFooDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class FooDirective { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -159,17 +159,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class SomeDirective { someDirective: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -215,17 +215,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class DirectiveA { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -271,17 +271,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class DirectiveA { - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -326,17 +326,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class SomeDirective { someDirective: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -378,17 +378,17 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class SomeDirective { someDirective: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -435,17 +435,17 @@ import { EventEmitter } from '@angular/core'; import * as i0 from "@angular/core"; export declare class SomeDirective { someDirective: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { noop(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/element_attributes/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/element_attributes/GOLDEN_PARTIAL.js index 78dfaa0def3d..59d8f9ee8941 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/element_attributes/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/element_attributes/GOLDEN_PARTIAL.js @@ -47,13 +47,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -91,13 +91,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -139,13 +139,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { visible: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -187,13 +187,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -244,18 +244,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -293,13 +293,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -349,13 +349,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { title: string; label: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -393,13 +393,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -441,13 +441,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { exp: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -525,26 +525,26 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class DivDir { al: any; arl: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { valueA: any; valueB: any; valueC: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -596,18 +596,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { valueA: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -662,18 +662,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { outer: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -712,13 +712,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { valueA: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -757,13 +757,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { valueA: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -801,13 +801,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -849,12 +849,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/es5_support/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/es5_support/GOLDEN_PARTIAL.js index badfd1ed1dff..4d523e8dc040 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/es5_support/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/es5_support/GOLDEN_PARTIAL.js @@ -37,12 +37,12 @@ export { MyModule }; ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/GOLDEN_PARTIAL.js index 68c4b9cfadb4..80202faca45f 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/GOLDEN_PARTIAL.js @@ -37,13 +37,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -85,13 +85,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -133,13 +133,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { age: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -193,13 +193,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -244,13 +244,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { age: number; other: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -300,13 +300,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -354,13 +354,13 @@ export declare class MyComponent { ageA: number; ageB: number; ageC: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -410,13 +410,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; age: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -474,13 +474,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -536,13 +536,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { age: number; gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -600,13 +600,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { count: number; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -658,13 +658,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -720,13 +720,13 @@ export declare class MyComponent { gender: string; weight: number; height: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -786,13 +786,13 @@ export declare class MyComponent { weight: number; height: number; age: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -834,13 +834,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { count: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -888,12 +888,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { count: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/line_ending_normalization/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/line_ending_normalization/GOLDEN_PARTIAL.js index a13e9b688661..4fc5da74f0e7 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/line_ending_normalization/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/line_ending_normalization/GOLDEN_PARTIAL.js @@ -52,13 +52,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -115,13 +115,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -158,13 +158,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -201,13 +201,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -264,13 +264,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -327,13 +327,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -370,13 +370,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -413,12 +413,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { value: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/localize_legacy_message_ids/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/localize_legacy_message_ids/GOLDEN_PARTIAL.js index fe49df1c623e..3e6e4febdd30 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/localize_legacy_message_ids/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/localize_legacy_message_ids/GOLDEN_PARTIAL.js @@ -33,13 +33,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -77,12 +77,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/namespaces/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/namespaces/GOLDEN_PARTIAL.js index 70dfeea3663f..f4adbd733854 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/namespaces/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/namespaces/GOLDEN_PARTIAL.js @@ -45,13 +45,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -101,12 +101,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/nested_nodes/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/nested_nodes/GOLDEN_PARTIAL.js index 64fe43ce463c..b6128b89d619 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/nested_nodes/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/nested_nodes/GOLDEN_PARTIAL.js @@ -41,13 +41,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -85,13 +85,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -129,13 +129,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -173,13 +173,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { count: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -225,13 +225,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -281,13 +281,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { valueA: string; valueB: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -330,13 +330,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { valueA: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -392,18 +392,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class AsyncPipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { valueA: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -462,8 +462,8 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { one: number; @@ -471,13 +471,13 @@ export declare class MyComponent { three: number; four: number; five: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -556,20 +556,20 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { one: number; two: number; nestedInBlockTwo: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -639,8 +639,8 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { valueA: any; @@ -648,13 +648,13 @@ export declare class MyComponent { valueC: any; valueD: any; valueE: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -712,13 +712,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -760,13 +760,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -844,13 +844,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -888,13 +888,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -934,12 +934,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { onClick(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/ng-container_ng-template/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/ng-container_ng-template/GOLDEN_PARTIAL.js index 0386755c11ed..c6028ef91b2c 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/ng-container_ng-template/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/ng-container_ng-template/GOLDEN_PARTIAL.js @@ -46,18 +46,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { valueA: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -95,13 +95,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -159,19 +159,19 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class UppercasePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { valueA: string; valueB: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -215,13 +215,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { age: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -279,13 +279,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -329,13 +329,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { gender: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -383,13 +383,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -429,13 +429,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -477,13 +477,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -525,13 +525,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -571,12 +571,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/self-closing_i18n_instructions/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/self-closing_i18n_instructions/GOLDEN_PARTIAL.js index b7bdf26c66af..7faba9acd5ec 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/self-closing_i18n_instructions/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/self-closing_i18n_instructions/GOLDEN_PARTIAL.js @@ -33,13 +33,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -81,13 +81,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { age: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -127,13 +127,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -173,12 +173,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/whitespace_preserving_mode/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/whitespace_preserving_mode/GOLDEN_PARTIAL.js index dab7b21996f7..e3fb389f70ee 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/whitespace_preserving_mode/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/whitespace_preserving_mode/GOLDEN_PARTIAL.js @@ -40,12 +40,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_input_outputs/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_input_outputs/GOLDEN_PARTIAL.js index 962fb13bf3ca..5e7c4718a9a1 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_input_outputs/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_input_outputs/GOLDEN_PARTIAL.js @@ -40,13 +40,13 @@ export declare class MyComponent { originalComponentInput: any; componentOutput: any; originalComponentOutput: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -91,12 +91,12 @@ export declare class MyDirective { originalDirectiveInput: any; directiveOutput: any; originalDirectiveOutput: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_listener/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_listener/GOLDEN_PARTIAL.js index f96b4a7bca92..0d33ebec4358 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_listener/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_listener/GOLDEN_PARTIAL.js @@ -28,13 +28,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { onClick(event: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -74,18 +74,18 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyApp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponent { onClick(event: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -133,13 +133,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { onClick(name: any): void; onClick2(name: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -181,13 +181,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { onClick(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -225,13 +225,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { click(): void; change(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -297,21 +297,21 @@ import * as i0 from "@angular/core"; export declare class SomeComp { update: EventEmitter; delete: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponent { click(): void; change(): void; delete(): void; update(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -345,13 +345,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -375,8 +375,8 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty import * as i0 from "@angular/core"; export declare class MyComponent { onClick(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -411,8 +411,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { mousedown(): void; click(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -439,8 +439,8 @@ MyComponent.ɵdir = i0.ɵɵngDeclareDirective({ version: "0.0.0-PLACEHOLDER", ty import * as i0 from "@angular/core"; export declare class MyComponent { click(target: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -528,13 +528,13 @@ MyMod.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImport: import * as i0 from "@angular/core"; export declare class DivDir { event: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyMod { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_providers/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_providers/GOLDEN_PARTIAL.js index 0c6572e46059..37db20edb9dc 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_providers/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_providers/GOLDEN_PARTIAL.js @@ -38,13 +38,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -86,13 +86,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -130,13 +130,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -167,12 +167,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/binding_slots/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/binding_slots/GOLDEN_PARTIAL.js index 72996edf09c7..2cd74155aadc 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/binding_slots/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/binding_slots/GOLDEN_PARTIAL.js @@ -61,13 +61,13 @@ export declare class MyComponent { id: string; title: string; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -111,8 +111,8 @@ export declare class WidthDirective { myFooClass: boolean; id: string; title: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } /**************************************************************************************************** @@ -183,16 +183,16 @@ export declare class MyDir { _animValue: null; _animParam1: null; _animParam2: null; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyAppComp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/chaining/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/chaining/GOLDEN_PARTIAL.js index be2930e099d5..9cf133ec3cbd 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/chaining/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/chaining/GOLDEN_PARTIAL.js @@ -33,8 +33,8 @@ export declare class MyComponent { yesToApple: boolean; yesToOrange: boolean; yesToTomato: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -72,8 +72,8 @@ export declare class MyComponent { color: string; border: string; transition: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -123,8 +123,8 @@ export declare class MyComponent { yesToApple: boolean; yesToOrange: boolean; yesToTomato: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -158,8 +158,8 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty import * as i0 from "@angular/core"; export declare class MyComponent { one: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -203,8 +203,8 @@ export declare class MyComponent { one: string; two: string; three: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -256,8 +256,8 @@ export declare class MyComponent { width: string; yesToApple: boolean; yesToOrange: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -305,8 +305,8 @@ export declare class MyComponent { three: string; transition: string; width: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -356,7 +356,7 @@ export declare class MyComponent { yesToTomato: boolean; border: string; yesToOrange: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/class_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/class_bindings/GOLDEN_PARTIAL.js index 6733c7342aa3..bbeaea397b5d 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/class_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/class_bindings/GOLDEN_PARTIAL.js @@ -32,13 +32,13 @@ export declare class MyComponent { myClassExp: { foo: boolean; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -93,13 +93,13 @@ export declare class MyComponent { }; yesToApple: boolean; yesToOrange: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -141,13 +141,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -178,12 +178,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_animations/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_animations/GOLDEN_PARTIAL.js index b2aaa797bbe9..24b9f68567df 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_animations/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_animations/GOLDEN_PARTIAL.js @@ -26,13 +26,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -63,13 +63,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -113,13 +113,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { exp: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -178,9 +178,9 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -234,8 +234,8 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_styles/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_styles/GOLDEN_PARTIAL.js index 65dac570e398..589151410b7f 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_styles/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_styles/GOLDEN_PARTIAL.js @@ -32,13 +32,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -74,13 +74,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -116,12 +116,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/host_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/host_bindings/GOLDEN_PARTIAL.js index 3231454ad7c5..30ad8d943841 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/host_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/host_bindings/GOLDEN_PARTIAL.js @@ -56,13 +56,13 @@ export declare class MyComponent { }; myColorProp: string; myFooClass: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -126,13 +126,13 @@ export declare class MyComponent { a: boolean; b: boolean; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -193,13 +193,13 @@ export declare class MyComponent { myWidthExp: string; myBarClassExp: boolean; myHeightExp: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -273,13 +273,13 @@ export declare class MyComponent { p7: number; p8: number; p9: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -353,13 +353,13 @@ export declare class MyComponent { p7: number; p8: number; p9: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -446,28 +446,28 @@ export declare class ClassDirective { myClassMap: { red: boolean; }; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class WidthDirective { myWidth: number; myFooClass: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class HeightDirective { myHeight: number; myBarClass: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/interpolations/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/interpolations/GOLDEN_PARTIAL.js index ce9a19de172a..c7fdb406bee8 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/interpolations/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/interpolations/GOLDEN_PARTIAL.js @@ -61,8 +61,8 @@ export declare class MyComponent { seven: string; eight: string; nine: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -128,8 +128,8 @@ export declare class MyComponent { seven: string; eight: string; nine: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -163,8 +163,8 @@ import * as i0 from "@angular/core"; export declare class MyComponent { one: string; two: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -210,8 +210,8 @@ export declare class MyComponent { myBoxY: string; myBoxWidth: string; myRepeat: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -245,7 +245,7 @@ import * as i0 from "@angular/core"; export declare class MyComponent { one: string; two: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/invalid/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/invalid/GOLDEN_PARTIAL.js index a121b12c214d..338891b5d59e 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/invalid/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/invalid/GOLDEN_PARTIAL.js @@ -21,7 +21,7 @@ MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", ty import * as i0 from "@angular/core"; export declare class MyComponent { isEnabled: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/mixed_style_and_class/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/mixed_style_and_class/GOLDEN_PARTIAL.js index e2ffb0c73bdf..da1e3c268ece 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/mixed_style_and_class/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/mixed_style_and_class/GOLDEN_PARTIAL.js @@ -38,13 +38,13 @@ export declare class MyComponent { duration: number; })[]; myClassExp: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -101,13 +101,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class StylePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class ClassPipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { myStyleExp: ({ @@ -118,13 +118,13 @@ export declare class MyComponent { duration: number; })[]; myClassExp: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -188,8 +188,8 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class PipePipe { transform(v: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class MyComponent { myStyleExp: {}; @@ -198,13 +198,13 @@ export declare class MyComponent { bazExp: string; items: number[]; item: number; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -258,12 +258,12 @@ export declare class MyComponent { h1: string; a1: boolean; r1: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/GOLDEN_PARTIAL.js index ed9f14a0b8b3..e76ca82da02a 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/GOLDEN_PARTIAL.js @@ -36,13 +36,13 @@ export declare class MyComponent { color: string; duration: number; })[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -126,24 +126,24 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponentWithInterpolation { fooId: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponentWithMuchosInterpolation { fooId: string; fooUsername: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyComponentWithoutInterpolation { exp: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -199,13 +199,13 @@ export declare class MyComponent { })[]; myWidth: string; myHeight: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -240,13 +240,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { myImage: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -277,13 +277,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -314,12 +314,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/GOLDEN_PARTIAL.js index f4c362a7b929..26126a6daf18 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/GOLDEN_PARTIAL.js @@ -57,13 +57,13 @@ export declare class MyComponent { component: this; format(outer: any, middle: any, inner: any): void; onClick(outer: any, middle: any, inner: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -107,13 +107,13 @@ import * as i0 from "@angular/core"; export declare class MyComponent { _data: number[]; _handleClick(d: any, i: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -155,13 +155,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { greet(val: any): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -203,13 +203,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -253,13 +253,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -307,13 +307,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -353,13 +353,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -393,13 +393,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -433,13 +433,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -481,8 +481,8 @@ TestComp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestComp { message: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -524,8 +524,8 @@ TestComp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestComp { message: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -635,25 +635,25 @@ BModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpor import * as i0 from "@angular/core"; export declare class AComponent { items: number[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class AModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } export declare class BComponent { items: { subitems: number[]; }[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -713,18 +713,18 @@ AModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpor import * as i0 from "@angular/core"; export declare class AComponent { show: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class BComponent { show: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class AModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -778,13 +778,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { items: number[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -818,13 +818,13 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class MyComponent { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -861,12 +861,12 @@ MyModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImpo import * as i0 from "@angular/core"; export declare class MyComponent { a: any; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class MyModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/source_mapping/external_templates/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/source_mapping/external_templates/GOLDEN_PARTIAL.js index 4f5ce866dddb..e2a6ed8f27a2 100644 --- a/packages/compiler-cli/test/compliance/test_cases/source_mapping/external_templates/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/source_mapping/external_templates/GOLDEN_PARTIAL.js @@ -24,8 +24,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -54,8 +54,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -84,8 +84,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -114,8 +114,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -144,8 +144,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -174,7 +174,7 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/GOLDEN_PARTIAL.js b/packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/GOLDEN_PARTIAL.js index 7f3c4507c2a3..2015906a3f06 100644 --- a/packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/GOLDEN_PARTIAL.js +++ b/packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/GOLDEN_PARTIAL.js @@ -24,8 +24,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -54,8 +54,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -84,8 +84,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -114,8 +114,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -148,8 +148,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -182,8 +182,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -218,8 +218,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { greeting: string; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -254,8 +254,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { greeting: string; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -288,8 +288,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -322,8 +322,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -371,18 +371,18 @@ AppModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImp import { PipeTransform } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class PercentPipe implements PipeTransform { transform(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -430,18 +430,18 @@ AppModule.ɵinj = i0.ɵɵngDeclareInjector({ version: "0.0.0-PLACEHOLDER", ngImp import { PipeTransform } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class PercentPipe implements PipeTransform { transform(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵpipe: i0.ɵɵPipeDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵpipe: i0.ɵɵPipeDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -474,8 +474,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -508,8 +508,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -544,8 +544,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { greeting: string; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -580,8 +580,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { greeting: string; name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -614,8 +614,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -648,8 +648,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -680,8 +680,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { doSomething(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -712,8 +712,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { doSomething(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -746,8 +746,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { items: string[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -780,8 +780,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { items: string[]; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -812,8 +812,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { doSomething(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -844,8 +844,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { doSomething(): void; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -904,19 +904,19 @@ import { EventEmitter } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class NgModelDirective { ngModel: string; ngModelChanges: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -975,19 +975,19 @@ import { EventEmitter } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class NgModelDirective { ngModel: string; ngModelChanges: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -1046,19 +1046,19 @@ import { EventEmitter } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class NgModelDirective { ngModel: string; ngModelChanges: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -1117,19 +1117,19 @@ import { EventEmitter } from '@angular/core'; import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } export declare class NgModelDirective { ngModel: string; ngModelChanges: EventEmitter; - static ɵfac: i0.ɵɵFactoryDef; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class AppModule { - static ɵfac: i0.ɵɵFactoryDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; - static ɵinj: i0.ɵɵInjectorDef; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; } /**************************************************************************************************** @@ -1162,8 +1162,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { isInitial: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1196,8 +1196,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { isInitial: boolean; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1226,8 +1226,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1256,8 +1256,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1294,8 +1294,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1332,8 +1332,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1362,8 +1362,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1392,8 +1392,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1422,8 +1422,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1452,8 +1452,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1486,8 +1486,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1520,8 +1520,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1550,8 +1550,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1580,8 +1580,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1614,8 +1614,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1648,8 +1648,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: import * as i0 from "@angular/core"; export declare class TestCmp { name: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1684,8 +1684,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { titleValue: string; bodyValue: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1720,8 +1720,8 @@ import * as i0 from "@angular/core"; export declare class TestCmp { titleValue: string; bodyValue: string; - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1750,8 +1750,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1780,8 +1780,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1810,8 +1810,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1840,8 +1840,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1870,8 +1870,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1900,8 +1900,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1930,8 +1930,8 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } /**************************************************************************************************** @@ -1960,7 +1960,7 @@ TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: ****************************************************************************************************/ import * as i0 from "@angular/core"; export declare class TestCmp { - static ɵfac: i0.ɵɵFactoryDef; - static ɵcmp: i0.ɵɵComponentDefWithMeta; + static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; } diff --git a/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts b/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts index 9ad05bbc8252..47832d1be5a2 100644 --- a/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts +++ b/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts @@ -76,8 +76,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile Injectables with a generic service', () => { @@ -94,7 +94,7 @@ function allTests(os: string) { const jsContents = env.getContents('test.js'); expect(jsContents).toContain('Store.ɵprov ='); const dtsContents = env.getContents('test.d.ts'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef, never>;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration, never>;'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef>;'); }); @@ -125,8 +125,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile Injectables with providedIn and factory without errors', () => { @@ -151,7 +151,7 @@ function allTests(os: string) { expect(jsContents).not.toContain('__decorate'); const dtsContents = env.getContents('test.d.ts'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile Injectables with providedIn and factory with deps without errors', () => { @@ -180,7 +180,7 @@ function allTests(os: string) { expect(jsContents).not.toContain('__decorate'); const dtsContents = env.getContents('test.d.ts'); expect(dtsContents).toContain('static ɵprov: i0.ɵɵInjectableDef;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile @Injectable with an @Optional dependency', () => { @@ -244,8 +244,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵdir: i0.ɵɵDirectiveDefWithMeta'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef'); + 'static ɵdir: i0.ɵɵDirectiveDeclaration'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration'); }); it('should compile abstract Directives without errors', () => { @@ -266,8 +266,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵdir: i0.ɵɵDirectiveDefWithMeta'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef'); + 'static ɵdir: i0.ɵɵDirectiveDeclaration'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration'); }); it('should compile Components (inline template) without errors', () => { @@ -291,8 +291,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵcmp: i0.ɵɵComponentDefWithMeta'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef'); + 'static ɵcmp: i0.ɵɵComponentDeclaration'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration'); }); it('should compile Components (dynamic inline template) without errors', () => { @@ -317,9 +317,9 @@ function allTests(os: string) { expect(dtsContents) .toContain( - 'static ɵcmp: i0.ɵɵComponentDefWithMeta' + + 'static ɵcmp: i0.ɵɵComponentDeclaration' + ''); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration'); }); it('should compile Components (function call inline template) without errors', () => { @@ -346,8 +346,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵcmp: i0.ɵɵComponentDefWithMeta'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef'); + 'static ɵcmp: i0.ɵɵComponentDeclaration'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration'); }); it('should compile Components (external template) without errors', () => { @@ -998,7 +998,7 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - `static ɵdir: i0.ɵɵDirectiveDefWithMeta;`); + `static ɵdir: i0.ɵɵDirectiveDeclaration;`); }); describe('undecorated classes using Angular features', () => { @@ -1104,10 +1104,10 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵcmp: i0.ɵɵComponentDefWithMeta'); + 'static ɵcmp: i0.ɵɵComponentDeclaration'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); expect(dtsContents).not.toContain('__decorate'); }); @@ -1194,15 +1194,15 @@ function allTests(os: string) { export class Comp {} `); env.write('node_modules/@angular/router/index.d.ts', ` - import {ɵɵComponentDefWithMeta, ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵComponentDeclaration, ModuleWithProviders, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class RouterComp { - static ɵcmp: ɵɵComponentDefWithMeta + static ɵcmp: ɵɵComponentDeclaration } declare class RouterModule { static forRoot(): ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -1257,8 +1257,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); - expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDef'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); + expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDeclaration'); }); it('should compile NgModules with factory providers without errors', () => { @@ -1300,8 +1300,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); - expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDef'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); + expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDeclaration'); }); it('should compile NgModules with factory providers and deps without errors', () => { @@ -1347,8 +1347,8 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); - expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDef'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); + expect(dtsContents).toContain('static ɵinj: i0.ɵɵInjectorDeclaration'); }); it('should compile NgModules with references to local components', () => { @@ -1515,8 +1515,8 @@ function allTests(os: string) { expect(jsContents) .toContain( 'TestPipe.ɵfac = function TestPipe_Factory(t) { return new (t || TestPipe)(); }'); - expect(dtsContents).toContain('static ɵpipe: i0.ɵɵPipeDefWithMeta;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵpipe: i0.ɵɵPipeDeclaration;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile pure Pipes without errors', () => { @@ -1540,8 +1540,8 @@ function allTests(os: string) { expect(jsContents) .toContain( 'TestPipe.ɵfac = function TestPipe_Factory(t) { return new (t || TestPipe)(); }'); - expect(dtsContents).toContain('static ɵpipe: i0.ɵɵPipeDefWithMeta;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef;'); + expect(dtsContents).toContain('static ɵpipe: i0.ɵɵPipeDeclaration;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration;'); }); it('should compile Pipes with dependencies', () => { @@ -1581,8 +1581,8 @@ function allTests(os: string) { expect(jsContents).toContain('TestPipe.ɵpipe ='); const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) - .toContain('static ɵpipe: i0.ɵɵPipeDefWithMeta, "test-pipe">;'); - expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDef, never>;'); + .toContain('static ɵpipe: i0.ɵɵPipeDeclaration, "test-pipe">;'); + expect(dtsContents).toContain('static ɵfac: i0.ɵɵFactoryDeclaration, never>;'); }); it('should include @Pipes in @NgModule scopes', () => { @@ -1609,7 +1609,7 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); describe('empty and missing selectors', () => { @@ -2130,10 +2130,10 @@ function allTests(os: string) { expect(jsContents).toContain('TestNgModule.ɵprov ='); // Validate that each class's .d.ts declaration has the primary definition. - expect(dtsContents).toContain('ComponentDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should extract the generic type and include it in the module\'s declaration', () => { @@ -2721,11 +2721,11 @@ function allTests(os: string) { `); env.write('node_modules/router/index.d.ts', ` - import {ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ModuleWithProviders, ɵɵNgModuleDeclaration} from '@angular/core'; declare class RouterModule { static forRoot(): ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -2738,7 +2738,7 @@ function allTests(os: string) { expect(dtsContents).toContain(`import * as i1 from "router";`); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should throw if ModuleWithProviders is missing its generic type argument', () => { @@ -2751,11 +2751,11 @@ function allTests(os: string) { `); env.write('node_modules/router/index.d.ts', ` - import {ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ModuleWithProviders, ɵɵNgModuleDeclaration} from '@angular/core'; declare class RouterModule { static forRoot(): ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); const errors = env.driveDiagnostics(); @@ -2787,9 +2787,9 @@ function allTests(os: string) { `); env.write('node_modules/router/internal.d.ts', ` - import {ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵNgModuleDeclaration} from '@angular/core'; export declare class InternalRouterModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -2802,7 +2802,7 @@ function allTests(os: string) { expect(dtsContents).toContain(`import * as i1 from "router";`); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should extract the generic type if it is provided as qualified type name from another package', @@ -2823,9 +2823,9 @@ function allTests(os: string) { }`); env.write('node_modules/router2/index.d.ts', ` - import {ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵNgModuleDeclaration} from '@angular/core'; export declare class Router2Module { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; }`); env.driveMain(); @@ -2837,17 +2837,17 @@ function allTests(os: string) { expect(dtsContents).toContain(`import * as i1 from "router2";`); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should not reference a constant with a ModuleWithProviders value in module def imports', () => { env.write('dep.d.ts', ` - import {ModuleWithProviders, ɵɵNgModuleDefWithMeta as ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ModuleWithProviders, ɵɵNgModuleDeclaration as ɵɵNgModuleDeclaration} from '@angular/core'; export declare class DepModule { static forRoot(arg1: any, arg2: any): ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('test.ts', ` @@ -2881,13 +2881,13 @@ function allTests(os: string) { `); env.write('node_modules/router/index.d.ts', ` - import {ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ModuleWithProviders, ɵɵNgModuleDeclaration} from '@angular/core'; export interface MyType extends ModuleWithProviders {} declare class RouterModule { static forRoot(): (MyType)&{ngModule:RouterModule}; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -2900,7 +2900,7 @@ function allTests(os: string) { expect(dtsContents).toContain(`import * as i1 from "router";`); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should unwrap a namespace imported ModuleWithProviders function if a generic type is provided for it', @@ -2919,7 +2919,7 @@ function allTests(os: string) { declare class RouterModule { static forRoot(): core.ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -2932,7 +2932,7 @@ function allTests(os: string) { expect(dtsContents).toContain(`import * as i1 from "router";`); expect(dtsContents) .toContain( - 'i0.ɵɵNgModuleDefWithMeta'); + 'i0.ɵɵNgModuleDeclaration'); }); it('should inject special types according to the metadata', () => { @@ -3020,15 +3020,18 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵfac: i0.ɵɵFactoryDef'); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); + expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents) + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents) + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents) + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); }); it('should include constructor dependency metadata for @Injectable', () => { @@ -3075,17 +3078,21 @@ function allTests(os: string) { env.driveMain(); const dtsContents = env.getContents('test.d.ts'); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); + expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); expect(dtsContents) - .toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); expect(dtsContents) - .toContain(`static ɵfac: i0.ɵɵFactoryDef`); + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); expect(dtsContents) - .toContain(`static ɵfac: i0.ɵɵFactoryDef`); + .toContain( + `static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents) + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); + expect(dtsContents) + .toContain( + `static ɵfac: i0.ɵɵFactoryDeclaration`); expect(dtsContents) - .toContain(`static ɵfac: i0.ɵɵFactoryDef`); - expect(dtsContents).toContain(`static ɵfac: i0.ɵɵFactoryDef`); + .toContain(`static ɵfac: i0.ɵɵFactoryDeclaration`); }); it('should include ng-content selectors in the metadata', () => { @@ -3104,7 +3111,7 @@ function allTests(os: string) { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵcmp: i0.ɵɵComponentDefWithMeta'); + 'static ɵcmp: i0.ɵɵComponentDeclaration'); }); it('should generate queries for components', () => { @@ -5071,14 +5078,14 @@ function allTests(os: string) { describe('when processing external directives', () => { it('should not emit multiple references to the same directive', () => { env.write('node_modules/external/index.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('test.ts', ` @@ -5106,19 +5113,19 @@ function allTests(os: string) { it('should import directives by their external name', () => { env.write('node_modules/external/index.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; import {InternalDir} from './internal'; export {InternalDir as ExternalDir} from './internal'; export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('node_modules/external/internal.d.ts', ` export declare class InternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } `); env.write('test.ts', ` @@ -5410,14 +5417,14 @@ function allTests(os: string) { export class Module {} `); env.write('node_modules/external/index.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -5560,14 +5567,14 @@ function allTests(os: string) { it('should not re-export a directive from an exported, external NgModule', () => { env.write(`node_modules/external/index.d.ts`, ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('module.ts', ` @@ -5660,18 +5667,18 @@ function allTests(os: string) { it('should choose a re-exported symbol if one is present', () => { env.write(`node_modules/external/dir.d.ts`, ` - import {ɵɵDirectiveDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } `); env.write('node_modules/external/module.d.ts', ` - import {ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵNgModuleDeclaration} from '@angular/core'; import {ExternalDir} from './dir'; export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } export {ExternalDir as ɵngExportɵExternalModuleɵExternalDir}; @@ -6063,13 +6070,13 @@ function allTests(os: string) { beforeEach(() => { env.write('node_modules/@angular/router/index.d.ts', ` - import {ModuleWithProviders, ɵɵNgModuleDefWithMeta as ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ModuleWithProviders, ɵɵNgModuleDeclaration as ɵɵNgModuleDeclaration} from '@angular/core'; export declare var ROUTES; export declare class RouterModule { static forRoot(arg1: any, arg2: any): ModuleWithProviders; static forChild(arg1: any): ModuleWithProviders; - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); }); @@ -6699,24 +6706,24 @@ export const Foo = Foo__PRE_R3__; // 'alpha' declares the directive which will ultimately be imported. env.write('alpha.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class AlphaModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); // 'beta' re-exports AlphaModule from alpha. env.write('beta.d.ts', ` - import {ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵNgModuleDeclaration} from '@angular/core'; import {AlphaModule} from './alpha'; export declare class BetaModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -6749,26 +6756,26 @@ export const Foo = Foo__PRE_R3__; it('should write alias ES2015 exports for NgModule exported directives', () => { env.tsconfig({'_useHostForImportGeneration': true}); env.write('external.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; import {LibModule} from './lib'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class ExternalModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('lib.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class LibDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class LibModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); env.write('foo.ts', ` @@ -6907,7 +6914,7 @@ export const Foo = Foo__PRE_R3__; `); env.write('lib.d.ts', ` - import {ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ElementRef} from '@angular/core'; + import {ɵɵComponentDeclaration, ɵɵDirectiveDeclaration, ElementRef} from '@angular/core'; export declare class BasePlain {} @@ -6920,11 +6927,11 @@ export const Foo = Foo__PRE_R3__; } export declare class BaseCmp { - static ɵcmp: ɵɵComponentDefWithMeta + static ɵcmp: ɵɵComponentDeclaration } export declare class BaseDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } `); }); @@ -7643,7 +7650,7 @@ export const Foo = Foo__PRE_R3__; export declare class NgZone {} export declare class Testability { - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDeclaration; constructor(ngZone: NgZone); } `); diff --git a/packages/compiler-cli/test/ngtsc/scope_spec.ts b/packages/compiler-cli/test/ngtsc/scope_spec.ts index e0037e23b83b..3990c5cc861c 100644 --- a/packages/compiler-cli/test/ngtsc/scope_spec.ts +++ b/packages/compiler-cli/test/ngtsc/scope_spec.ts @@ -50,10 +50,10 @@ runInEachFileSystem(() => { it('should detect when a declaration lives outside the current compilation', () => { env.write('dir.d.ts', ` - import {ɵɵDirectiveDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration} from '@angular/core'; export declare class ExternalDir { - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } `); env.write('test.ts', ` @@ -174,7 +174,7 @@ runInEachFileSystem(() => { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); }); it('should produce an error when an invalid class is imported', () => { @@ -237,7 +237,7 @@ runInEachFileSystem(() => { const dtsContents = env.getContents('test.d.ts'); expect(dtsContents) .toContain( - 'static ɵmod: i0.ɵɵNgModuleDefWithMeta'); + 'static ɵmod: i0.ɵɵNgModuleDeclaration'); }); it('should produce an error when a non-NgModule class is exported', () => { diff --git a/packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts b/packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts index fc060b60986d..83306ea997e9 100644 --- a/packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts +++ b/packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts @@ -42,7 +42,7 @@ export declare class NgForOfContext = i0.NgIterabl export declare class IndexPipe { transform(value: T[], index: number): T; - static ɵpipe: i0.ɵPipeDefWithMeta; + static ɵpipe: i0.ɵPipeDeclaration; } export declare class SlicePipe { @@ -52,7 +52,7 @@ export declare class SlicePipe { transform(value: undefined, start: number, end?: number): undefined; transform(value: any, start: number, end?: number): any; - static ɵpipe: i0.ɵPipeDefWithMeta; + static ɵpipe: i0.ɵPipeDeclaration; } export declare class NgForOf = i0.NgIterable> implements DoCheck { @@ -62,7 +62,7 @@ export declare class NgForOf = i0.NgIterable> i constructor(_viewContainer: ViewContainerRef, _template: TemplateRef>, _differs: IterableDiffers); ngDoCheck(): void; static ngTemplateContextGuard>(dir: NgForOf, ctx: any): ctx is NgForOfContext; - static ɵdir: i0.ɵɵDirectiveDefWithMeta, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>; } export declare class NgIf { @@ -72,7 +72,7 @@ export declare class NgIf { constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef>); static ngTemplateGuard_ngIf: 'binding'; static ngTemplateContextGuard(dir: NgIf, ctx: any): ctx is NgIfContext>; - static ɵdir: i0.ɵɵDirectiveDefWithMeta, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>; } export declare class NgIfContext { @@ -81,7 +81,7 @@ export declare class NgIfContext { } export declare class CommonModule { - static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵmod: i0.ɵɵNgModuleDeclaration; } `); env.write('node_modules/@angular/animations/index.d.ts', ` @@ -1346,17 +1346,17 @@ export declare class AnimationEvent { export declare class AbstractDir { fromAbstract: number; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class BaseDir extends AbstractDir { fromBase: string; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵdir: i0.ɵɵDirectiveDeclaration; } export declare class ExternalModule { - static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵmod: i0.ɵɵNgModuleDeclaration; } `); @@ -1472,25 +1472,25 @@ export declare class AnimationEvent { // 'alpha' declares the directive which will ultimately be imported. env.write('alpha.d.ts', ` - import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵDirectiveDeclaration, ɵɵNgModuleDeclaration} from '@angular/core'; export declare class ExternalDir { input: string; - static ɵdir: ɵɵDirectiveDefWithMeta; + static ɵdir: ɵɵDirectiveDeclaration; } export declare class AlphaModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); // 'beta' re-exports AlphaModule from alpha. env.write('beta.d.ts', ` - import {ɵɵNgModuleDefWithMeta} from '@angular/core'; + import {ɵɵNgModuleDeclaration} from '@angular/core'; import {AlphaModule} from './alpha'; export declare class BetaModule { - static ɵmod: ɵɵNgModuleDefWithMeta; + static ɵmod: ɵɵNgModuleDeclaration; } `); @@ -1525,12 +1525,12 @@ export declare class AnimationEvent { export declare class MatInput { value: string; - static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_value: string|number; } export declare class MatInputModule { - static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵmod: i0.ɵɵNgModuleDeclaration; } `); }); diff --git a/packages/compiler/src/render3/r3_factory.ts b/packages/compiler/src/render3/r3_factory.ts index 1ed89bc85ebe..d39a2ab80d39 100644 --- a/packages/compiler/src/render3/r3_factory.ts +++ b/packages/compiler/src/render3/r3_factory.ts @@ -257,7 +257,8 @@ export function compileFactoryFunction(meta: R3FactoryMetadata): R3CompiledExpre `${meta.name}_Factory`), statements, type: o.expressionType(o.importExpr( - R3.FactoryDef, [typeWithParameters(meta.type.type, meta.typeArgumentCount), ctorDepsType])) + R3.FactoryDeclaration, + [typeWithParameters(meta.type.type, meta.typeArgumentCount), ctorDepsType])) }; } diff --git a/packages/compiler/src/render3/r3_identifiers.ts b/packages/compiler/src/render3/r3_identifiers.ts index 90e3efdd832f..62f8e1a911c4 100644 --- a/packages/compiler/src/render3/r3_identifiers.ts +++ b/packages/compiler/src/render3/r3_identifiers.ts @@ -250,34 +250,33 @@ export class Identifiers { moduleName: CORE, }; - static ComponentDefWithMeta: o.ExternalReference = { - name: 'ɵɵComponentDefWithMeta', + static ComponentDeclaration: o.ExternalReference = { + name: 'ɵɵComponentDeclaration', moduleName: CORE, }; - static FactoryDef: o.ExternalReference = { - name: 'ɵɵFactoryDef', + static FactoryDeclaration: o.ExternalReference = { + name: 'ɵɵFactoryDeclaration', moduleName: CORE, }; static defineDirective: o.ExternalReference = {name: 'ɵɵdefineDirective', moduleName: CORE}; static declareDirective: o.ExternalReference = {name: 'ɵɵngDeclareDirective', moduleName: CORE}; - static DirectiveDefWithMeta: o.ExternalReference = { - name: 'ɵɵDirectiveDefWithMeta', + static DirectiveDeclaration: o.ExternalReference = { + name: 'ɵɵDirectiveDeclaration', moduleName: CORE, }; - static InjectorDef: o.ExternalReference = { - name: 'ɵɵInjectorDef', - moduleName: CORE, - }; + static InjectorDef: o.ExternalReference = {name: 'ɵɵInjectorDef', moduleName: CORE}; + static InjectorDeclaration: + o.ExternalReference = {name: 'ɵɵInjectorDeclaration', moduleName: CORE}; static defineInjector: o.ExternalReference = {name: 'ɵɵdefineInjector', moduleName: CORE}; static declareInjector: o.ExternalReference = {name: 'ɵɵngDeclareInjector', moduleName: CORE}; - static NgModuleDefWithMeta: o.ExternalReference = { - name: 'ɵɵNgModuleDefWithMeta', + static NgModuleDeclaration: o.ExternalReference = { + name: 'ɵɵNgModuleDeclaration', moduleName: CORE, }; @@ -290,7 +289,7 @@ export class Identifiers { static declareNgModule: o.ExternalReference = {name: 'ɵɵngDeclareNgModule', moduleName: CORE}; static setNgModuleScope: o.ExternalReference = {name: 'ɵɵsetNgModuleScope', moduleName: CORE}; - static PipeDefWithMeta: o.ExternalReference = {name: 'ɵɵPipeDefWithMeta', moduleName: CORE}; + static PipeDeclaration: o.ExternalReference = {name: 'ɵɵPipeDeclaration', moduleName: CORE}; static definePipe: o.ExternalReference = {name: 'ɵɵdefinePipe', moduleName: CORE}; static declarePipe: o.ExternalReference = {name: 'ɵɵngDeclarePipe', moduleName: CORE}; diff --git a/packages/compiler/src/render3/r3_injector_compiler.ts b/packages/compiler/src/render3/r3_injector_compiler.ts index 73c779945210..bef3bfa9808e 100644 --- a/packages/compiler/src/render3/r3_injector_compiler.ts +++ b/packages/compiler/src/render3/r3_injector_compiler.ts @@ -37,5 +37,6 @@ export function compileInjector(meta: R3InjectorMetadata): R3CompiledExpression } export function createInjectorType(meta: R3InjectorMetadata): o.Type { - return new o.ExpressionType(o.importExpr(R3.InjectorDef, [new o.ExpressionType(meta.type.type)])); + return new o.ExpressionType( + o.importExpr(R3.InjectorDeclaration, [new o.ExpressionType(meta.type.type)])); } diff --git a/packages/compiler/src/render3/r3_module_compiler.ts b/packages/compiler/src/render3/r3_module_compiler.ts index c19016c451ed..41967712424a 100644 --- a/packages/compiler/src/render3/r3_module_compiler.ts +++ b/packages/compiler/src/render3/r3_module_compiler.ts @@ -212,7 +212,7 @@ export function compileNgModuleDeclarationExpression(meta: R3DeclareNgModuleFaca export function createNgModuleType( {type: moduleType, declarations, imports, exports}: R3NgModuleMetadata): o.ExpressionType { - return new o.ExpressionType(o.importExpr(R3.NgModuleDefWithMeta, [ + return new o.ExpressionType(o.importExpr(R3.NgModuleDeclaration, [ new o.ExpressionType(moduleType.type), tupleTypeOf(declarations), tupleTypeOf(imports), tupleTypeOf(exports) ])); diff --git a/packages/compiler/src/render3/r3_pipe_compiler.ts b/packages/compiler/src/render3/r3_pipe_compiler.ts index f2342086c804..ec11bfb8dd36 100644 --- a/packages/compiler/src/render3/r3_pipe_compiler.ts +++ b/packages/compiler/src/render3/r3_pipe_compiler.ts @@ -72,7 +72,7 @@ export function compilePipeFromMetadata(metadata: R3PipeMetadata): R3CompiledExp } export function createPipeType(metadata: R3PipeMetadata): o.Type { - return new o.ExpressionType(o.importExpr(R3.PipeDefWithMeta, [ + return new o.ExpressionType(o.importExpr(R3.PipeDeclaration, [ typeWithParameters(metadata.type.type, metadata.typeArgumentCount), new o.ExpressionType(new o.LiteralExpr(metadata.pipeName)), ])); diff --git a/packages/compiler/src/render3/view/compiler.ts b/packages/compiler/src/render3/view/compiler.ts index 3d582ee77b5e..76de1f9af4f7 100644 --- a/packages/compiler/src/render3/view/compiler.ts +++ b/packages/compiler/src/render3/view/compiler.ts @@ -266,7 +266,7 @@ export function compileComponentFromMetadata( export function createComponentType(meta: R3ComponentMetadata): o.Type { const typeParams = createDirectiveTypeParams(meta); typeParams.push(stringArrayAsType(meta.template.ngContentSelectors)); - return o.expressionType(o.importExpr(R3.ComponentDefWithMeta, typeParams)); + return o.expressionType(o.importExpr(R3.ComponentDeclaration, typeParams)); } /** @@ -427,7 +427,7 @@ export function createDirectiveTypeParams(meta: R3DirectiveMetadata): o.Type[] { */ export function createDirectiveType(meta: R3DirectiveMetadata): o.Type { const typeParams = createDirectiveTypeParams(meta); - return o.expressionType(o.importExpr(R3.DirectiveDefWithMeta, typeParams)); + return o.expressionType(o.importExpr(R3.DirectiveDeclaration, typeParams)); } // Define and update any view queries diff --git a/packages/compiler/src/render3/view/styling_builder.ts b/packages/compiler/src/render3/view/styling_builder.ts index 5430d04b07f9..c14812e4836c 100644 --- a/packages/compiler/src/render3/view/styling_builder.ts +++ b/packages/compiler/src/render3/view/styling_builder.ts @@ -246,10 +246,6 @@ export class StylingBuilder { const entry: BoundStylingEntry = {name: property, value, sourceSpan, hasOverrideFlag, suffix: null}; if (isMapBased) { - if (this._classMapInput) { - throw new Error( - '[class] and [className] bindings cannot be used on the same element simultaneously'); - } this._classMapInput = entry; } else { (this._singleClassInputs = this._singleClassInputs || []).push(entry); diff --git a/packages/compiler/src/shadow_css.ts b/packages/compiler/src/shadow_css.ts index fc0a295186fa..e8d08e7adbc8 100644 --- a/packages/compiler/src/shadow_css.ts +++ b/packages/compiler/src/shadow_css.ts @@ -720,6 +720,7 @@ function escapeBlocks( */ function combineHostContextSelectors(contextSelectors: string[], otherSelectors: string): string { const hostMarker = _polyfillHostNoCombinator; + _polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors); // If there are no context selectors then just output a host marker diff --git a/packages/compiler/test/shadow_css_spec.ts b/packages/compiler/test/shadow_css_spec.ts index 62642667b6be..32cd76dbab9e 100644 --- a/packages/compiler/test/shadow_css_spec.ts +++ b/packages/compiler/test/shadow_css_spec.ts @@ -286,6 +286,17 @@ import {normalizeCSS} from '@angular/platform-browser/testing/src/browser_util'; expect(s(':host-context(div) > :host(.x) > .y {}', 'contenta', 'a-host')) .toEqual('div > .x[a-host] > .y[contenta] {}'); }); + + it('should parse multiple rules containing :host-context and :host', () => { + const input = ` + :host-context(outer1) :host(bar) {} + :host-context(outer2) :host(foo) {} + `; + expect(s(input, 'contenta', 'a-host')) + .toEqual( + 'outer1 bar[a-host] {} ' + + 'outer2 foo[a-host] {}'); + }); }); it('should support polyfill-next-selector', () => { diff --git a/packages/core/schematics/BUILD.bazel b/packages/core/schematics/BUILD.bazel index 4934255a82dd..5887aa17a34e 100644 --- a/packages/core/schematics/BUILD.bazel +++ b/packages/core/schematics/BUILD.bazel @@ -11,6 +11,7 @@ pkg_npm( visibility = ["//packages/core:__pkg__"], deps = [ "//packages/core/schematics/migrations/abstract-control-parent", + "//packages/core/schematics/migrations/activated-route-snapshot-fragment", "//packages/core/schematics/migrations/can-activate-with-redirect-to", "//packages/core/schematics/migrations/dynamic-queries", "//packages/core/schematics/migrations/initial-navigation", diff --git a/packages/core/schematics/migrations.json b/packages/core/schematics/migrations.json index 9d6d557e64e9..85f5fe8371d3 100644 --- a/packages/core/schematics/migrations.json +++ b/packages/core/schematics/migrations.json @@ -84,6 +84,11 @@ "version": "11.1.0-beta", "description": "Removes `canActivate` from a `Route` config when `redirectTo` is also present", "factory": "./migrations/can-activate-with-redirect-to/index" + }, + "migration-v12-activated-route-snapshot-fragment": { + "version": "12.0.0-beta", + "description": "In Angular version 12, the type of ActivatedRouteSnapshot.fragment is nullable. This migration automatically adds non-null assertions to it.", + "factory": "./migrations/activated-route-snapshot-fragment/index" } } -} \ No newline at end of file +} diff --git a/packages/core/schematics/migrations/abstract-control-parent/util.ts b/packages/core/schematics/migrations/abstract-control-parent/util.ts index f5e47c516fc2..37d5cbff8f5d 100644 --- a/packages/core/schematics/migrations/abstract-control-parent/util.ts +++ b/packages/core/schematics/migrations/abstract-control-parent/util.ts @@ -8,14 +8,11 @@ import {normalize} from 'path'; import * as ts from 'typescript'; +import {isNullCheck, isSafeAccess} from '../../utils/typescript/nodes'; +import {hasOneOfTypes, isNullableType} from '../../utils/typescript/symbol'; /** Names of symbols from `@angular/forms` whose `parent` accesses have to be migrated. */ -const abstractControlSymbols = new Set([ - 'AbstractControl', - 'FormArray', - 'FormControl', - 'FormGroup', -]); +const abstractControlSymbols = ['AbstractControl', 'FormArray', 'FormControl', 'FormGroup']; /** * Finds the `PropertyAccessExpression`-s that are accessing the `parent` property in @@ -38,78 +35,6 @@ export function findParentAccesses( return results; } -/** Checks whether a node's type is nullable (`null`, `undefined` or `void`). */ -function isNullableType(typeChecker: ts.TypeChecker, node: ts.Node) { - // Skip expressions in the form of `foo.bar!.baz` since the `TypeChecker` seems - // to identify them as null, even though the user indicated that it won't be. - if (node.parent && ts.isNonNullExpression(node.parent)) { - return false; - } - - const type = typeChecker.getTypeAtLocation(node); - const typeNode = typeChecker.typeToTypeNode(type, undefined, ts.NodeBuilderFlags.None); - let hasSeenNullableType = false; - - // Trace the type of the node back to a type node, walk - // through all of its sub-nodes and look for nullable tyes. - if (typeNode) { - (function walk(current: ts.Node) { - if (current.kind === ts.SyntaxKind.NullKeyword || - current.kind === ts.SyntaxKind.UndefinedKeyword || - current.kind === ts.SyntaxKind.VoidKeyword) { - hasSeenNullableType = true; - // Note that we don't descend into type literals, because it may cause - // us to mis-identify the root type as nullable, because it has a nullable - // property (e.g. `{ foo: string | null }`). - } else if (!hasSeenNullableType && !ts.isTypeLiteralNode(current)) { - current.forEachChild(walk); - } - })(typeNode); - } - - return hasSeenNullableType; -} - -/** - * Checks whether a particular node is part of a null check. E.g. given: - * `control.parent ? control.parent.value : null` the null check would be `control.parent`. - */ -function isNullCheck(node: ts.PropertyAccessExpression): boolean { - if (!node.parent) { - return false; - } - - // `control.parent && control.parent.value` where `node` is `control.parent`. - if (ts.isBinaryExpression(node.parent) && node.parent.left === node) { - return true; - } - - // `control.parent && control.parent.parent && control.parent.parent.value` - // where `node` is `control.parent`. - if (node.parent.parent && ts.isBinaryExpression(node.parent.parent) && - node.parent.parent.left === node.parent) { - return true; - } - - // `if (control.parent) {...}` where `node` is `control.parent`. - if (ts.isIfStatement(node.parent) && node.parent.expression === node) { - return true; - } - - // `control.parent ? control.parent.value : null` where `node` is `control.parent`. - if (ts.isConditionalExpression(node.parent) && node.parent.condition === node) { - return true; - } - - return false; -} - -/** Checks whether a property access is safe (e.g. `foo.parent?.value`). */ -function isSafeAccess(node: ts.PropertyAccessExpression): boolean { - return node.parent != null && ts.isPropertyAccessExpression(node.parent) && - node.parent.expression === node && node.parent.questionDotToken != null; -} - /** Checks whether a property access is on an `AbstractControl` coming from `@angular/forms`. */ function isAbstractControlReference( typeChecker: ts.TypeChecker, node: ts.PropertyAccessExpression): boolean { @@ -119,37 +44,14 @@ function isAbstractControlReference( // If such a node is found, we check whether the type is one of the `AbstractControl` symbols // and whether it comes from the `@angular/forms` directory in the `node_modules`. while (ts.isPropertyAccessExpression(current)) { - const type = typeChecker.getTypeAtLocation(current.expression); - const symbol = type.getSymbol(); - if (symbol && type) { + const symbol = typeChecker.getTypeAtLocation(current.expression)?.getSymbol(); + if (symbol) { const sourceFile = symbol.valueDeclaration?.getSourceFile(); return sourceFile != null && formsPattern.test(normalize(sourceFile.fileName).replace(/\\/g, '/')) && - hasAbstractControlType(typeChecker, type); + hasOneOfTypes(typeChecker, current.expression, abstractControlSymbols); } current = current.expression; } return false; } - -/** - * Walks through the sub-types of a type, looking for a type that - * has the same name as one of the `AbstractControl` types. - */ -function hasAbstractControlType(typeChecker: ts.TypeChecker, type: ts.Type): boolean { - const typeNode = typeChecker.typeToTypeNode(type, undefined, ts.NodeBuilderFlags.None); - let hasMatch = false; - if (typeNode) { - (function walk(current: ts.Node) { - if (ts.isIdentifier(current) && abstractControlSymbols.has(current.text)) { - hasMatch = true; - // Note that we don't descend into type literals, because it may cause - // us to mis-identify the root type as nullable, because it has a nullable - // property (e.g. `{ foo: FormControl }`). - } else if (!hasMatch && !ts.isTypeLiteralNode(current)) { - current.forEachChild(walk); - } - })(typeNode); - } - return hasMatch; -} diff --git a/packages/core/schematics/migrations/activated-route-snapshot-fragment/BUILD.bazel b/packages/core/schematics/migrations/activated-route-snapshot-fragment/BUILD.bazel new file mode 100644 index 000000000000..ff42f9dc839e --- /dev/null +++ b/packages/core/schematics/migrations/activated-route-snapshot-fragment/BUILD.bazel @@ -0,0 +1,18 @@ +load("//tools:defaults.bzl", "ts_library") + +ts_library( + name = "activated-route-snapshot-fragment", + srcs = glob(["**/*.ts"]), + tsconfig = "//packages/core/schematics:tsconfig.json", + visibility = [ + "//packages/core/schematics:__pkg__", + "//packages/core/schematics/migrations/google3:__pkg__", + "//packages/core/schematics/test:__pkg__", + ], + deps = [ + "//packages/core/schematics/utils", + "@npm//@angular-devkit/schematics", + "@npm//@types/node", + "@npm//typescript", + ], +) diff --git a/packages/core/schematics/migrations/activated-route-snapshot-fragment/README.md b/packages/core/schematics/migrations/activated-route-snapshot-fragment/README.md new file mode 100644 index 000000000000..b7bc129091b4 --- /dev/null +++ b/packages/core/schematics/migrations/activated-route-snapshot-fragment/README.md @@ -0,0 +1,34 @@ +## `ActivatedRouteSnapshot.fragment` migration + +The value if `ActivatedRouteSnapshot.fragment` is becoming nullable. This migration adds non-null +assertions to it. + +#### Before +```ts +import { Component } from '@angular/core'; +import { ActivatedRouteSnapshot } from '@angular/router'; + +@Component({}) +export class YourComponent { + private _activatedRouteSnapshot: ActivatedRouteSnapshot; + + getFragmentValue() { + return this._activatedRouteSnapshot.fragment.value; + } +} +``` + +#### After +```ts +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +@Component({}) +export class YourComponent { + private _activatedRouteSnapshot: ActivatedRouteSnapshot; + + getFragmentValue() { + return this._activatedRouteSnapshot.fragment!.value; + } +} +``` diff --git a/packages/core/schematics/migrations/activated-route-snapshot-fragment/index.ts b/packages/core/schematics/migrations/activated-route-snapshot-fragment/index.ts new file mode 100644 index 000000000000..447ceec7cb78 --- /dev/null +++ b/packages/core/schematics/migrations/activated-route-snapshot-fragment/index.ts @@ -0,0 +1,62 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {Rule, SchematicsException, Tree} from '@angular-devkit/schematics'; +import {relative} from 'path'; +import * as ts from 'typescript'; + +import {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths'; +import {canMigrateFile, createMigrationProgram} from '../../utils/typescript/compiler_host'; +import {findFragmentAccesses, migrateActivatedRouteSnapshotFragment} from './util'; + + +/** + * Migration that marks accesses of `ActivatedRouteSnapshot.fragment` as non-null. + */ +export default function(): Rule { + return (tree: Tree) => { + const {buildPaths, testPaths} = getProjectTsConfigPaths(tree); + const basePath = process.cwd(); + const allPaths = [...buildPaths, ...testPaths]; + + if (!allPaths.length) { + throw new SchematicsException( + 'Could not find any tsconfig file. Cannot migrate ' + + '`ActivatedRouteSnapshot.fragment` accesses.'); + } + + for (const tsconfigPath of allPaths) { + runActivatedRouteSnapshotFragmentMigration(tree, tsconfigPath, basePath); + } + }; +} + +function runActivatedRouteSnapshotFragmentMigration( + tree: Tree, tsconfigPath: string, basePath: string) { + const {program} = createMigrationProgram(tree, tsconfigPath, basePath); + const typeChecker = program.getTypeChecker(); + const sourceFiles = + program.getSourceFiles().filter(sourceFile => canMigrateFile(basePath, sourceFile, program)); + const printer = ts.createPrinter(); + + sourceFiles.forEach(sourceFile => { + const nodesToMigrate = findFragmentAccesses(typeChecker, sourceFile); + + if (nodesToMigrate.size > 0) { + const update = tree.beginUpdate(relative(basePath, sourceFile.fileName)); + nodesToMigrate.forEach(node => { + update.remove(node.getStart(), node.getWidth()); + update.insertRight( + node.getStart(), + printer.printNode( + ts.EmitHint.Unspecified, migrateActivatedRouteSnapshotFragment(node), sourceFile)); + }); + tree.commitUpdate(update); + } + }); +} diff --git a/packages/core/schematics/migrations/activated-route-snapshot-fragment/util.ts b/packages/core/schematics/migrations/activated-route-snapshot-fragment/util.ts new file mode 100644 index 000000000000..681882f39d9b --- /dev/null +++ b/packages/core/schematics/migrations/activated-route-snapshot-fragment/util.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import * as ts from 'typescript'; +import {isNullCheck, isSafeAccess} from '../../utils/typescript/nodes'; +import {hasOneOfTypes, isNullableType} from '../../utils/typescript/symbol'; + +/** + * Finds all the accesses of `ActivatedRouteSnapshot.fragment` + * that need to be migrated within a particular file. + */ +export function findFragmentAccesses( + typeChecker: ts.TypeChecker, sourceFile: ts.SourceFile): Set { + const results = new Set(); + + sourceFile.forEachChild(function walk(node: ts.Node) { + if (ts.isPropertyAccessExpression(node) && node.name.text === 'fragment' && + !results.has(node) && !isNullCheck(node) && !isSafeAccess(node) && + hasOneOfTypes(typeChecker, node.expression, ['ActivatedRouteSnapshot']) && + isNullableType(typeChecker, node)) { + results.add(node); + } + + node.forEachChild(walk); + }); + + return results; +} + +/** Migrates an `ActivatedRouteSnapshot.fragment` access. */ +export function migrateActivatedRouteSnapshotFragment(node: ts.PropertyAccessExpression): ts.Node { + // Turns `foo.fragment` into `foo.fragment!`. + return ts.createNonNullExpression(node); +} diff --git a/packages/core/schematics/migrations/google3/BUILD.bazel b/packages/core/schematics/migrations/google3/BUILD.bazel index 1fcd8e91f9de..bd21e587de1a 100644 --- a/packages/core/schematics/migrations/google3/BUILD.bazel +++ b/packages/core/schematics/migrations/google3/BUILD.bazel @@ -6,6 +6,7 @@ ts_library( tsconfig = "//packages/core/schematics:tsconfig.json", visibility = ["//packages/core/schematics/test/google3:__pkg__"], deps = [ + "//packages/core/schematics/migrations/activated-route-snapshot-fragment", "//packages/core/schematics/migrations/can-activate-with-redirect-to", "//packages/core/schematics/migrations/dynamic-queries", "//packages/core/schematics/migrations/initial-navigation", diff --git a/packages/core/schematics/migrations/google3/activatedRouteSnapshotFragmentRule.ts b/packages/core/schematics/migrations/google3/activatedRouteSnapshotFragmentRule.ts new file mode 100644 index 000000000000..4b55b2bc3c78 --- /dev/null +++ b/packages/core/schematics/migrations/google3/activatedRouteSnapshotFragmentRule.ts @@ -0,0 +1,40 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {Replacement, RuleFailure, Rules} from 'tslint'; +import * as ts from 'typescript'; + +import {findFragmentAccesses, migrateActivatedRouteSnapshotFragment} from '../activated-route-snapshot-fragment/util'; + +export class Rule extends Rules.TypedRule { + applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] { + if (sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) { + return []; + } + + const failures: RuleFailure[] = []; + const typeChecker = program.getTypeChecker(); + const nodesToMigrate = findFragmentAccesses(typeChecker, sourceFile); + + if (nodesToMigrate.size > 0) { + const printer = ts.createPrinter(); + nodesToMigrate.forEach(node => { + const sourceFile = node.getSourceFile(); + const migratedNode = migrateActivatedRouteSnapshotFragment(node); + const replacement = new Replacement( + node.getStart(), node.getWidth(), + printer.printNode(ts.EmitHint.Unspecified, migratedNode, sourceFile)); + failures.push(new RuleFailure( + sourceFile, node.getStart(), node.getEnd(), + '`ActivatedRouteSnapshot.fragment` is nullable.', this.ruleName, replacement)); + }); + } + + return failures; + } +} diff --git a/packages/core/schematics/test/BUILD.bazel b/packages/core/schematics/test/BUILD.bazel index c6d62041e897..93a4fec3f23b 100644 --- a/packages/core/schematics/test/BUILD.bazel +++ b/packages/core/schematics/test/BUILD.bazel @@ -9,6 +9,7 @@ ts_library( ], deps = [ "//packages/core/schematics/migrations/abstract-control-parent", + "//packages/core/schematics/migrations/activated-route-snapshot-fragment", "//packages/core/schematics/migrations/can-activate-with-redirect-to", "//packages/core/schematics/migrations/dynamic-queries", "//packages/core/schematics/migrations/initial-navigation", diff --git a/packages/core/schematics/test/activated_route_snapshot_fragment_migration_spec.ts b/packages/core/schematics/test/activated_route_snapshot_fragment_migration_spec.ts new file mode 100644 index 000000000000..4d352e524f5c --- /dev/null +++ b/packages/core/schematics/test/activated_route_snapshot_fragment_migration_spec.ts @@ -0,0 +1,186 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {getSystemPath, normalize, virtualFs} from '@angular-devkit/core'; +import {TempScopedNodeJsSyncHost} from '@angular-devkit/core/node/testing'; +import {HostTree} from '@angular-devkit/schematics'; +import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing'; +import * as shx from 'shelljs'; + +describe('ActivatedRouteSnapshot.fragment migration', () => { + let runner: SchematicTestRunner; + let host: TempScopedNodeJsSyncHost; + let tree: UnitTestTree; + let tmpDirPath: string; + let previousWorkingDir: string; + + beforeEach(() => { + runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); + host = new TempScopedNodeJsSyncHost(); + tree = new UnitTestTree(new HostTree(host)); + + writeFile('/tsconfig.json', JSON.stringify({ + compilerOptions: {lib: ['es2015'], strictNullChecks: true}, + })); + writeFile('/angular.json', JSON.stringify({ + projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}} + })); + // We need to declare the Angular symbols we're testing for, otherwise type checking won't work. + writeFile('/node_modules/@angular/router.d.ts', ` + export declare class ActivatedRoute { + get children(): ActivatedRoute[]; + fragment: Observable; + snapshot: ActivatedRouteSnapshot; + url: Observable; + } + + export declare class ActivatedRouteSnapshot { + fragment: string | null; + url: unknown[]; + } + `); + + previousWorkingDir = shx.pwd(); + tmpDirPath = getSystemPath(host.root); + + // Switch into the temporary directory path. This allows us to run + // the schematic against our custom unit test tree. + shx.cd(tmpDirPath); + }); + + afterEach(() => { + shx.cd(previousWorkingDir); + shx.rm('-r', tmpDirPath); + }); + + it('should add non-null assertions to accesses of `ActivatedRouteSnapshot.fragment`', + async () => { + writeFile('/index.ts', ` + import {ActivatedRoute} from '@angular/router'; + + class App { + private _route: ActivatedRoute; + + getFragment() { + return this._getSnapshot().fragment.foo; + } + + private _getSnapshot() { + return this._route.snapshot; + } + } + `); + + await runMigration(); + + expect(tree.readContent('/index.ts')).toContain('return this._getSnapshot().fragment!.foo'); + }); + + it('should not add non-null assertions to accesses of `ActivatedRouteSnapshot.fragment` if there is one already', + async () => { + writeFile('/index.ts', ` + import {ActivatedRoute} from '@angular/router'; + + class App { + private _route: ActivatedRoute; + + getFragment() { + return this._route.snapshot.fragment!.foo; + } + } + `); + + await runMigration(); + + expect(tree.readContent('/index.ts')) + .toContain('return this._route.snapshot.fragment!.foo;'); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in an if statement', + async () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getFragmentValue(snapshot: ActivatedRouteSnapshot) { + if (snapshot.fragment) { + return snapshot.fragment.value; + } + + return null; + } + `); + + await runMigration(); + + const content = tree.readContent('/index.ts'); + expect(content).toContain(`if (snapshot.fragment) {`); + expect(content).toContain(`return snapshot.fragment.value;`); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in an else if statement', + async () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(foo: boolean, snapshot: ActivatedRouteSnapshot) { + if (foo) { + return foo; + } else if (snapshot.fragment) { + return snapshot.fragment.value; + } + + return null; + } + `); + + await runMigration(); + + const content = tree.readContent('/index.ts'); + expect(content).toContain(`} else if (snapshot.fragment) {`); + expect(content).toContain(`return snapshot.fragment.value;`); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in a ternary expression', + async () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(snapshot: ActivatedRouteSnapshot) { + return snapshot.fragment ? snapshot.fragment.value : null; + } + `); + + await runMigration(); + + expect(tree.readContent('/index.ts')) + .toContain(`return snapshot.fragment ? snapshot.fragment.value : null;`); + }); + + it('should not add non-null assertion to `ActivatedRouteSnapshot.fragment` if there is a safe access', + async () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(snapshot: ActivatedRouteSnapshot) { + return snapshot.fragment?.value; + } + `); + + await runMigration(); + expect(tree.readContent('/index.ts')).toContain(`return snapshot.fragment?.value;`); + }); + + function writeFile(filePath: string, contents: string) { + host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); + } + + function runMigration() { + return runner.runSchematicAsync('migration-v12-activated-route-snapshot-fragment', {}, tree) + .toPromise(); + } +}); diff --git a/packages/core/schematics/test/google3/activated_route_snapshot_fragment_spec.ts b/packages/core/schematics/test/google3/activated_route_snapshot_fragment_spec.ts new file mode 100644 index 000000000000..19232cf1a900 --- /dev/null +++ b/packages/core/schematics/test/google3/activated_route_snapshot_fragment_spec.ts @@ -0,0 +1,210 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {readFileSync, writeFileSync} from 'fs'; +import {dirname, join} from 'path'; +import * as shx from 'shelljs'; +import {Configuration, Linter} from 'tslint'; + +describe('Google3 ActivatedRouteSnapshot.fragment TSLint rule', () => { + const rulesDirectory = + dirname(require.resolve('../../migrations/google3/activatedRouteSnapshotFragmentRule')); + + let tmpDir: string; + + beforeEach(() => { + tmpDir = join(process.env['TEST_TMPDIR']!, 'google3-test'); + shx.mkdir('-p', tmpDir); + + // We need to declare the Angular symbols we're testing for, otherwise type checking won't work. + writeFile('router.d.ts', ` + export declare class ActivatedRoute { + get children(): ActivatedRoute[]; + fragment: Observable; + snapshot: ActivatedRouteSnapshot; + url: Observable; + } + + export declare class ActivatedRouteSnapshot { + fragment: string | null; + url: UrlSegment[]; + } + `); + + writeFile('tsconfig.json', JSON.stringify({ + compilerOptions: { + module: 'es2015', + baseUrl: './', + strictNullChecks: true, + paths: { + '@angular/router': ['router.d.ts'], + } + }, + })); + }); + + afterEach(() => shx.rm('-r', tmpDir)); + + function runTSLint(fix: boolean) { + const program = Linter.createProgram(join(tmpDir, 'tsconfig.json')); + const linter = new Linter({fix, rulesDirectory: [rulesDirectory]}, program); + const config = + Configuration.parseConfigFile({rules: {'activated-route-snapshot-fragment': true}}); + + program.getRootFileNames().forEach(fileName => { + linter.lint(fileName, program.getSourceFile(fileName)!.getFullText(), config); + }); + + return linter; + } + + function writeFile(fileName: string, content: string) { + writeFileSync(join(tmpDir, fileName), content); + } + + function getFile(fileName: string) { + return readFileSync(join(tmpDir, fileName), 'utf8'); + } + + it('should flag accesses to `ActivatedRouteSnapshot.fragment`', () => { + writeFile('/index.ts', ` + import {ActivatedRoute} from '@angular/router'; + + class App { + private _route: ActivatedRoute; + + ngOnInit() { + this._route.fragment.subscribe(); + } + + getFragment() { + return this._route.snapshot.fragment.foo; + } + } + `); + + const linter = runTSLint(false); + const failures = linter.getResult().failures.map(failure => failure.getFailure()); + expect(failures).toEqual(['`ActivatedRouteSnapshot.fragment` is nullable.']); + }); + + it('should add non-null assertions to accesses of `ActivatedRouteSnapshot.fragment`', () => { + writeFile('/index.ts', ` + import {ActivatedRoute} from '@angular/router'; + + class App { + private _route: ActivatedRoute; + + getFragment() { + return this._getSnapshot().fragment.foo; + } + + private _getSnapshot() { + return this._route.snapshot; + } + } + `); + + runTSLint(true); + + expect(getFile('/index.ts')).toContain('return this._getSnapshot().fragment!.foo'); + }); + + it('should not add non-null assertions to accesses of `ActivatedRouteSnapshot.fragment` if there is one already', + () => { + writeFile('/index.ts', ` + import {ActivatedRoute} from '@angular/router'; + + class App { + private _route: ActivatedRoute; + + getFragment() { + return this._route.snapshot.fragment!.foo; + } + } + `); + + runTSLint(true); + + expect(getFile('/index.ts')).toContain('return this._route.snapshot.fragment!.foo;'); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in an if statement', + () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getFragmentValue(snapshot: ActivatedRouteSnapshot) { + if (snapshot.fragment) { + return snapshot.fragment.value; + } + + return null; + } + `); + + runTSLint(true); + + const content = getFile('/index.ts'); + expect(content).toContain(`if (snapshot.fragment) {`); + expect(content).toContain(`return snapshot.fragment.value;`); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in an else if statement', + () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(foo: boolean, snapshot: ActivatedRouteSnapshot) { + if (foo) { + return foo; + } else if (snapshot.fragment) { + return snapshot.fragment.value; + } + + return null; + } + `); + + runTSLint(true); + + const content = getFile('/index.ts'); + expect(content).toContain(`} else if (snapshot.fragment) {`); + expect(content).toContain(`return snapshot.fragment.value;`); + }); + + it('should not add non-null assertions if the `ActivatedRouteSnapshot.fragment` has been null checked in a ternary expression', + () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(snapshot: ActivatedRouteSnapshot) { + return snapshot.fragment ? snapshot.fragment.value : null; + } + `); + + runTSLint(true); + + expect(getFile('/index.ts')) + .toContain(`return snapshot.fragment ? snapshot.fragment.value : null;`); + }); + + it('should not add non-null assertion to `ActivatedRouteSnapshot.fragment` if there is a safe access', + () => { + writeFile('/index.ts', ` + import {ActivatedRouteSnapshot} from '@angular/router'; + + function getSnapshotValue(snapshot: ActivatedRouteSnapshot) { + return snapshot.fragment?.value; + } + `); + + runTSLint(true); + expect(getFile('/index.ts')).toContain(`return snapshot.fragment?.value;`); + }); +}); diff --git a/packages/core/schematics/utils/typescript/nodes.ts b/packages/core/schematics/utils/typescript/nodes.ts index f6b5a3eb0a2f..f14f4ef46b80 100644 --- a/packages/core/schematics/utils/typescript/nodes.ts +++ b/packages/core/schematics/utils/typescript/nodes.ts @@ -26,3 +26,43 @@ export function closestNode(node: ts.Node, kind: ts.SyntaxKin return null; } + +/** + * Checks whether a particular node is part of a null check. E.g. given: + * `foo.bar ? foo.bar.value : null` the null check would be `foo.bar`. + */ +export function isNullCheck(node: ts.Node): boolean { + if (!node.parent) { + return false; + } + + // `foo.bar && foo.bar.value` where `node` is `foo.bar`. + if (ts.isBinaryExpression(node.parent) && node.parent.left === node) { + return true; + } + + // `foo.bar && foo.bar.parent && foo.bar.parent.value` + // where `node` is `foo.bar`. + if (node.parent.parent && ts.isBinaryExpression(node.parent.parent) && + node.parent.parent.left === node.parent) { + return true; + } + + // `if (foo.bar) {...}` where `node` is `foo.bar`. + if (ts.isIfStatement(node.parent) && node.parent.expression === node) { + return true; + } + + // `foo.bar ? foo.bar.value : null` where `node` is `foo.bar`. + if (ts.isConditionalExpression(node.parent) && node.parent.condition === node) { + return true; + } + + return false; +} + +/** Checks whether a property access is safe (e.g. `foo.parent?.value`). */ +export function isSafeAccess(node: ts.Node): boolean { + return node.parent != null && ts.isPropertyAccessExpression(node.parent) && + node.parent.expression === node && node.parent.questionDotToken != null; +} diff --git a/packages/core/schematics/utils/typescript/symbol.ts b/packages/core/schematics/utils/typescript/symbol.ts index 9d4bbffd1fdc..a63cc3a98964 100644 --- a/packages/core/schematics/utils/typescript/symbol.ts +++ b/packages/core/schematics/utils/typescript/symbol.ts @@ -27,3 +27,57 @@ export function isReferenceToImport( return !!(nodeSymbol && importSymbol) && nodeSymbol.valueDeclaration === importSymbol.valueDeclaration; } + +/** Checks whether a node's type is nullable (`null`, `undefined` or `void`). */ +export function isNullableType(typeChecker: ts.TypeChecker, node: ts.Node) { + // Skip expressions in the form of `foo.bar!.baz` since the `TypeChecker` seems + // to identify them as null, even though the user indicated that it won't be. + if (node.parent && ts.isNonNullExpression(node.parent)) { + return false; + } + + const type = typeChecker.getTypeAtLocation(node); + const typeNode = typeChecker.typeToTypeNode(type, undefined, ts.NodeBuilderFlags.None); + let hasSeenNullableType = false; + + // Trace the type of the node back to a type node, walk + // through all of its sub-nodes and look for nullable tyes. + if (typeNode) { + (function walk(current: ts.Node) { + if (current.kind === ts.SyntaxKind.NullKeyword || + current.kind === ts.SyntaxKind.UndefinedKeyword || + current.kind === ts.SyntaxKind.VoidKeyword) { + hasSeenNullableType = true; + // Note that we don't descend into type literals, because it may cause + // us to mis-identify the root type as nullable, because it has a nullable + // property (e.g. `{ foo: string | null }`). + } else if (!hasSeenNullableType && !ts.isTypeLiteralNode(current)) { + current.forEachChild(walk); + } + })(typeNode); + } + + return hasSeenNullableType; +} + +/** + * Walks through the types and sub-types of a node, looking for a + * type that has the same name as one of the passed-in ones. + */ +export function hasOneOfTypes( + typeChecker: ts.TypeChecker, node: ts.Node, types: string[]): boolean { + const type = typeChecker.getTypeAtLocation(node); + const typeNode = + type ? typeChecker.typeToTypeNode(type, undefined, ts.NodeBuilderFlags.None) : undefined; + let hasMatch = false; + if (typeNode) { + (function walk(current: ts.Node) { + if (ts.isIdentifier(current) && types.includes(current.text)) { + hasMatch = true; + } else if (!hasMatch && !ts.isTypeLiteralNode(current)) { + current.forEachChild(walk); + } + })(typeNode); + } + return hasMatch; +} diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index 1836e5a550b2..6006e282b083 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -56,9 +56,6 @@ export { SWITCH_COMPILE_DIRECTIVE__POST_R3__ as ɵSWITCH_COMPILE_DIRECTIVE__POST_R3__, SWITCH_COMPILE_PIPE__POST_R3__ as ɵSWITCH_COMPILE_PIPE__POST_R3__, } from './metadata/directives'; -export { - ɵɵNgModuleDefWithMeta, -} from './metadata/ng_module'; export { SWITCH_COMPILE_NGMODULE__POST_R3__ as ɵSWITCH_COMPILE_NGMODULE__POST_R3__, } from './metadata/ng_module'; @@ -126,14 +123,14 @@ export { ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, - ɵɵComponentDefWithMeta, + ɵɵComponentDeclaration, ɵɵcontentQuery, ɵɵCopyDefinitionFeature, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineNgModule, ɵɵdefinePipe, - ɵɵDirectiveDefWithMeta, + ɵɵDirectiveDeclaration, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, @@ -143,7 +140,7 @@ export { ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, - ɵɵFactoryDef, + ɵɵFactoryDeclaration, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, @@ -156,6 +153,7 @@ export { ɵɵi18nStart, ɵɵInheritDefinitionFeature, ɵɵinjectAttribute, + ɵɵInjectorDeclaration, ɵɵinjectPipeChangeDetectorRef, ɵɵinvalidFactory, ɵɵlistener, @@ -164,6 +162,7 @@ export { ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, + ɵɵNgModuleDeclaration, ɵɵNgOnChangesFeature, ɵɵpipe, ɵɵpipeBind1, @@ -171,7 +170,7 @@ export { ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, - ɵɵPipeDefWithMeta, + ɵɵPipeDeclaration, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, diff --git a/packages/core/src/di/interface/defs.ts b/packages/core/src/di/interface/defs.ts index 764cc2dc2cdf..9c4395aff2c9 100644 --- a/packages/core/src/di/interface/defs.ts +++ b/packages/core/src/di/interface/defs.ts @@ -19,7 +19,7 @@ import {ClassProvider, ConstructorProvider, ExistingProvider, FactoryProvider, S * requesting injection of other types if necessary. * * Optionally, a `providedIn` parameter specifies that the given type belongs to a particular - * `InjectorDef`, `NgModule`, or a special scope (e.g. `'root'`). A value of `null` indicates + * `Injector`, `NgModule`, or a special scope (e.g. `'root'`). A value of `null` indicates * that the injectable does not belong to any scope. * * @codeGenApi @@ -80,7 +80,7 @@ export interface ɵɵInjectorDef { /** * A `Type` which has an `InjectableDef` static field. * - * `InjectableDefType`s contain their own Dependency Injection metadata and are usable in an + * `InjectableType`s contain their own Dependency Injection metadata and are usable in an * `InjectorDef`-based `StaticInjector. * * @publicApi @@ -95,7 +95,7 @@ export interface InjectableType extends Type { /** * A type which has an `InjectorDef` static field. * - * `InjectorDefTypes` can be used to configure a `StaticInjector`. + * `InjectorTypes` can be used to configure a `StaticInjector`. * * This is an opaque type whose structure is highly version dependent. Do not rely on any * properties. @@ -108,7 +108,7 @@ export interface InjectorType extends Type { } /** - * Describes the `InjectorDef` equivalent of a `ModuleWithProviders`, an `InjectorDefType` with an + * Describes the `InjectorDef` equivalent of a `ModuleWithProviders`, an `InjectorType` with an * associated array of providers. * * Objects of this type can be listed in the imports section of an `InjectorDef`. diff --git a/packages/core/src/metadata/ng_module.ts b/packages/core/src/metadata/ng_module.ts index 731a97fe76a9..f23f0dc29ca4 100644 --- a/packages/core/src/metadata/ng_module.ts +++ b/packages/core/src/metadata/ng_module.ts @@ -13,13 +13,6 @@ import {Type} from '../interface/type'; import {SchemaMetadata} from '../metadata/schema'; import {compileNgModule as render3CompileNgModule} from '../render3/jit/module'; import {makeDecorator, TypeDecorator} from '../util/decorators'; -import {NgModuleDef} from './ng_module_def'; - - -/** - * @publicApi - */ -export type ɵɵNgModuleDefWithMeta = NgModuleDef; /** diff --git a/packages/core/src/r3_symbols.ts b/packages/core/src/r3_symbols.ts index 480dd740755e..7d2d0e74b943 100644 --- a/packages/core/src/r3_symbols.ts +++ b/packages/core/src/r3_symbols.ts @@ -22,11 +22,10 @@ */ export {ɵɵinject} from './di/injector_compatibility'; -export {ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵInjectableDef, ɵɵInjectorDef} from './di/interface/defs'; -export {ɵɵNgModuleDefWithMeta} from './metadata/ng_module'; +export {ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵInjectableDef} from './di/interface/defs'; export {NgModuleDef} from './metadata/ng_module_def'; export {ɵɵdefineNgModule} from './render3/definition'; -export {ɵɵFactoryDef} from './render3/interfaces/definition'; +export {ɵɵFactoryDeclaration, ɵɵInjectorDeclaration, ɵɵNgModuleDeclaration} from './render3/interfaces/public_definitions'; export {setClassMetadata} from './render3/metadata'; export {NgModuleFactory} from './render3/ng_module_ref'; export {noSideEffects as ɵnoSideEffects} from './util/closure'; diff --git a/packages/core/src/reflection/reflection_capabilities.ts b/packages/core/src/reflection/reflection_capabilities.ts index 75575ebb135f..c4ad36405b45 100644 --- a/packages/core/src/reflection/reflection_capabilities.ts +++ b/packages/core/src/reflection/reflection_capabilities.ts @@ -34,15 +34,22 @@ import {GetterFn, MethodFn, SetterFn} from './types'; * var _this = _super.apply(this, arguments) || this; * ``` * + * downleveled to ES5 with `downlevelIteration` for TypeScript < 4.2: * ``` * function MyClass() { * var _this = _super.apply(this, __spread(arguments)) || this; * ``` * + * or downleveled to ES5 with `downlevelIteration` for TypeScript >= 4.2: + * ``` + * function MyClass() { + * var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + * ``` + * * More details can be found in: https://github.com/angular/angular/issues/38453. */ export const ES5_DELEGATE_CTOR = - /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|[^()]+\(arguments\))\)/; + /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\))\)/; /** Regular expression that detects ES2015 classes which extend from other classes. */ export const ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; /** diff --git a/packages/core/src/render3/STORING_METADATA_IN_D.TS.md b/packages/core/src/render3/STORING_METADATA_IN_D.TS.md index 6d0054c9e5c6..c5e73c75708d 100644 --- a/packages/core/src/render3/STORING_METADATA_IN_D.TS.md +++ b/packages/core/src/render3/STORING_METADATA_IN_D.TS.md @@ -52,6 +52,6 @@ We store the information in the `.d.ts` file like so. ```typescript class TooltipDirective { - static ɵdir: DirectiveDefWithMeta + static ɵdir: DirectiveDeclaration } ``` diff --git a/packages/core/src/render3/index.ts b/packages/core/src/render3/index.ts index 1d1322c36ebd..417f266912e7 100644 --- a/packages/core/src/render3/index.ts +++ b/packages/core/src/render3/index.ts @@ -11,7 +11,8 @@ import {ɵɵCopyDefinitionFeature} from './features/copy_definition_feature'; import {ɵɵInheritDefinitionFeature} from './features/inherit_definition_feature'; import {ɵɵNgOnChangesFeature} from './features/ng_onchanges_feature'; import {ɵɵProvidersFeature} from './features/providers_feature'; -import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, PipeDef, ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ɵɵFactoryDef, ɵɵPipeDefWithMeta} from './interfaces/definition'; +import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, PipeDef} from './interfaces/definition'; +import {ɵɵComponentDeclaration, ɵɵDirectiveDeclaration, ɵɵFactoryDeclaration, ɵɵInjectorDeclaration, ɵɵNgModuleDeclaration, ɵɵPipeDeclaration} from './interfaces/public_definitions'; import {getComponent, getDirectives, getHostElement, getRenderedText} from './util/discovery_utils'; export {NgModuleType} from '../metadata/ng_module_def'; @@ -188,17 +189,19 @@ export { PipeDef, renderComponent, whenRendered, - ɵɵComponentDefWithMeta, + ɵɵComponentDeclaration, ɵɵCopyDefinitionFeature, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineNgModule, ɵɵdefinePipe, - ɵɵDirectiveDefWithMeta, - ɵɵFactoryDef, + ɵɵDirectiveDeclaration, + ɵɵFactoryDeclaration, ɵɵInheritDefinitionFeature, + ɵɵInjectorDeclaration, + ɵɵNgModuleDeclaration, ɵɵNgOnChangesFeature, - ɵɵPipeDefWithMeta, + ɵɵPipeDeclaration, ɵɵProvidersFeature, ɵɵsetComponentScope, ɵɵsetNgModuleScope, diff --git a/packages/core/src/render3/interfaces/definition.ts b/packages/core/src/render3/interfaces/definition.ts index d25d2bb51426..9f0c2e09b334 100644 --- a/packages/core/src/render3/interfaces/definition.ts +++ b/packages/core/src/render3/interfaces/definition.ts @@ -79,48 +79,7 @@ export interface PipeType extends Type { ɵpipe: unknown; } -/** - * An object literal of this type is used to represent the metadata of a constructor dependency. - * The type itself is never referred to from generated code. - */ -export type CtorDependency = { - /** - * If an `@Attribute` decorator is used, this represents the injected attribute's name. If the - * attribute name is a dynamic expression instead of a string literal, this will be the unknown - * type. - */ - attribute?: string|unknown; - - /** - * If `@Optional()` is used, this key is set to true. - */ - optional?: true; - /** - * If `@Host` is used, this key is set to true. - */ - host?: true; - - /** - * If `@Self` is used, this key is set to true. - */ - self?: true; - - /** - * If `@SkipSelf` is used, this key is set to true. - */ - skipSelf?: true; -}|null; - -/** - * @codeGenApi - */ -export type ɵɵDirectiveDefWithMeta< - T, Selector extends string, ExportAs extends - string[], InputMap extends {[key: string]: string}, - OutputMap extends {[key: string]: string}, - QueryFields extends string[]> = - DirectiveDef; /** * Runtime link information for Directives. @@ -247,20 +206,6 @@ export interface DirectiveDef { privateName: string) => void)|null; } -/** - * @codeGenApi - */ -export type ɵɵComponentDefWithMeta< - T, Selector extends String, ExportAs extends - string[], InputMap extends {[key: string]: string}, - OutputMap extends {[key: string]: string}, QueryFields extends - string[], NgContentSelectors extends string[]> = ComponentDef; - -/** - * @codeGenApi - */ -export type ɵɵFactoryDef = () => T; - /** * Runtime link information for Components. * @@ -414,11 +359,6 @@ export interface PipeDef { onDestroy: (() => void)|null; } -/** - * @codeGenApi - */ -export type ɵɵPipeDefWithMeta = PipeDef; - export interface DirectiveDefFeature { (directiveDef: DirectiveDef): void; /** diff --git a/packages/core/src/render3/interfaces/public_definitions.ts b/packages/core/src/render3/interfaces/public_definitions.ts new file mode 100644 index 000000000000..497c3401645e --- /dev/null +++ b/packages/core/src/render3/interfaces/public_definitions.ts @@ -0,0 +1,85 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// This file contains types that will be published to npm in library typings files. + +/** + * @publicApi + */ +export type ɵɵDirectiveDeclaration< + T, Selector extends string, ExportAs extends + string[], InputMap extends {[key: string]: string}, + OutputMap extends {[key: string]: string}, + QueryFields extends string[]> = unknown; + +/** + * @publicApi + */ +export type ɵɵComponentDeclaration < T, Selector extends String, ExportAs extends string[], + InputMap extends { + [key: string]: string; +} +, OutputMap extends { + [key: string]: string; +} +, QueryFields extends string[], NgContentSelectors extends string[] > = unknown; + +/** + * @publicApi + */ +export type ɵɵNgModuleDeclaration = unknown; + +/** + * @publicApi + */ +export type ɵɵPipeDeclaration = unknown; + +/** + * @publicApi + */ +export type ɵɵInjectorDeclaration = unknown; + +/** + * @publicApi + */ +export type ɵɵFactoryDeclaration = unknown; + +/** + * An object literal of this type is used to represent the metadata of a constructor dependency. + * The type itself is never referred to from generated code. + * + * @publicApi + */ +export type CtorDependency = { + /** + * If an `@Attribute` decorator is used, this represents the injected attribute's name. If the + * attribute name is a dynamic expression instead of a string literal, this will be the unknown + * type. + */ + attribute?: string|unknown; + + /** + * If `@Optional()` is used, this key is set to true. + */ + optional?: true; + + /** + * If `@Host` is used, this key is set to true. + */ + host?: true; + + /** + * If `@Self` is used, this key is set to true. + */ + self?: true; + + /** + * If `@SkipSelf` is used, this key is set to true. + */ + skipSelf?: true; +}|null; diff --git a/packages/core/test/BUILD.bazel b/packages/core/test/BUILD.bazel index 88274929366b..746631ca2702 100644 --- a/packages/core/test/BUILD.bazel +++ b/packages/core/test/BUILD.bazel @@ -27,7 +27,7 @@ genrule( $(execpath @npm//typescript/bin:tsc) $< --outDir $$es2015_out_dir --target ES2015 \ --types --module umd $(execpath @npm//typescript/bin:tsc) --outFile $@ $$es2015_out_file --allowJs \ - --types --target ES5 + --types --target ES5 --downlevelIteration """, tools = ["@npm//typescript/bin:tsc"], ) diff --git a/packages/core/test/acceptance/styling_spec.ts b/packages/core/test/acceptance/styling_spec.ts index e6ac22da2175..a300052077b8 100644 --- a/packages/core/test/acceptance/styling_spec.ts +++ b/packages/core/test/acceptance/styling_spec.ts @@ -17,6 +17,40 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; import {ivyEnabled, modifiedInIvy, onlyInIvy} from '@angular/private/testing'; describe('styling', () => { + /** + * This helper function tests to see if the current browser supports non standard way of writing + * into styles. + * + * This is not the correct way to write to style and is not supported in IE11. + * ``` + * div.style = 'color: white'; + * ``` + * + * This is the correct way to write to styles: + * ``` + * div.style.cssText = 'color: white'; + * ``` + * + * Even though writing to `div.style` is not officially supported, it works in all + * browsers except IE11. + * + * This function detects this condition and allows us to skip affected tests. + */ + let _supportsWritingStringsToStyleProperty: boolean|null = null; + function supportsWritingStringsToStyleProperty() { + if (_supportsWritingStringsToStyleProperty === null) { + const div = document.createElement('div'); + const CSS = 'color: white;'; + try { + (div as any).style = CSS; + } catch (e) { + _supportsWritingStringsToStyleProperty = false; + } + _supportsWritingStringsToStyleProperty = (div.style.cssText === CSS); + } + return _supportsWritingStringsToStyleProperty; + } + beforeEach(ngDevModeResetPerfCounters); describe('apply in prioritization order', () => { @@ -3069,6 +3103,64 @@ describe('styling', () => { expect(fixture.debugElement.nativeElement.innerHTML).toContain('three'); }); + it('should allow static and bound `class` attribute, but use last occurrence', () => { + @Component({ + template: ` +
+
+ `, + }) + class MyComp { + one = 'one'; + } + + TestBed.configureTestingModule({declarations: [MyComp]}); + const fixture = TestBed.createComponent(MyComp); + fixture.detectChanges(); + + const first = fixture.nativeElement.querySelector('#first').outerHTML; + expect(first).not.toContain('zero'); + expect(first).not.toContain('one'); + expect(first).toContain('two'); + + const second = fixture.nativeElement.querySelector('#second').outerHTML; + expect(second).toContain('zero'); + expect(second).toContain('one'); + expect(second).not.toContain('two'); + }); + + it('should allow static and bound `style` attribute, but use last occurrence', () => { + if (!ivyEnabled && !supportsWritingStringsToStyleProperty()) { + // VE does not treat `[style]` as anything special, instead it simply writes to the + // `style` property on the element like so `element.style=value`. This seems to work fine + // every where except IE11, where it throws an error and as a consequence this test fails in + // VE on IE11. + return; + } + + @Component({ + template: ` +
+
+ `, + }) + class MyComp { + margin = '10px'; + } + + TestBed.configureTestingModule({declarations: [MyComp]}); + const fixture = TestBed.createComponent(MyComp); + fixture.detectChanges(); + + const first = fixture.nativeElement.querySelector('#first').outerHTML; + expect(first).not.toContain('margin'); + expect(first).toContain('padding'); + + const second = fixture.nativeElement.querySelector('#second').outerHTML; + expect(second).toContain('margin'); + expect(second).not.toContain('padding'); + }); + it('should allow to reset style property value defined using [style.prop.px] binding', () => { @Component({ template: '
', @@ -3625,35 +3717,6 @@ describe('styling', () => { expectStyle(div).toEqual({color: 'white', display: 'block'}); }); - /** - * Tests to see if the current browser supports non standard way of writing into styles. - * - * This is not the correct way to write to style and is not supported in IE11. - * ``` - * div.style = 'color: white'; - * ``` - * - * This is the correct way to write to styles: - * ``` - * div.style.cssText = 'color: white'; - * ``` - * - * Even though writing to `div.style` is not officially supported, it works in all - * browsers except IE11. - * - * This function detects this condition and allows us to skip the test. - */ - function supportsWritingStringsToStyleProperty() { - const div = document.createElement('div'); - const CSS = 'color: white;'; - try { - (div as any).style = CSS; - } catch (e) { - return false; - } - return div.style.cssText === CSS; - } - onlyInIvy('styling priority resolution is Ivy only feature.') .it('should allow lookahead binding on second pass #35118', () => { @Component({ diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index 87123b708769..137edb7f88e6 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -202,13 +202,48 @@ class TestObj { }); // See: https://github.com/angular/angular/issues/38453 - it('should support ES2015 downleveled classes', () => { - const {ChildNoCtor, ChildNoCtorPrivateProps, ChildWithCtor} = - require('./es5_downleveled_inheritance_fixture'); + it('should support ES2015 downleveled classes (workspace TypeScript version) (downlevelIteration=true)', + () => { + const {ChildNoCtor, ChildNoCtorPrivateProps, ChildWithCtor} = + require('./es5_downleveled_inheritance_fixture'); + + expect(isDelegateCtor(ChildNoCtor.toString())).toBe(true); + expect(isDelegateCtor(ChildNoCtorPrivateProps.toString())).toBe(true); + expect(isDelegateCtor(ChildWithCtor.toString())).toBe(false); + }); + + it('should support ES2015 downleveled classes ( { + const ChildNoCtor = `function ChildNoCtor() { + return _super !== null && _super.apply(this, arguments) || this; + }`; + const ChildNoCtorPrivateProps = `function ChildNoCtorPrivateProps() { + var _this = _super.apply(this, __spread(arguments)) || this; + _this.x = 10; + return _this; + }`; + const ChildWithCtor = `function ChildWithCtor() { + return _super.call(this) || this; + }`; + expect(isDelegateCtor(ChildNoCtor)).toBe(true); + expect(isDelegateCtor(ChildNoCtorPrivateProps)).toBe(true); + expect(isDelegateCtor(ChildWithCtor)).toBe(false); + }); - expect(isDelegateCtor(ChildNoCtor.toString())).toBe(true); - expect(isDelegateCtor(ChildNoCtorPrivateProps.toString())).toBe(true); - expect(isDelegateCtor(ChildWithCtor.toString())).toBe(false); + it('should support ES2015 downleveled classes (>=TS4.2) (downlevelIteration=true)', () => { + const ChildNoCtor = `function ChildNoCtor() { + return _super !== null && _super.apply(this, arguments) || this; + }`; + const ChildNoCtorPrivateProps = `function ChildNoCtorPrivateProps() { + var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this; + _this.x = 10; + return _this; + }`; + const ChildWithCtor = `function ChildWithCtor() { + return _super.call(this) || this; + }`; + expect(isDelegateCtor(ChildNoCtor)).toBe(true); + expect(isDelegateCtor(ChildNoCtorPrivateProps)).toBe(true); + expect(isDelegateCtor(ChildWithCtor)).toBe(false); }); it('should support ES2015 classes when minified', () => { diff --git a/packages/core/test/render3/jit_environment_spec.ts b/packages/core/test/render3/jit_environment_spec.ts index 8d32cf56021e..e13b84d5845c 100644 --- a/packages/core/test/render3/jit_environment_spec.ts +++ b/packages/core/test/render3/jit_environment_spec.ts @@ -12,12 +12,13 @@ import {Identifiers} from '@angular/compiler/src/render3/r3_identifiers'; import {angularCoreEnv} from '../../src/render3/jit/environment'; const INTERFACE_EXCEPTIONS = new Set([ - 'ɵɵComponentDefWithMeta', - 'ɵɵDirectiveDefWithMeta', + 'ɵɵComponentDeclaration', + 'ɵɵDirectiveDeclaration', + 'ɵɵInjectorDeclaration', 'ɵɵInjectorDef', - 'ɵɵNgModuleDefWithMeta', - 'ɵɵPipeDefWithMeta', - 'ɵɵFactoryDef', + 'ɵɵNgModuleDeclaration', + 'ɵɵPipeDeclaration', + 'ɵɵFactoryDeclaration', 'ModuleWithProviders', ]); diff --git a/packages/core/test/strict_types/inheritance_spec.ts b/packages/core/test/strict_types/inheritance_spec.ts index a21ce069363d..e376872ea726 100644 --- a/packages/core/test/strict_types/inheritance_spec.ts +++ b/packages/core/test/strict_types/inheritance_spec.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import {ɵɵComponentDefWithMeta, ɵɵPipeDefWithMeta as PipeDefWithMeta} from '@angular/core'; +import {ɵɵComponentDeclaration, ɵɵPipeDeclaration} from '@angular/core'; declare class SuperComponent { - static ɵcmp: ɵɵComponentDefWithMeta; + static ɵcmp: ɵɵComponentDeclaration; } declare class SubComponent extends SuperComponent { @@ -18,17 +18,17 @@ declare class SubComponent extends SuperComponent { // would produce type errors when the "strictFunctionTypes" option is enabled. onlyInSubtype: string; - static ɵcmp: ɵɵComponentDefWithMeta; + static ɵcmp: ɵɵComponentDeclaration; } declare class SuperPipe { - static ɵpipe: PipeDefWithMeta; + static ɵpipe: ɵɵPipeDeclaration; } declare class SubPipe extends SuperPipe { onlyInSubtype: string; - static ɵpipe: PipeDefWithMeta; + static ɵpipe: ɵɵPipeDeclaration; } describe('inheritance strict type checking', () => { diff --git a/packages/elements/test/BUILD.bazel b/packages/elements/test/BUILD.bazel index 132083c917a4..491f6fd0912a 100644 --- a/packages/elements/test/BUILD.bazel +++ b/packages/elements/test/BUILD.bazel @@ -39,6 +39,10 @@ filegroup( # do not sort srcs = [ "@npm//:node_modules/core-js/client/core.js", + # Required for browsers that do not natively support Custom Elements. + "@npm//:node_modules/@webcomponents/custom-elements/custom-elements.min.js", + # Required for ES5 code to work with a native Custom Elements implementation. + # (See https://www.npmjs.com/package/@webcomponents/custom-elements#es5-vs-es2015.) ":custom_elements_native_shim", "@npm//:node_modules/reflect-metadata/Reflect.js", "//packages/zone.js/bundles:zone.umd.js", diff --git a/packages/language-service/ivy/BUILD.bazel b/packages/language-service/ivy/BUILD.bazel index e87b920172a0..314728e998c8 100644 --- a/packages/language-service/ivy/BUILD.bazel +++ b/packages/language-service/ivy/BUILD.bazel @@ -15,6 +15,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/imports", "//packages/compiler-cli/src/ngtsc/incremental", "//packages/compiler-cli/src/ngtsc/metadata", + "//packages/compiler-cli/src/ngtsc/perf", "//packages/compiler-cli/src/ngtsc/reflection", "//packages/compiler-cli/src/ngtsc/shims", "//packages/compiler-cli/src/ngtsc/typecheck", diff --git a/packages/language-service/ivy/compiler_factory.ts b/packages/language-service/ivy/compiler_factory.ts index d243f0b16400..2c634d1026fc 100644 --- a/packages/language-service/ivy/compiler_factory.ts +++ b/packages/language-service/ivy/compiler_factory.ts @@ -9,6 +9,7 @@ import {CompilationTicket, freshCompilationTicket, incrementalFromCompilerTicket, NgCompiler, resourceChangeTicket} from '@angular/compiler-cli/src/ngtsc/core'; import {NgCompilerOptions} from '@angular/compiler-cli/src/ngtsc/core/api'; import {TrackedIncrementalBuildStrategy} from '@angular/compiler-cli/src/ngtsc/incremental'; +import {ActivePerfRecorder} from '@angular/compiler-cli/src/ngtsc/perf'; import {TypeCheckingProgramStrategy} from '@angular/compiler-cli/src/ngtsc/typecheck/api'; import * as ts from 'typescript/lib/tsserverlibrary'; @@ -44,6 +45,10 @@ export class CompilerFactory { // Only resource files have changed since the last NgCompiler was created. const ticket = resourceChangeTicket(this.compiler, modifiedResourceFiles); this.compiler = NgCompiler.fromTicket(ticket, this.adapter); + } else { + // The previous NgCompiler is being reused, but we still want to reset its performance + // tracker to capture only the operations that are needed to service the current request. + this.compiler.perfRecorder.reset(); } return this.compiler; @@ -52,11 +57,12 @@ export class CompilerFactory { let ticket: CompilationTicket; if (this.compiler === null || this.lastKnownProgram === null) { ticket = freshCompilationTicket( - program, this.options, this.incrementalStrategy, this.programStrategy, true, true); + program, this.options, this.incrementalStrategy, this.programStrategy, + /* perfRecorder */ null, true, true); } else { ticket = incrementalFromCompilerTicket( this.compiler, program, this.incrementalStrategy, this.programStrategy, - modifiedResourceFiles); + modifiedResourceFiles, /* perfRecorder */ null); } this.compiler = NgCompiler.fromTicket(ticket, this.adapter); this.lastKnownProgram = program; diff --git a/packages/language-service/ivy/language_service.ts b/packages/language-service/ivy/language_service.ts index 7167dbeb7515..cbbff8d4621f 100644 --- a/packages/language-service/ivy/language_service.ts +++ b/packages/language-service/ivy/language_service.ts @@ -11,6 +11,7 @@ import {CompilerOptions, ConfigurationHost, readConfiguration} from '@angular/co import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core'; import {ErrorCode, ngErrorCode} from '@angular/compiler-cli/src/ngtsc/diagnostics'; import {absoluteFrom, absoluteFromSourceFile, AbsoluteFsPath} from '@angular/compiler-cli/src/ngtsc/file_system'; +import {PerfPhase} from '@angular/compiler-cli/src/ngtsc/perf'; import {isNamedClassDeclaration} from '@angular/compiler-cli/src/ngtsc/reflection'; import {TypeCheckShimGenerator} from '@angular/compiler-cli/src/ngtsc/typecheck'; import {OptimizeFor, TypeCheckingProgramStrategy} from '@angular/compiler-cli/src/ngtsc/typecheck/api'; @@ -63,51 +64,54 @@ export class LanguageService { } getSemanticDiagnostics(fileName: string): ts.Diagnostic[] { - const compiler = this.compilerFactory.getOrCreate(); - const ttc = compiler.getTemplateTypeChecker(); - const diagnostics: ts.Diagnostic[] = []; - if (isTypeScriptFile(fileName)) { - const program = compiler.getNextProgram(); - const sourceFile = program.getSourceFile(fileName); - if (sourceFile) { - const ngDiagnostics = compiler.getDiagnosticsForFile(sourceFile, OptimizeFor.SingleFile); - // There are several kinds of diagnostics returned by `NgCompiler` for a source file: - // - // 1. Angular-related non-template diagnostics from decorated classes within that file. - // 2. Template diagnostics for components with direct inline templates (a string literal). - // 3. Template diagnostics for components with indirect inline templates (templates computed - // by expression). - // 4. Template diagnostics for components with external templates. - // - // When showing diagnostics for a TS source file, we want to only include kinds 1 and 2 - - // those diagnostics which are reported at a location within the TS file itself. Diagnostics - // for external templates will be shown when editing that template file (the `else` block) - // below. - // - // Currently, indirect inline template diagnostics (kind 3) are not shown at all by the - // Language Service, because there is no sensible location in the user's code for them. Such - // templates are an edge case, though, and should not be common. - // - // TODO(alxhub): figure out a good user experience for indirect template diagnostics and - // show them from within the Language Service. - diagnostics.push(...ngDiagnostics.filter( - diag => diag.file !== undefined && diag.file.fileName === sourceFile.fileName)); - } - } else { - const components = compiler.getComponentsWithTemplateFile(fileName); - for (const component of components) { - if (ts.isClassDeclaration(component)) { - diagnostics.push(...ttc.getDiagnosticsForComponent(component)); + return this.withCompilerAndPerfTracing(PerfPhase.LsDiagnostics, (compiler) => { + const ttc = compiler.getTemplateTypeChecker(); + const diagnostics: ts.Diagnostic[] = []; + if (isTypeScriptFile(fileName)) { + const program = compiler.getNextProgram(); + const sourceFile = program.getSourceFile(fileName); + if (sourceFile) { + const ngDiagnostics = compiler.getDiagnosticsForFile(sourceFile, OptimizeFor.SingleFile); + // There are several kinds of diagnostics returned by `NgCompiler` for a source file: + // + // 1. Angular-related non-template diagnostics from decorated classes within that + // file. + // 2. Template diagnostics for components with direct inline templates (a string + // literal). + // 3. Template diagnostics for components with indirect inline templates (templates + // computed + // by expression). + // 4. Template diagnostics for components with external templates. + // + // When showing diagnostics for a TS source file, we want to only include kinds 1 and + // 2 - those diagnostics which are reported at a location within the TS file itself. + // Diagnostics for external templates will be shown when editing that template file + // (the `else` block) below. + // + // Currently, indirect inline template diagnostics (kind 3) are not shown at all by + // the Language Service, because there is no sensible location in the user's code for + // them. Such templates are an edge case, though, and should not be common. + // + // TODO(alxhub): figure out a good user experience for indirect template diagnostics + // and show them from within the Language Service. + diagnostics.push(...ngDiagnostics.filter( + diag => diag.file !== undefined && diag.file.fileName === sourceFile.fileName)); + } + } else { + const components = compiler.getComponentsWithTemplateFile(fileName); + for (const component of components) { + if (ts.isClassDeclaration(component)) { + diagnostics.push(...ttc.getDiagnosticsForComponent(component)); + } } } - } - this.compilerFactory.registerLastKnownProgram(); - return diagnostics; + return diagnostics; + }); } getDefinitionAndBoundSpan(fileName: string, position: number): ts.DefinitionInfoAndBoundSpan |undefined { - return this.withCompiler((compiler) => { + return this.withCompilerAndPerfTracing(PerfPhase.LsDefinition, (compiler) => { if (!isInAngularContext(compiler.getNextProgram(), fileName, position)) { return undefined; } @@ -118,7 +122,7 @@ export class LanguageService { getTypeDefinitionAtPosition(fileName: string, position: number): readonly ts.DefinitionInfo[]|undefined { - return this.withCompiler((compiler) => { + return this.withCompilerAndPerfTracing(PerfPhase.LsDefinition, (compiler) => { if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { return undefined; } @@ -128,64 +132,70 @@ export class LanguageService { } getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo|undefined { - return this.withCompiler((compiler) => { - if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { - return undefined; - } + return this.withCompilerAndPerfTracing(PerfPhase.LsQuickInfo, (compiler) => { + return this.getQuickInfoAtPositionImpl(fileName, position, compiler); + }); + } - const templateInfo = getTemplateInfoAtPosition(fileName, position, compiler); - if (templateInfo === undefined) { - return undefined; - } - const positionDetails = getTargetAtPosition(templateInfo.template, position); - if (positionDetails === null) { - return undefined; - } + private getQuickInfoAtPositionImpl( + fileName: string, + position: number, + compiler: NgCompiler, + ): ts.QuickInfo|undefined { + if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { + return undefined; + } - // Because we can only show 1 quick info, just use the bound attribute if the target is a two - // way binding. We may consider concatenating additional display parts from the other target - // nodes or representing the two way binding in some other manner in the future. - const node = positionDetails.context.kind === TargetNodeKind.TwoWayBindingContext ? - positionDetails.context.nodes[0] : - positionDetails.context.node; - return new QuickInfoBuilder(this.tsLS, compiler, templateInfo.component, node).get(); - }); + const templateInfo = getTemplateInfoAtPosition(fileName, position, compiler); + if (templateInfo === undefined) { + return undefined; + } + const positionDetails = getTargetAtPosition(templateInfo.template, position); + if (positionDetails === null) { + return undefined; + } + + // Because we can only show 1 quick info, just use the bound attribute if the target is a two + // way binding. We may consider concatenating additional display parts from the other target + // nodes or representing the two way binding in some other manner in the future. + const node = positionDetails.context.kind === TargetNodeKind.TwoWayBindingContext ? + positionDetails.context.nodes[0] : + positionDetails.context.node; + return new QuickInfoBuilder(this.tsLS, compiler, templateInfo.component, node).get(); } getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[]|undefined { - const compiler = this.compilerFactory.getOrCreate(); - const results = new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) - .getReferencesAtPosition(fileName, position); - this.compilerFactory.registerLastKnownProgram(); - return results; + return this.withCompilerAndPerfTracing(PerfPhase.LsReferencesAndRenames, (compiler) => { + return new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) + .getReferencesAtPosition(fileName, position); + }); } getRenameInfo(fileName: string, position: number): ts.RenameInfo { - const compiler = this.compilerFactory.getOrCreate(); - const renameInfo = new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) - .getRenameInfo(absoluteFrom(fileName), position); - if (!renameInfo.canRename) { - return renameInfo; - } + return this.withCompilerAndPerfTracing(PerfPhase.LsReferencesAndRenames, (compiler) => { + const renameInfo = new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) + .getRenameInfo(absoluteFrom(fileName), position); + if (!renameInfo.canRename) { + return renameInfo; + } - const quickInfo = this.getQuickInfoAtPosition(fileName, position) ?? - this.tsLS.getQuickInfoAtPosition(fileName, position); - const kind = quickInfo?.kind ?? ts.ScriptElementKind.unknown; - const kindModifiers = quickInfo?.kindModifiers ?? ts.ScriptElementKind.unknown; - return {...renameInfo, kind, kindModifiers}; + const quickInfo = this.getQuickInfoAtPositionImpl(fileName, position, compiler) ?? + this.tsLS.getQuickInfoAtPosition(fileName, position); + const kind = quickInfo?.kind ?? ts.ScriptElementKind.unknown; + const kindModifiers = quickInfo?.kindModifiers ?? ts.ScriptElementKind.unknown; + return {...renameInfo, kind, kindModifiers}; + }); } findRenameLocations(fileName: string, position: number): readonly ts.RenameLocation[]|undefined { - const compiler = this.compilerFactory.getOrCreate(); - const results = new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) - .findRenameLocations(fileName, position); - this.compilerFactory.registerLastKnownProgram(); - return results; + return this.withCompilerAndPerfTracing(PerfPhase.LsReferencesAndRenames, (compiler) => { + return new ReferencesAndRenameBuilder(this.strategy, this.tsLS, compiler) + .findRenameLocations(fileName, position); + }); } - private getCompletionBuilder(fileName: string, position: number): + private getCompletionBuilder(fileName: string, position: number, compiler: NgCompiler): CompletionBuilder|null { - const compiler = this.compilerFactory.getOrCreate(); const templateInfo = getTemplateInfoAtPosition(fileName, position, compiler); if (templateInfo === undefined) { return null; @@ -208,29 +218,35 @@ export class LanguageService { getCompletionsAtPosition( fileName: string, position: number, options: ts.GetCompletionsAtPositionOptions|undefined): ts.WithMetadata|undefined { - return this.withCompiler((compiler) => { - if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { - return undefined; - } - - const builder = this.getCompletionBuilder(fileName, position); - if (builder === null) { - return undefined; - } - return builder.getCompletionsAtPosition(options); + return this.withCompilerAndPerfTracing(PerfPhase.LsCompletions, (compiler) => { + return this.getCompletionsAtPositionImpl(fileName, position, options, compiler); }); } + private getCompletionsAtPositionImpl( + fileName: string, position: number, options: ts.GetCompletionsAtPositionOptions|undefined, + compiler: NgCompiler): ts.WithMetadata|undefined { + if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { + return undefined; + } + + const builder = this.getCompletionBuilder(fileName, position, compiler); + if (builder === null) { + return undefined; + } + return builder.getCompletionsAtPosition(options); + } + getCompletionEntryDetails( fileName: string, position: number, entryName: string, formatOptions: ts.FormatCodeOptions|ts.FormatCodeSettings|undefined, preferences: ts.UserPreferences|undefined): ts.CompletionEntryDetails|undefined { - return this.withCompiler((compiler) => { + return this.withCompilerAndPerfTracing(PerfPhase.LsCompletions, (compiler) => { if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { return undefined; } - const builder = this.getCompletionBuilder(fileName, position); + const builder = this.getCompletionBuilder(fileName, position, compiler); if (builder === null) { return undefined; } @@ -240,12 +256,12 @@ export class LanguageService { getCompletionEntrySymbol(fileName: string, position: number, entryName: string): ts.Symbol |undefined { - return this.withCompiler((compiler) => { + return this.withCompilerAndPerfTracing(PerfPhase.LsCompletions, (compiler) => { if (!isTemplateContext(compiler.getNextProgram(), fileName, position)) { return undefined; } - const builder = this.getCompletionBuilder(fileName, position); + const builder = this.getCompletionBuilder(fileName, position, compiler); if (builder === null) { return undefined; } @@ -256,30 +272,31 @@ export class LanguageService { } getComponentLocationsForTemplate(fileName: string): GetComponentLocationsForTemplateResponse { - return this.withCompiler((compiler) => { - const components = compiler.getComponentsWithTemplateFile(fileName); - const componentDeclarationLocations: ts.DocumentSpan[] = - Array.from(components.values()).map(c => { - let contextSpan: ts.TextSpan|undefined = undefined; - let textSpan: ts.TextSpan; - if (isNamedClassDeclaration(c)) { - textSpan = ts.createTextSpanFromBounds(c.name.getStart(), c.name.getEnd()); - contextSpan = ts.createTextSpanFromBounds(c.getStart(), c.getEnd()); - } else { - textSpan = ts.createTextSpanFromBounds(c.getStart(), c.getEnd()); - } - return { - fileName: c.getSourceFile().fileName, - textSpan, - contextSpan, - }; - }); - return componentDeclarationLocations; - }); + return this.withCompilerAndPerfTracing( + PerfPhase.LsComponentLocations, (compiler) => { + const components = compiler.getComponentsWithTemplateFile(fileName); + const componentDeclarationLocations: ts.DocumentSpan[] = + Array.from(components.values()).map(c => { + let contextSpan: ts.TextSpan|undefined = undefined; + let textSpan: ts.TextSpan; + if (isNamedClassDeclaration(c)) { + textSpan = ts.createTextSpanFromBounds(c.name.getStart(), c.name.getEnd()); + contextSpan = ts.createTextSpanFromBounds(c.getStart(), c.getEnd()); + } else { + textSpan = ts.createTextSpanFromBounds(c.getStart(), c.getEnd()); + } + return { + fileName: c.getSourceFile().fileName, + textSpan, + contextSpan, + }; + }); + return componentDeclarationLocations; + }); } getTcb(fileName: string, position: number): GetTcbResponse|undefined { - return this.withCompiler(compiler => { + return this.withCompilerAndPerfTracing(PerfPhase.LsTcb, compiler => { const templateInfo = getTemplateInfoAtPosition(fileName, position, compiler); if (templateInfo === undefined) { return undefined; @@ -323,10 +340,34 @@ export class LanguageService { }); } - private withCompiler(p: (compiler: NgCompiler) => T): T { + /** + * Provides an instance of the `NgCompiler` and traces perf results. Perf results are logged only + * if the log level is verbose or higher. This method is intended to be called once per public + * method call. + * + * Here is an example of the log output. + * + * Perf 245 [16:16:39.353] LanguageService#getQuickInfoAtPosition(): {"events":{},"phases":{ + * "Unaccounted":379,"TtcSymbol":4},"memory":{}} + * + * Passing name of caller instead of using `arguments.caller` because 'caller', 'callee', and + * 'arguments' properties may not be accessed in strict mode. + * + * @param phase the `PerfPhase` to execute the `p` callback in + * @param p callback to be run synchronously with an instance of the `NgCompiler` as argument + * @return the result of running the `p` callback + */ + private withCompilerAndPerfTracing(phase: PerfPhase, p: (compiler: NgCompiler) => T): T { const compiler = this.compilerFactory.getOrCreate(); - const result = p(compiler); + const result = compiler.perfRecorder.inPhase(phase, () => p(compiler)); this.compilerFactory.registerLastKnownProgram(); + + const logger = this.project.projectService.logger; + if (logger.hasLevel(ts.server.LogLevel.verbose)) { + logger.perftrc(`LanguageService#${PerfPhase[phase]}: ${ + JSON.stringify(compiler.perfRecorder.finalize())}`); + } + return result; } @@ -336,26 +377,27 @@ export class LanguageService { return []; } - const diagnostics: ts.Diagnostic[] = []; - const configSourceFile = ts.readJsonConfigFile( - project.getConfigFilePath(), (path: string) => project.readFile(path)); - - if (!this.options.strictTemplates && !this.options.fullTemplateTypeCheck) { - diagnostics.push({ - messageText: 'Some language features are not available. ' + - 'To access all features, enable `strictTemplates` in `angularCompilerOptions`.', - category: ts.DiagnosticCategory.Suggestion, - code: ngErrorCode(ErrorCode.SUGGEST_STRICT_TEMPLATES), - file: configSourceFile, - start: undefined, - length: undefined, - }); - } + return this.withCompilerAndPerfTracing(PerfPhase.LsDiagnostics, (compiler) => { + const diagnostics: ts.Diagnostic[] = []; + const configSourceFile = ts.readJsonConfigFile( + project.getConfigFilePath(), (path: string) => project.readFile(path)); + + if (!this.options.strictTemplates && !this.options.fullTemplateTypeCheck) { + diagnostics.push({ + messageText: 'Some language features are not available. ' + + 'To access all features, enable `strictTemplates` in `angularCompilerOptions`.', + category: ts.DiagnosticCategory.Suggestion, + code: ngErrorCode(ErrorCode.SUGGEST_STRICT_TEMPLATES), + file: configSourceFile, + start: undefined, + length: undefined, + }); + } - const compiler = this.compilerFactory.getOrCreate(); - diagnostics.push(...compiler.getOptionDiagnostics()); + diagnostics.push(...compiler.getOptionDiagnostics()); - return diagnostics; + return diagnostics; + }); } private watchConfigFile(project: ts.server.Project) { diff --git a/packages/language-service/ivy/references.ts b/packages/language-service/ivy/references.ts index 104d100e620e..5881da4cd581 100644 --- a/packages/language-service/ivy/references.ts +++ b/packages/language-service/ivy/references.ts @@ -8,6 +8,7 @@ import {AbsoluteSourceSpan, AST, BindingPipe, LiteralPrimitive, MethodCall, ParseSourceSpan, PropertyRead, PropertyWrite, SafeMethodCall, SafePropertyRead, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstNode, TmplAstReference, TmplAstTextAttribute, TmplAstVariable} from '@angular/compiler'; import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core'; import {absoluteFrom, absoluteFromSourceFile, AbsoluteFsPath} from '@angular/compiler-cli/src/ngtsc/file_system'; +import {PerfPhase} from '@angular/compiler-cli/src/ngtsc/perf'; import {DirectiveSymbol, ShimLocation, SymbolKind, TemplateTypeChecker, TypeCheckingProgramStrategy} from '@angular/compiler-cli/src/ngtsc/typecheck/api'; import {ExpressionIdentifier, hasExpressionIdentifier} from '@angular/compiler-cli/src/ngtsc/typecheck/src/comments'; import * as ts from 'typescript'; @@ -66,46 +67,53 @@ export class ReferencesAndRenameBuilder { getRenameInfo(filePath: string, position: number): Omit|ts.RenameInfoFailure { - const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); - // We could not get a template at position so we assume the request came from outside the - // template. - if (templateInfo === undefined) { - return this.tsLS.getRenameInfo(filePath, position); - } + return this.compiler.perfRecorder.inPhase(PerfPhase.LsReferencesAndRenames, () => { + const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); + // We could not get a template at position so we assume the request came from outside the + // template. + if (templateInfo === undefined) { + return this.tsLS.getRenameInfo(filePath, position); + } - const allTargetDetails = this.getTargetDetailsAtTemplatePosition(templateInfo, position); - if (allTargetDetails === null) { - return {canRename: false, localizedErrorMessage: 'Could not find template node at position.'}; - } - const {templateTarget} = allTargetDetails[0]; - const templateTextAndSpan = getRenameTextAndSpanAtPosition(templateTarget, position); - if (templateTextAndSpan === null) { - return {canRename: false, localizedErrorMessage: 'Could not determine template node text.'}; - } - const {text, span} = templateTextAndSpan; - return { - canRename: true, - displayName: text, - fullDisplayName: text, - triggerSpan: span, - }; + const allTargetDetails = this.getTargetDetailsAtTemplatePosition(templateInfo, position); + if (allTargetDetails === null) { + return { + canRename: false, + localizedErrorMessage: 'Could not find template node at position.', + }; + } + const {templateTarget} = allTargetDetails[0]; + const templateTextAndSpan = getRenameTextAndSpanAtPosition(templateTarget, position); + if (templateTextAndSpan === null) { + return {canRename: false, localizedErrorMessage: 'Could not determine template node text.'}; + } + const {text, span} = templateTextAndSpan; + return { + canRename: true, + displayName: text, + fullDisplayName: text, + triggerSpan: span, + }; + }); } findRenameLocations(filePath: string, position: number): readonly ts.RenameLocation[]|undefined { this.ttc.generateAllTypeCheckBlocks(); - const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); - // We could not get a template at position so we assume the request came from outside the - // template. - if (templateInfo === undefined) { - const requestNode = this.getTsNodeAtPosition(filePath, position); - if (requestNode === null) { - return undefined; + return this.compiler.perfRecorder.inPhase(PerfPhase.LsReferencesAndRenames, () => { + const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); + // We could not get a template at position so we assume the request came from outside the + // template. + if (templateInfo === undefined) { + const requestNode = this.getTsNodeAtPosition(filePath, position); + if (requestNode === null) { + return undefined; + } + const requestOrigin: TypeScriptRequest = {kind: RequestKind.TypeScript, requestNode}; + return this.findRenameLocationsAtTypescriptPosition(filePath, position, requestOrigin); } - const requestOrigin: TypeScriptRequest = {kind: RequestKind.TypeScript, requestNode}; - return this.findRenameLocationsAtTypescriptPosition(filePath, position, requestOrigin); - } - return this.findRenameLocationsAtTemplatePosition(templateInfo, position); + return this.findRenameLocationsAtTemplatePosition(templateInfo, position); + }); } private findRenameLocationsAtTemplatePosition(templateInfo: TemplateInfo, position: number): @@ -148,55 +156,60 @@ export class ReferencesAndRenameBuilder { findRenameLocationsAtTypescriptPosition( filePath: string, position: number, requestOrigin: RequestOrigin): readonly ts.RenameLocation[]|undefined { - let originalNodeText: string; - if (requestOrigin.kind === RequestKind.TypeScript) { - originalNodeText = requestOrigin.requestNode.getText(); - } else { - const templateNodeText = - getRenameTextAndSpanAtPosition(requestOrigin.requestNode, requestOrigin.position); - if (templateNodeText === null) { - return undefined; + return this.compiler.perfRecorder.inPhase(PerfPhase.LsReferencesAndRenames, () => { + let originalNodeText: string; + if (requestOrigin.kind === RequestKind.TypeScript) { + originalNodeText = requestOrigin.requestNode.getText(); + } else { + const templateNodeText = + getRenameTextAndSpanAtPosition(requestOrigin.requestNode, requestOrigin.position); + if (templateNodeText === null) { + return undefined; + } + originalNodeText = templateNodeText.text; } - originalNodeText = templateNodeText.text; - } - const locations = this.tsLS.findRenameLocations( - filePath, position, /*findInStrings*/ false, /*findInComments*/ false); - if (locations === undefined) { - return undefined; - } + const locations = this.tsLS.findRenameLocations( + filePath, position, /*findInStrings*/ false, /*findInComments*/ false); + if (locations === undefined) { + return undefined; + } - const entries: Map = new Map(); - for (const location of locations) { - // TODO(atscott): Determine if a file is a shim file in a more robust way and make the API - // available in an appropriate location. - if (this.ttc.isTrackedTypeCheckFile(absoluteFrom(location.fileName))) { - const entry = this.convertToTemplateDocumentSpan(location, this.ttc, originalNodeText); - // There is no template node whose text matches the original rename request. Bail on - // renaming completely rather than providing incomplete results. - if (entry === null) { - return undefined; - } - entries.set(createLocationKey(entry), entry); - } else { - // Ensure we only allow renaming a TS result with matching text - const refNode = this.getTsNodeAtPosition(location.fileName, location.textSpan.start); - if (refNode === null || refNode.getText() !== originalNodeText) { - return undefined; + const entries: Map = new Map(); + for (const location of locations) { + // TODO(atscott): Determine if a file is a shim file in a more robust way and make the API + // available in an appropriate location. + if (this.ttc.isTrackedTypeCheckFile(absoluteFrom(location.fileName))) { + const entry = this.convertToTemplateDocumentSpan(location, this.ttc, originalNodeText); + // There is no template node whose text matches the original rename request. Bail on + // renaming completely rather than providing incomplete results. + if (entry === null) { + return undefined; + } + entries.set(createLocationKey(entry), entry); + } else { + // Ensure we only allow renaming a TS result with matching text + const refNode = this.getTsNodeAtPosition(location.fileName, location.textSpan.start); + if (refNode === null || refNode.getText() !== originalNodeText) { + return undefined; + } + entries.set(createLocationKey(location), location); } - entries.set(createLocationKey(location), location); } - } - return Array.from(entries.values()); + return Array.from(entries.values()); + }); } getReferencesAtPosition(filePath: string, position: number): ts.ReferenceEntry[]|undefined { this.ttc.generateAllTypeCheckBlocks(); - const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); - if (templateInfo === undefined) { - return this.getReferencesAtTypescriptPosition(filePath, position); - } - return this.getReferencesAtTemplatePosition(templateInfo, position); + + return this.compiler.perfRecorder.inPhase(PerfPhase.LsReferencesAndRenames, () => { + const templateInfo = getTemplateInfoAtPosition(filePath, position, this.compiler); + if (templateInfo === undefined) { + return this.getReferencesAtTypescriptPosition(filePath, position); + } + return this.getReferencesAtTemplatePosition(templateInfo, position); + }); } private getReferencesAtTemplatePosition(templateInfo: TemplateInfo, position: number): diff --git a/packages/language-service/ivy/test/BUILD.bazel b/packages/language-service/ivy/test/BUILD.bazel index 2ffce0d65a59..2fc4b2a7f56a 100644 --- a/packages/language-service/ivy/test/BUILD.bazel +++ b/packages/language-service/ivy/test/BUILD.bazel @@ -7,6 +7,7 @@ ts_library( deps = [ "//packages/compiler", "//packages/compiler-cli/src/ngtsc/core:api", + "//packages/compiler-cli/src/ngtsc/diagnostics", "//packages/compiler-cli/src/ngtsc/file_system", "//packages/compiler-cli/src/ngtsc/file_system/testing", "//packages/compiler-cli/src/ngtsc/testing", diff --git a/packages/language-service/ivy/test/diagnostic_spec.ts b/packages/language-service/ivy/test/diagnostic_spec.ts index 97f7239d33c5..3fadd8f966c3 100644 --- a/packages/language-service/ivy/test/diagnostic_spec.ts +++ b/packages/language-service/ivy/test/diagnostic_spec.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +import {ErrorCode, ngErrorCode} from '@angular/compiler-cli/src/ngtsc/diagnostics'; import {initMockFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/testing'; import * as ts from 'typescript'; @@ -245,4 +246,62 @@ describe('getSemanticDiagnostics', () => { 'component is missing a template', ]); }); + + it('reports a warning when the project configuration prevents good type inference', () => { + const files = { + 'app.ts': ` + import {Component, NgModule} from '@angular/core'; + import {CommonModule} from '@angular/common'; + + @Component({ + template: '
{{user}}
', + }) + export class MyComponent { + users = ['Alpha', 'Beta']; + } + ` + }; + + const project = createModuleAndProjectWithDeclarations(env, 'test', files, { + // Disable `strictTemplates`. + strictTemplates: false, + // Use `fullTemplateTypeCheck` mode instead. + fullTemplateTypeCheck: true, + }); + const diags = project.getDiagnosticsForFile('app.ts'); + expect(diags.length).toBe(1); + const diag = diags[0]; + expect(diag.code).toBe(ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE)); + expect(diag.category).toBe(ts.DiagnosticCategory.Suggestion); + expect(getTextOfDiagnostic(diag)).toBe('user'); + }); + + it('logs perf tracing', () => { + const files = { + 'app.ts': ` + import {Component} from '@angular/core'; + @Component({ template: '' }) + export class MyComponent {} + ` + }; + + const project = createModuleAndProjectWithDeclarations(env, 'test', files); + + const logger = project.getLogger(); + spyOn(logger, 'hasLevel').and.returnValue(true); + spyOn(logger, 'perftrc').and.callFake(() => {}); + + const diags = project.getDiagnosticsForFile('app.ts'); + expect(diags.length).toEqual(0); + expect(logger.perftrc) + .toHaveBeenCalledWith(jasmine.stringMatching( + /LanguageService\#LsDiagnostics\:.*\"LsDiagnostics\":\s*\d+.*/g)); + }); }); + +function getTextOfDiagnostic(diag: ts.Diagnostic): string { + expect(diag.file).not.toBeUndefined(); + expect(diag.start).not.toBeUndefined(); + expect(diag.length).not.toBeUndefined(); + return diag.file!.text.substring(diag.start!, diag.start! + diag.length!); +} diff --git a/packages/language-service/ivy/testing/src/project.ts b/packages/language-service/ivy/testing/src/project.ts index 5f2ca942039b..37ae237eda03 100644 --- a/packages/language-service/ivy/testing/src/project.ts +++ b/packages/language-service/ivy/testing/src/project.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {StrictTemplateOptions} from '@angular/compiler-cli/src/ngtsc/core/api'; +import {LegacyNgcOptions, StrictTemplateOptions} from '@angular/compiler-cli/src/ngtsc/core/api'; import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, getSourceFileOrError} from '@angular/compiler-cli/src/ngtsc/file_system'; import {OptimizeFor, TemplateTypeChecker} from '@angular/compiler-cli/src/ngtsc/typecheck/api'; import * as ts from 'typescript/lib/tsserverlibrary'; @@ -19,7 +19,7 @@ export type ProjectFiles = { function writeTsconfig( fs: FileSystem, tsConfigPath: AbsoluteFsPath, entryFiles: AbsoluteFsPath[], - options: StrictTemplateOptions): void { + options: TestableOptions): void { fs.writeFile( tsConfigPath, JSON.stringify( @@ -44,7 +44,7 @@ function writeTsconfig( null, 2)); } -export type TestableOptions = StrictTemplateOptions; +export type TestableOptions = StrictTemplateOptions&Pick; export class Project { private tsProject: ts.server.Project; @@ -179,6 +179,10 @@ export class Project { getTemplateTypeChecker(): TemplateTypeChecker { return this.ngLS.compilerFactory.getOrCreate().getTemplateTypeChecker(); } + + getLogger(): ts.server.Logger { + return this.tsProject.projectService.logger; + } } function getClassOrError(sf: ts.SourceFile, name: string): ts.ClassDeclaration { diff --git a/packages/localize/PACKAGE.md b/packages/localize/PACKAGE.md new file mode 100644 index 000000000000..a08e9ec12122 --- /dev/null +++ b/packages/localize/PACKAGE.md @@ -0,0 +1,56 @@ +The `@angular/localize` package contains helpers and tools for localizing your application. + +You should install this package using `ng add @angular/localize` if you need to tag text in your +application that you want to be translatable. + +The approach is based around the concept of tagging strings in code with a [template literal tag handler][tagged-templates] +called `$localize`. The idea is that strings that need to be translated are “marked” using this tag: + +```ts +const message = $localize`Hello, World!`; +``` + +--- + +This `$localize` identifier can be a real function that can do the translation at runtime, in the browser. +But, significantly, it is also a global identifier that survives minification. +This means it can act simply as a marker in the code that a static post-processing tool can use to replace +the original text with translated text before the code is deployed. + +For example, the following code: + +```ts +warning = $localize`${this.process} is not right`; +``` + +could be replaced with: + +```ts +warning = "" + this.process + ", ce n'est pas bon."; +``` + +The result is that all references to `$localize` are removed, and there is **zero runtime cost** to rendering +the translated text. + +--- + +The Angular template compiler also generates `$localize` tagged strings rather than doing the translation itself. +For example, the following template: + +```html +

Hello, World!

+``` + +would be compiled to something like: + +```ts +ɵɵelementStart(0, "h1"); //

+ɵɵi18n(1, $localize`Hello, World!`); // Hello, World! +ɵɵelementEnd(); //

+``` + +This means that after the Angular compiler has completed its work, all the template text marked with `i18n` +attributes have been converted to `$localize` tagged strings, which can be processed just like any other +tagged string. + +[tagged-templates]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_templates diff --git a/packages/localize/init/PACKAGE.md b/packages/localize/init/PACKAGE.md new file mode 100644 index 000000000000..581750ff4dc7 --- /dev/null +++ b/packages/localize/init/PACKAGE.md @@ -0,0 +1,2 @@ +The `@angular/localize` package exposes the `$localize` function in the global namespace, which can +be used to tag i18n messages in your code that needs to be translated. diff --git a/packages/localize/init/index.ts b/packages/localize/init/index.ts index db1495a29d37..e29960f8f3d4 100644 --- a/packages/localize/init/index.ts +++ b/packages/localize/init/index.ts @@ -7,7 +7,7 @@ */ import {$localize, _global, LocalizeFn} from '../src/localize'; -export {LocalizeFn, TranslateFn} from '../src/localize'; +export {$localize, LocalizeFn, TranslateFn} from '../src/localize'; // Attach $localize to the global context, as a side-effect of this module. _global.$localize = $localize; @@ -37,7 +37,7 @@ declare global { * ``` * * This format is the same as that used for `i18n` markers in Angular templates. See the - * [Angular 18n guide](guide/i18n#template-translations). + * [Angular 18n guide](guide/i18n#mark-text-for-translations). * * **Naming placeholders** * diff --git a/packages/localize/src/localize/src/localize.ts b/packages/localize/src/localize/src/localize.ts index 071de81bd017..e6bb9ab66d4e 100644 --- a/packages/localize/src/localize/src/localize.ts +++ b/packages/localize/src/localize/src/localize.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/** @nodoc */ export interface LocalizeFn { (messageParts: TemplateStringsArray, ...expressions: readonly any[]): string; @@ -38,6 +39,7 @@ export interface LocalizeFn { locale?: string; } +/** @nodoc */ export interface TranslateFn { (messageParts: TemplateStringsArray, expressions: readonly any[]): [TemplateStringsArray, readonly any[]]; @@ -66,7 +68,7 @@ export interface TranslateFn { * ``` * * This format is the same as that used for `i18n` markers in Angular templates. See the - * [Angular 18n guide](guide/i18n#template-translations). + * [Angular 18n guide](guide/i18n#mark-text-for-translations). * * **Naming placeholders** * @@ -130,9 +132,13 @@ export interface TranslateFn { * the original template literal string without applying any translations to the parts. This * version is used during development or where there is no need to translate the localized * template literals. + * * @param messageParts a collection of the static parts of the template string. * @param expressions a collection of the values of each placeholder in the template string. * @returns the translated string, with the `messageParts` and `expressions` interleaved together. + * + * @globalApi + * @publicApi */ export const $localize: LocalizeFn = function( messageParts: TemplateStringsArray, ...expressions: readonly any[]) { diff --git a/packages/localize/src/translate.ts b/packages/localize/src/translate.ts index 1fb323c5cf86..838df1aeddec 100644 --- a/packages/localize/src/translate.ts +++ b/packages/localize/src/translate.ts @@ -17,21 +17,43 @@ import {MessageId, ParsedTranslation, parseTranslation, TargetMessage, translate declare const $localize: LocalizeFn&{TRANSLATIONS: Record}; /** - * Load translations for `$localize`. + * Load translations for use by `$localize`, if doing runtime translation. * - * The given `translations` are processed and added to a lookup based on their `MessageId`. - * A new translation will overwrite a previous translation if it has the same `MessageId`. + * If the `$localize` tagged strings are not going to be replaced at compiled time, it is possible + * to load a set of translations that will be applied to the `$localize` tagged strings at runtime, + * in the browser. * - * * If a message is generated by the Angular compiler from an `i18n` marker in a template, the - * `MessageId` is passed through to the `$localize` call as a custom `MessageId`. The `MessageId` - * will match what is extracted into translation files. + * Loading a new translation will overwrite a previous translation if it has the same `MessageId`. * - * * If the translation is from a call to `$localize` in application code, and no custom `MessageId` - * is provided, then the `MessageId` can be generated by passing the tagged string message-parts - * to the `parseMessage()` function (not currently public API). + * Note that `$localize` messages are only processed once, when the tagged string is first + * encountered, and does not provide dynamic language changing without refreshing the browser. + * Loading new translations later in the application life-cycle will not change the translated text + * of messages that have already been translated. * - * @publicApi + * The message IDs and translations are in the same format as that rendered to "simple JSON" + * translation files when extracting messages. In particular, placeholders in messages are rendered + * using the `{$PLACEHOLDER_NAME}` syntax. For example the message from the following template: + * + * ```html + *
preinner-preboldinner-postpost
+ * ``` + * + * would have the following form in the `translations` map: + * + * ```ts + * { + * "2932901491976224757": + * "pre{$START_TAG_SPAN}inner-pre{$START_BOLD_TEXT}bold{$CLOSE_BOLD_TEXT}inner-post{$CLOSE_TAG_SPAN}post" + * } + * ``` + * + * @param translations A map from message ID to translated message. * + * These messages are processed and added to a lookup based on their `MessageId`. + * + * @see `clearTranslations()` for removing translations loaded using this function. + * @see `$localize` for tagging messages as needing to be translated. + * @publicApi */ export function loadTranslations(translations: Record) { // Ensure the translate function exists @@ -47,7 +69,12 @@ export function loadTranslations(translations: Record) } /** - * Remove all translations for `$localize`. + * Remove all translations for `$localize`, if doing runtime translation. + * + * All translations that had been loading into memory using `loadTranslations()` will be removed. + * + * @see `loadTranslations()` for loading translations at runtime. + * @see `$localize` for tagging messages as needing to be translated. * * @publicApi */ diff --git a/packages/platform-browser/animations/src/providers.ts b/packages/platform-browser/animations/src/providers.ts index ec7438d60d27..1cb7f6e15105 100644 --- a/packages/platform-browser/animations/src/providers.ts +++ b/packages/platform-browser/animations/src/providers.ts @@ -9,18 +9,22 @@ import {AnimationBuilder} from '@angular/animations'; import {AnimationDriver, ɵAnimationEngine as AnimationEngine, ɵAnimationStyleNormalizer as AnimationStyleNormalizer, ɵCssKeyframesDriver as CssKeyframesDriver, ɵNoopAnimationDriver as NoopAnimationDriver, ɵsupportsWebAnimations as supportsWebAnimations, ɵWebAnimationsDriver as WebAnimationsDriver, ɵWebAnimationsStyleNormalizer as WebAnimationsStyleNormalizer} from '@angular/animations/browser'; import {DOCUMENT} from '@angular/common'; -import {Inject, Injectable, InjectionToken, NgZone, Provider, RendererFactory2} from '@angular/core'; +import {Inject, Injectable, InjectionToken, NgZone, OnDestroy, Provider, RendererFactory2} from '@angular/core'; import {ɵDomRendererFactory2 as DomRendererFactory2} from '@angular/platform-browser'; import {BrowserAnimationBuilder} from './animation_builder'; import {AnimationRendererFactory} from './animation_renderer'; @Injectable() -export class InjectableAnimationEngine extends AnimationEngine { +export class InjectableAnimationEngine extends AnimationEngine implements OnDestroy { constructor( @Inject(DOCUMENT) doc: any, driver: AnimationDriver, normalizer: AnimationStyleNormalizer) { super(doc.body, driver, normalizer); } + + ngOnDestroy(): void { + this.flush(); + } } export function instantiateSupportedAnimationDriver() { diff --git a/packages/platform-browser/animations/test/animation_renderer_spec.ts b/packages/platform-browser/animations/test/animation_renderer_spec.ts index 2fa2ce7aa74e..75bc50de601e 100644 --- a/packages/platform-browser/animations/test/animation_renderer_spec.ts +++ b/packages/platform-browser/animations/test/animation_renderer_spec.ts @@ -7,10 +7,12 @@ */ import {animate, AnimationPlayer, AnimationTriggerMetadata, state, style, transition, trigger} from '@angular/animations'; import {ɵAnimationEngine as AnimationEngine} from '@angular/animations/browser'; -import {Component, Injectable, NgZone, RendererFactory2, RendererType2, ViewChild} from '@angular/core'; +import {Component, destroyPlatform, Injectable, NgModule, NgZone, RendererFactory2, RendererType2, ViewChild} from '@angular/core'; import {TestBed} from '@angular/core/testing'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {BrowserAnimationsModule, ɵAnimationRendererFactory as AnimationRendererFactory, ɵInjectableAnimationEngine as InjectableAnimationEngine} from '@angular/platform-browser/animations'; import {DomRendererFactory2} from '@angular/platform-browser/src/dom/dom_renderer'; +import {onlyInIvy, withBody} from '@angular/private/testing'; import {el} from '../../testing/src/browser_util'; @@ -323,6 +325,37 @@ describe('AnimationRendererFactory', () => { expect(renderer.log).toEqual(['begin', 'end']); }); }); + +onlyInIvy('View Engine uses another mechanism of removing DOM nodes').describe('destroy', () => { + beforeEach(destroyPlatform); + afterEach(destroyPlatform); + + it('should clear bootstrapped component contents', + withBody('
before
after
', async () => { + @Component({selector: 'app-root', template: 'app-root content'}) + class AppComponent { + } + + @NgModule({ + imports: [BrowserAnimationsModule], + declarations: [AppComponent], + bootstrap: [AppComponent] + }) + class AppModule { + } + + const ngModuleRef = await platformBrowserDynamic().bootstrapModule(AppModule); + + const root = document.body.querySelector('app-root')!; + expect(root.textContent).toEqual('app-root content'); + expect(document.body.childNodes.length).toEqual(3); + + ngModuleRef.destroy(); + + expect(document.body.querySelector('app-root')).toBeFalsy(); // host element is removed + expect(document.body.childNodes.length).toEqual(2); // other elements are preserved + })); +}); })(); @Injectable() diff --git a/packages/router/src/apply_redirects.ts b/packages/router/src/apply_redirects.ts index f908d45c6602..391688a6ff21 100644 --- a/packages/router/src/apply_redirects.ts +++ b/packages/router/src/apply_redirects.ts @@ -91,7 +91,7 @@ class ApplyRedirects { this.expandSegmentGroup(this.ngModule, this.config, rootSegmentGroup, PRIMARY_OUTLET); const urlTrees$ = expanded$.pipe(map((rootSegmentGroup: UrlSegmentGroup) => { return this.createUrlTree( - squashSegmentGroup(rootSegmentGroup), this.urlTree.queryParams, this.urlTree.fragment!); + squashSegmentGroup(rootSegmentGroup), this.urlTree.queryParams, this.urlTree.fragment); })); return urlTrees$.pipe(catchError((e: any) => { if (e instanceof AbsoluteRedirect) { @@ -114,7 +114,7 @@ class ApplyRedirects { this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET); const mapped$ = expanded$.pipe(map((rootSegmentGroup: UrlSegmentGroup) => { return this.createUrlTree( - squashSegmentGroup(rootSegmentGroup), tree.queryParams, tree.fragment!); + squashSegmentGroup(rootSegmentGroup), tree.queryParams, tree.fragment); })); return mapped$.pipe(catchError((e: any): Observable => { if (e instanceof NoMatch) { @@ -129,7 +129,7 @@ class ApplyRedirects { return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`); } - private createUrlTree(rootCandidate: UrlSegmentGroup, queryParams: Params, fragment: string): + private createUrlTree(rootCandidate: UrlSegmentGroup, queryParams: Params, fragment: string|null): UrlTree { const root = rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {[PRIMARY_OUTLET]: rootCandidate}) : diff --git a/packages/router/src/create_url_tree.ts b/packages/router/src/create_url_tree.ts index f70887abc343..d79a06eba79d 100644 --- a/packages/router/src/create_url_tree.ts +++ b/packages/router/src/create_url_tree.ts @@ -12,8 +12,8 @@ import {UrlSegment, UrlSegmentGroup, UrlTree} from './url_tree'; import {forEach, last, shallowEqual} from './utils/collection'; export function createUrlTree( - route: ActivatedRoute, urlTree: UrlTree, commands: any[], queryParams: Params, - fragment: string): UrlTree { + route: ActivatedRoute, urlTree: UrlTree, commands: any[], queryParams: Params|null, + fragment: string|null): UrlTree { if (commands.length === 0) { return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment); } @@ -47,7 +47,7 @@ function isCommandWithOutlets(command: any): command is {outlets: {[key: string] function tree( oldSegmentGroup: UrlSegmentGroup, newSegmentGroup: UrlSegmentGroup, urlTree: UrlTree, - queryParams: Params, fragment: string): UrlTree { + queryParams: Params|null, fragment: string|null): UrlTree { let qp: any = {}; if (queryParams) { forEach(queryParams, (value: any, name: any) => { diff --git a/packages/router/src/recognize.ts b/packages/router/src/recognize.ts index a3568d1b1c46..64d3f2545924 100644 --- a/packages/router/src/recognize.ts +++ b/packages/router/src/recognize.ts @@ -67,7 +67,7 @@ export class Recognizer { // Use Object.freeze to prevent readers of the Router state from modifying it outside of a // navigation, resulting in the router being out of sync with the browser. const root = new ActivatedRouteSnapshot( - [], Object.freeze({}), Object.freeze({...this.urlTree.queryParams}), this.urlTree.fragment!, + [], Object.freeze({}), Object.freeze({...this.urlTree.queryParams}), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {}); const rootNode = new TreeNode(root, children); @@ -160,7 +160,7 @@ export class Recognizer { if (route.path === '**') { const params = segments.length > 0 ? last(segments)!.parameters : {}; snapshot = new ActivatedRouteSnapshot( - segments, params, Object.freeze({...this.urlTree.queryParams}), this.urlTree.fragment!, + segments, params, Object.freeze({...this.urlTree.queryParams}), this.urlTree.fragment, getData(route), getOutlet(route), route.component!, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route)); @@ -174,7 +174,7 @@ export class Recognizer { snapshot = new ActivatedRouteSnapshot( consumedSegments, result.parameters, Object.freeze({...this.urlTree.queryParams}), - this.urlTree.fragment!, getData(route), getOutlet(route), route.component!, route, + this.urlTree.fragment, getData(route), getOutlet(route), route.component!, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route)); } diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 4c10c3681f04..f67a6c9a1408 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -1142,7 +1142,7 @@ export class Router { if (q !== null) { q = this.removeEmptyProps(q); } - return createUrlTree(a, this.currentUrlTree, commands, q!, f!); + return createUrlTree(a, this.currentUrlTree, commands, q, f ?? null); } /** diff --git a/packages/router/src/router_state.ts b/packages/router/src/router_state.ts index 456e72cde115..faf6edd3e139 100644 --- a/packages/router/src/router_state.ts +++ b/packages/router/src/router_state.ts @@ -126,7 +126,7 @@ export class ActivatedRoute { /** An observable of the query parameters shared by all the routes. */ public queryParams: Observable, /** An observable of the URL fragment shared by all the routes. */ - public fragment: Observable, + public fragment: Observable, /** An observable of the static and resolved data of this route. */ public data: Observable, /** The outlet name of the route, a constant. */ @@ -321,7 +321,7 @@ export class ActivatedRouteSnapshot { /** The query parameters shared by all the routes */ public queryParams: Params, /** The URL fragment shared by all the routes */ - public fragment: string, + public fragment: string|null, /** The static and resolved data of this route */ public data: Data, /** The outlet name of the route */ diff --git a/packages/router/src/url_tree.ts b/packages/router/src/url_tree.ts index f1f8f1b7424b..6ed907e35907 100644 --- a/packages/router/src/url_tree.ts +++ b/packages/router/src/url_tree.ts @@ -382,7 +382,7 @@ export class DefaultUrlSerializer implements UrlSerializer { const segment = `/${serializeSegment(tree.root, true)}`; const query = serializeQueryParams(tree.queryParams); const fragment = - typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment!)}` : ''; + typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment)}` : ''; return `${segment}${query}${fragment}`; } diff --git a/packages/router/test/create_url_tree.spec.ts b/packages/router/test/create_url_tree.spec.ts index 2d6a0dd3ece5..bf704d577d42 100644 --- a/packages/router/test/create_url_tree.spec.ts +++ b/packages/router/test/create_url_tree.spec.ts @@ -406,7 +406,7 @@ function createRoot(tree: UrlTree, commands: any[], queryParams?: Params, fragme new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), PRIMARY_OUTLET, 'someComponent', s); advanceActivatedRoute(a); - return createUrlTree(a, tree, commands, queryParams!, fragment!); + return createUrlTree(a, tree, commands, queryParams ?? null, fragment ?? null); } function create( @@ -422,5 +422,5 @@ function create( new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), new BehaviorSubject(null!), PRIMARY_OUTLET, 'someComponent', s); advanceActivatedRoute(a); - return createUrlTree(a, tree, commands, queryParams!, fragment!); + return createUrlTree(a, tree, commands, queryParams ?? null, fragment ?? null); } diff --git a/packages/router/test/integration.spec.ts b/packages/router/test/integration.spec.ts index be145567be43..818ab08e9141 100644 --- a/packages/router/test/integration.spec.ts +++ b/packages/router/test/integration.spec.ts @@ -1273,6 +1273,20 @@ describe('Integration', () => { expect(fixture.nativeElement).toHaveText('query: 2 fragment: fragment2'); }))); + it('should handle empty or missing fragments', fakeAsync(inject([Router], (router: Router) => { + const fixture = createRoot(router, RootCmp); + + router.resetConfig([{path: 'query', component: QueryParamsAndFragmentCmp}]); + + router.navigateByUrl('/query#'); + advance(fixture); + expect(fixture.nativeElement).toHaveText('query: fragment: '); + + router.navigateByUrl('/query'); + advance(fixture); + expect(fixture.nativeElement).toHaveText('query: fragment: null'); + }))); + it('should ignore null and undefined query params', fakeAsync(inject([Router], (router: Router) => { const fixture = createRoot(router, RootCmp); @@ -6058,7 +6072,15 @@ class QueryParamsAndFragmentCmp { constructor(route: ActivatedRoute) { this.name = route.queryParamMap.pipe(map((p: ParamMap) => p.get('name'))); - this.fragment = route.fragment; + this.fragment = route.fragment.pipe(map((p: string|null|undefined) => { + if (p === undefined) { + return 'undefined'; + } else if (p === null) { + return 'null'; + } else { + return p; + } + })); } } diff --git a/packages/router/test/url_serializer.spec.ts b/packages/router/test/url_serializer.spec.ts index e39c911f1a20..3e10884b3626 100644 --- a/packages/router/test/url_serializer.spec.ts +++ b/packages/router/test/url_serializer.spec.ts @@ -186,6 +186,12 @@ describe('url serializer', () => { expect(url.serialize(tree)).toEqual('/one#'); }); + it('should parse no fragment', () => { + const tree = url.parse('/one'); + expect(tree.fragment).toEqual(null); + expect(url.serialize(tree)).toEqual('/one'); + }); + describe('encoding/decoding', () => { it('should encode/decode path segments and parameters', () => { const u = `/${encodeUriSegment('one two')};${encodeUriSegment('p 1')}=${ diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 154e48a9b269..9d7a2bed56a7 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -156,6 +156,7 @@ def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps api_extractor = _INTERNAL_NG_MODULE_API_EXTRACTOR, ng_xi18n = _INTERNAL_NG_MODULE_XI18N, module_name = module_name, + perf_flag = "//packages/compiler-cli:ng_perf", **kwargs ) diff --git a/yarn.lock b/yarn.lock index e7120051739f..b6ca40aff32f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2447,6 +2447,13 @@ resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== +"@types/conventional-commits-parser@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/conventional-commits-parser/-/conventional-commits-parser-3.0.1.tgz#1a4796a0ae2bf33b41ea49f55e27ccbdb29cce5e" + integrity sha512-xkKomW6PqJS0rzFPPQSzKwbKIRqAGjYa1aWWkoT14YYodXyEpG4ok4H1US3olqGBxejz7EeBfT3fTJ3hUOiUkQ== + dependencies: + "@types/node" "*" + "@types/convert-source-map@^1.5.1": version "1.5.1" resolved "https://registry.yarnpkg.com/@types/convert-source-map/-/convert-source-map-1.5.1.tgz#d4d180dd6adc5cb68ad99bd56e03d637881f4616" @@ -3108,7 +3115,7 @@ ansi-colors@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-escapes@^3.0.0, ansi-escapes@^3.1.0, ansi-escapes@^3.2.0: +ansi-escapes@^3.1.0, ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== @@ -5313,6 +5320,19 @@ conventional-commits-parser@^3.2.0: through2 "^4.0.0" trim-off-newlines "^1.0.0" +conventional-commits-parser@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.1.tgz#ba44f0b3b6588da2ee9fd8da508ebff50d116ce2" + integrity sha512-OG9kQtmMZBJD/32NEw5IhN5+HnBqVjy03eC+I71I0oQRFA5rOgA4OtPOYG7mz1GkCfCNxn3gKIX8EiHJYuf1cA== + dependencies: + JSONStream "^1.0.4" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" + trim-off-newlines "^1.0.0" + convert-source-map@1.7.0, convert-source-map@^1.1.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" @@ -8631,16 +8651,6 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -inquirer-autocomplete-prompt@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-1.0.2.tgz#3f2548f73dd12f0a541be055ea9c8c7aedeb42bf" - integrity sha512-vNmAhhrOQwPnUm4B9kz1UB7P98rVF1z8txnjp53r40N0PBCuqoRWqjg3Tl0yz0UkDg7rEUtZ2OZpNc7jnOU9Zw== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - figures "^2.0.0" - run-async "^2.3.0" - inquirer@7.3.3, inquirer@^7.3.3: version "7.3.3" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" @@ -13628,11 +13638,6 @@ run-async@^2.2.0, run-async@^2.4.0: dependencies: is-promise "^2.1.0" -run-async@^2.3.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - run-parallel@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679"