Skip to content

Commit 8c71b9f

Browse files
alxhubthePunderWoman
authored andcommitted
refactor: delete the View Engine runtime (#43884)
This commit removes the View Engine runtime. Itself, this change is relatively straightforward, but it represents the final step in a multi-year journey. It's only possible due to the hard work of many current and former team members and collaborators, who are too numerous to list here. Co-authored-by: Alan Agius <alan.agius4@gmail.com> Co-authored-by: Andrew Kushnir <akushnir@google.com> Co-authored-by: Andrew Scott <atscott01@gmail.com> Co-authored-by: Andrew Seguin <andrewjs@google.com> Co-authored-by: Cédric Exbrayat <cedric@ninja-squad.com> Co-authored-by: Charles Lyding <19598772+clydin@users.noreply.github.com> Co-authored-by: Dave Shevitz <dshevitz@google.com> Co-authored-by: Doug Parker <dgp1130@users.noreply.github.com> Co-authored-by: Dylan Hunn <dylhunn@gmail.com> Co-authored-by: Emma Twersky <emmatwersky@google.com> Co-authored-by: George Kalpakas <kalpakas.g@gmail.com> Co-authored-by: Igor Minar <iminar@google.com> Co-authored-by: Jeremy Elbourn <jelbourn@google.com> Co-authored-by: Jessica Janiuk <jessicajaniuk@google.com> Co-authored-by: JiaLiPassion <JiaLi.Passion@gmail.com> Co-authored-by: Joey Perrott <josephperrott@gmail.com> Co-authored-by: Joost Koehoorn <joost.koehoorn@gmail.com> Co-authored-by: Kristiyan Kostadinov <crisbeto@abv.bg> Co-authored-by: Madleina Scheidegger <mscheid@google.com> Co-authored-by: Mark Thompson <2554588+MarkTechson@users.noreply.github.com> Co-authored-by: Minko Gechev <mgechev@gmail.com> Co-authored-by: Paul Gschwendtner <paulgschwendtner@gmail.com> Co-authored-by: Pawel Kozlowski <pkozlowski.opensource@gmail.com> Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com> Co-authored-by: Wagner Maciel <wagnermaciel@google.com> Co-authored-by: Zach Arend <zachzach@google.com> PR Close #43884
1 parent aadfad7 commit 8c71b9f

File tree

99 files changed

+372
-7454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+372
-7454
lines changed

goldens/circular-deps/packages.json

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@
5050
"packages/compiler/src/render3/view/styling_builder.ts",
5151
"packages/compiler/src/render3/view/template.ts"
5252
],
53-
[
54-
"packages/core/src/change_detection/change_detection.ts",
55-
"packages/core/src/change_detection/change_detector_ref.ts",
56-
"packages/core/src/render3/view_ref.ts",
57-
"packages/core/src/render3/instructions/shared.ts",
58-
"packages/core/src/error_handler.ts",
59-
"packages/core/src/errors.ts",
60-
"packages/core/src/view/types.ts",
61-
"packages/core/src/linker/component_factory.ts"
62-
],
6353
[
6454
"packages/core/src/change_detection/change_detector_ref.ts",
6555
"packages/core/src/render3/view_ref.ts"
@@ -101,42 +91,6 @@
10191
"packages/core/src/di/reflective_errors.ts",
10292
"packages/core/src/di/reflective_injector.ts"
10393
],
104-
[
105-
"packages/core/src/error_handler.ts",
106-
"packages/core/src/errors.ts",
107-
"packages/core/src/view/types.ts"
108-
],
109-
[
110-
"packages/core/src/error_handler.ts",
111-
"packages/core/src/errors.ts",
112-
"packages/core/src/view/types.ts",
113-
"packages/core/src/linker/template_ref.ts",
114-
"packages/core/src/render3/instructions/shared.ts"
115-
],
116-
[
117-
"packages/core/src/error_handler.ts",
118-
"packages/core/src/errors.ts",
119-
"packages/core/src/view/types.ts",
120-
"packages/core/src/linker/view_container_ref.ts",
121-
"packages/core/src/render3/component_ref.ts",
122-
"packages/core/src/render3/component.ts",
123-
"packages/core/src/render3/instructions/shared.ts"
124-
],
125-
[
126-
"packages/core/src/error_handler.ts",
127-
"packages/core/src/errors.ts",
128-
"packages/core/src/view/types.ts",
129-
"packages/core/src/linker/view_container_ref.ts",
130-
"packages/core/src/render3/component_ref.ts",
131-
"packages/core/src/render3/instructions/shared.ts"
132-
],
133-
[
134-
"packages/core/src/error_handler.ts",
135-
"packages/core/src/errors.ts",
136-
"packages/core/src/view/types.ts",
137-
"packages/core/src/linker/view_container_ref.ts",
138-
"packages/core/src/render3/instructions/shared.ts"
139-
],
14094
[
14195
"packages/core/src/linker/component_factory_resolver.ts",
14296
"packages/core/src/linker/component_factory.ts",

goldens/public-api/core/core.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ export interface ClassSansProvider {
139139
export class Compiler {
140140
clearCache(): void;
141141
clearCacheFor(type: Type<any>): void;
142-
compileModuleAndAllComponentsAsync: <T>(moduleType: Type<T>) => Promise<ModuleWithComponentFactories<T>>;
143-
compileModuleAndAllComponentsSync: <T>(moduleType: Type<T>) => ModuleWithComponentFactories<T>;
144-
compileModuleAsync: <T>(moduleType: Type<T>) => Promise<NgModuleFactory<T>>;
145-
compileModuleSync: <T>(moduleType: Type<T>) => NgModuleFactory<T>;
142+
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>>;
143+
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T>;
144+
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>>;
145+
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T>;
146146
getModuleId(moduleType: Type<any>): string | undefined;
147147
// (undocumented)
148148
static ɵfac: i0.ɵɵFactoryDeclaration<Compiler, never>;
@@ -281,7 +281,7 @@ export interface ContentChildrenDecorator {
281281
}
282282

283283
// @public
284-
export const createNgModuleRef: <T>(ngModule: Type<T>, parentInjector?: Injector) => NgModuleRef<T>;
284+
export function createNgModuleRef<T>(ngModule: Type<T>, parentInjector?: Injector): NgModuleRef<T>;
285285

286286
// @public
287287
export function createPlatform(injector: Injector): PlatformRef;
@@ -500,10 +500,10 @@ export interface ForwardRefFn {
500500
export const getDebugNode: (nativeNode: any) => DebugNode | null;
501501

502502
// @public @deprecated
503-
export const getModuleFactory: (id: string) => NgModuleFactory<any>;
503+
export function getModuleFactory(id: string): NgModuleFactory<any>;
504504

505505
// @public
506-
export const getNgModuleById: <T>(id: string) => Type<T>;
506+
export function getNgModuleById<T>(id: string): Type<T>;
507507

508508
// @public
509509
export function getPlatform(): PlatformRef | null;
@@ -1238,7 +1238,7 @@ export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvi
12381238
// @public
12391239
export abstract class TemplateRef<C> {
12401240
abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
1241-
abstract get elementRef(): ElementRef;
1241+
abstract readonly elementRef: ElementRef;
12421242
}
12431243

12441244
// @public

goldens/size-tracking/aio-payloads.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"master": {
1616
"uncompressed": {
1717
"runtime": 4436,
18-
"main": 460360,
18+
"main": 459822,
1919
"polyfills": 37271,
2020
"styles": 70719,
2121
"light-theme": 77717,
2222
"dark-theme": 77897
2323
}
2424
}
2525
}
26-
}
26+
}

goldens/size-tracking/integration-payloads.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"master": {
44
"uncompressed": {
55
"runtime": 1083,
6-
"main": 139282,
7-
"polyfills": 36964
6+
"main": 138745,
7+
"polyfills": 37226
88
}
99
}
1010
},
@@ -42,7 +42,7 @@
4242
"master": {
4343
"uncompressed": {
4444
"runtime": 2843,
45-
"main": 237895,
45+
"main": 231164,
4646
"polyfills": 37064,
4747
"src_app_lazy_lazy_module_ts": 795
4848
}
@@ -68,4 +68,4 @@
6868
}
6969
}
7070
}
71-
}
71+
}

packages/common/test/pipes/date_pipe_spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import localeEn from '@angular/common/locales/en';
1111
import localeEnExtra from '@angular/common/locales/extra/en';
1212
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
1313
import {ɵregisterLocaleData, ɵunregisterLocaleData} from '@angular/core';
14-
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
1514

1615
{
1716
describe('DatePipe', () => {
@@ -27,10 +26,6 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle
2726
pipe = new DatePipe('en-US', null);
2827
});
2928

30-
it('should be marked as pure', () => {
31-
expect(new PipeResolver(new JitReflector()).resolve(DatePipe)!.pure).toEqual(true);
32-
});
33-
3429
describe('supports', () => {
3530
it('should support date', () => {
3631
expect(() => pipe.transform(date)).not.toThrow();

packages/common/test/pipes/i18n_plural_pipe_spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import {I18nPluralPipe, NgLocalization} from '@angular/common';
1010
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
11-
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
1211

1312
{
1413
describe('I18nPluralPipe', () => {
@@ -27,10 +26,6 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle
2726
pipe = new I18nPluralPipe(localization);
2827
});
2928

30-
it('should be marked as pure', () => {
31-
expect(new PipeResolver(new JitReflector()).resolve(I18nPluralPipe)!.pure).toEqual(true);
32-
});
33-
3429
describe('transform', () => {
3530
it('should return 0 text if value is 0', () => {
3631
const val = pipe.transform(0, mapping);

packages/common/test/pipes/i18n_select_pipe_spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88

99
import {I18nSelectPipe} from '@angular/common';
1010
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
11-
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
1211

1312
{
1413
describe('I18nSelectPipe', () => {
1514
const pipe: I18nSelectPipe = new I18nSelectPipe();
1615
const mapping = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'};
1716

18-
it('should be marked as pure', () => {
19-
expect(new PipeResolver(new JitReflector()).resolve(I18nSelectPipe)!.pure).toEqual(true);
20-
});
21-
2217
describe('transform', () => {
2318
it('should return the "male" text if value is "male"', () => {
2419
const val = pipe.transform('male', mapping);

packages/compiler-cli/linker/src/file_linker/translator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import * as o from '@angular/compiler';
9+
910
import {AstFactory, Context, ExpressionTranslatorVisitor, ImportGenerator, TranslatorOptions} from '../../../src/ngtsc/translator';
1011

1112
/**

packages/compiler-cli/ngcc/src/execution/cluster/master.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,9 @@ export class ClusterMaster {
156156
`Worker #${worker.id} exited unexpectedly (code: ${code} | signal: ${signal}).\n` +
157157
` Current task: ${(assignment == null) ? '-' : stringifyTask(assignment.task)}\n` +
158158
` Current phase: ${
159-
(assignment == null) ? '-' :
160-
(assignment.files == null) ? 'compiling' : 'writing files'}`);
159+
(assignment == null) ? '-' :
160+
(assignment.files == null) ? 'compiling' :
161+
'writing files'}`);
161162

162163
if (assignment == null) {
163164
// The crashed worker process was not in the middle of a task:

packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function generateTypeCheckBlock(
8484
genericContextBehavior: TcbGenericContextBehavior): ts.FunctionDeclaration {
8585
const tcb = new Context(
8686
env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
87-
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template !, /* guard */ null);
87+
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template!, /* guard */ null);
8888
const ctxRawType = env.referenceType(ref);
8989
if (!ts.isTypeReferenceNode(ctxRawType)) {
9090
throw new Error(

0 commit comments

Comments
 (0)