{{ name | myPipe:1:2:3:4:5 }} {{ name ? 1 : 2 | myPipe }}
', isInline: true }, pipes: { "myPurePipe": MyPurePipe, "myPipe": MyPipe } }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyApp, [{ + type: Component, + args: [{ + selector: 'my-app', + template: '{{name | myPipe:size | myPurePipe:size }}{{ name | myPipe:1:2:3:4:5 }} {{ name ? 1 : 2 | myPipe }}
' + }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyPipe, MyPurePipe, MyApp] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyPipe, MyPurePipe, MyApp] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: pipes.d.ts + ****************************************************************************************************/ +import { OnDestroy, PipeTransform } from '@angular/core'; +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{{ name | myOtherPipe }}
', isInline: true }, pipes: { "myPipe": MyPipe, "myOtherPipe": MyOtherPipe } }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyApp, [{ + type: Component, + args: [{ selector: 'my-app', template: '{{name | myPipe }}{{ name | myOtherPipe }}
' }] + }], null, null); })(); +export class MyModule { +} +MyModule.ɵmod = i0.ɵɵdefineNgModule({ type: MyModule }); +MyModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } }); +(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyPipe, MyOtherPipe, MyApp] }); })(); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyModule, [{ + type: NgModule, + args: [{ declarations: [MyPipe, MyOtherPipe, MyApp] }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: pipe_di_change_detector_ref.d.ts + ****************************************************************************************************/ +import { ChangeDetectorRef, PipeTransform } from '@angular/core'; +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{{ name | myOtherPipe }}
'}) +export class MyApp { + name = 'World'; +} + +@NgModule({declarations: [MyPipe, MyOtherPipe, MyApp]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_def.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_def.js new file mode 100644 index 0000000000..27a602a152 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_def.js @@ -0,0 +1,5 @@ +MyOtherPipe.ɵpipe = $r3$.ɵɵdefinePipe({ + name: "myOtherPipe", + type: MyOtherPipe, + pure: true +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_fac.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_fac.js new file mode 100644 index 0000000000..e858b8160a --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_other_pipe_fac.js @@ -0,0 +1 @@ +MyOtherPipe.ɵfac = function MyOtherPipe_Factory(t) { return new (t || MyOtherPipe)($r3$.ɵɵinjectPipeChangeDetectorRef(8)); }; diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_def.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_def.js new file mode 100644 index 0000000000..1978a4c76a --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_def.js @@ -0,0 +1,5 @@ +MyPipe.ɵpipe = $r3$.ɵɵdefinePipe({ + name: "myPipe", + type: MyPipe, + pure: true +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_fac.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_fac.js new file mode 100644 index 0000000000..9b12d4d695 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_di_change_detector_ref_my_pipe_fac.js @@ -0,0 +1 @@ +MyPipe.ɵfac = function MyPipe_Factory(t) { return new (t || MyPipe)($r3$.ɵɵinjectPipeChangeDetectorRef()); }; diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.js new file mode 100644 index 0000000000..69a3042d7d --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.js @@ -0,0 +1,29 @@ +// ... +MyApp.ɵcmp = $r3$.ɵɵdefineComponent({ + type: MyApp, + selectors: [["my-app"]], + decls: 6, + vars: 27, + template: function MyApp_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵtext(0); + $r3$.ɵɵpipe(1, "myPipe"); + $r3$.ɵɵpipe(2, "myPipe"); + $r3$.ɵɵpipe(3, "myPipe"); + $r3$.ɵɵpipe(4, "myPipe"); + $r3$.ɵɵpipe(5, "myPipe"); + } + if (rf & 2) { + $r3$.ɵɵtextInterpolate5( + "0:", i0.ɵɵpipeBind1(1, 5, ctx.name), + "1:", i0.ɵɵpipeBind2(2, 7, ctx.name, 1), + "2:", i0.ɵɵpipeBind3(3, 10, ctx.name, 1, 2), + "3:", i0.ɵɵpipeBind4(4, 14, ctx.name, 1, 2, 3), + "4:", i0.ɵɵpipeBindV(5, 19, $r3$.ɵɵpureFunction1(25, $c0$, ctx.name)), + "" + ); + } + }, + pipes: [MyPipe], + encapsulation: 2 +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.ts new file mode 100644 index 0000000000..607de19903 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipe_invocation.ts @@ -0,0 +1,21 @@ +import {Component, NgModule, OnDestroy, Pipe, PipeTransform} from '@angular/core'; + +@Pipe({name: 'myPipe', pure: false}) +export class MyPipe implements PipeTransform, OnDestroy { + transform(value: any, ...args: any[]) { + return value; + } + ngOnDestroy(): void {} +} + +@Component({ + selector: 'my-app', + template: + '0:{{name | myPipe}}1:{{name | myPipe:1}}2:{{name | myPipe:1:2}}3:{{name | myPipe:1:2:3}}4:{{name | myPipe:1:2:3:4}}' +}) +export class MyApp { +} + +@NgModule({declarations: [MyPipe, MyApp]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes.ts b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes.ts new file mode 100644 index 0000000000..4dc48a80c1 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes.ts @@ -0,0 +1,33 @@ +import {Component, NgModule, OnDestroy, Pipe, PipeTransform} from '@angular/core'; + +@Pipe({name: 'myPipe', pure: false}) +export class MyPipe implements PipeTransform, OnDestroy { + transform(value: any, ...args: any[]) { + return value; + } + ngOnDestroy(): void {} +} + +@Pipe({ + name: 'myPurePipe', + pure: true, +}) +export class MyPurePipe implements PipeTransform { + transform(value: any, ...args: any[]) { + return value; + } +} + +@Component({ + selector: 'my-app', + template: + '{{name | myPipe:size | myPurePipe:size }}{{ name | myPipe:1:2:3:4:5 }} {{ name ? 1 : 2 | myPipe }}
' +}) +export class MyApp { + name = 'World'; + size = 0; +} + +@NgModule({declarations: [MyPipe, MyPurePipe, MyApp]}) +export class MyModule { +} diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_app_def.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_app_def.js new file mode 100644 index 0000000000..fb780dac4c --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_app_def.js @@ -0,0 +1,29 @@ +const $c0$ = function ($a0$) { + return [$a0$, 1, 2, 3, 4, 5]; +}; +// ... +MyApp.ɵcmp = $r3$.ɵɵdefineComponent({ + type: MyApp, + selectors: [["my-app"]], + decls: 7, + vars: 20, + template: function MyApp_Template(rf, ctx) { + if (rf & 1) { + $r3$.ɵɵtext(0); + $r3$.ɵɵpipe(1, "myPurePipe"); + $r3$.ɵɵpipe(2, "myPipe"); + $r3$.ɵɵelementStart(3, "p"); + $r3$.ɵɵtext(4); + $r3$.ɵɵpipe(5, "myPipe"); + $r3$.ɵɵpipe(6, "myPipe"); + $r3$.ɵɵelementEnd(); + } + if (rf & 2) { + $r3$.ɵɵtextInterpolate($r3$.ɵɵpipeBind2(1, 3, $r3$.ɵɵpipeBind2(2, 6, ctx.name, ctx.size), ctx.size)); + $r3$.ɵɵadvance(4); + $r3$.ɵɵtextInterpolate2("", $r3$.ɵɵpipeBindV(5, 9, $r3$.ɵɵpureFunction1(18, $c0$, ctx.name)), " ", ctx.name ? 1 : $r3$.ɵɵpipeBind1(6, 16, 2), ""); + } + }, + pipes: [MyPurePipe, MyPipe], + encapsulation: 2 +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_def.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_def.js new file mode 100644 index 0000000000..534234eedf --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_def.js @@ -0,0 +1,5 @@ +MyPipe.ɵpipe = $r3$.ɵɵdefinePipe({ + name: "myPipe", + type: MyPipe, + pure: false +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_fac.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_fac.js new file mode 100644 index 0000000000..b09691cc3d --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pipe_fac.js @@ -0,0 +1 @@ +MyPipe.ɵfac = function MyPipe_Factory(t) { return new (t || MyPipe)(); }; diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_def.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_def.js new file mode 100644 index 0000000000..5404b2f6e5 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_def.js @@ -0,0 +1,5 @@ +MyPurePipe.ɵpipe = $r3$.ɵɵdefinePipe({ + name: "myPurePipe", + type: MyPurePipe, + pure: true +}); diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_fac.js b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_fac.js new file mode 100644 index 0000000000..d0b57410cf --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/pipes/pipes_my_pure_pipe_fac.js @@ -0,0 +1 @@ +MyPurePipe.ɵfac = function MyPurePipe_Factory(t) { return new (t || MyPurePipe)(); }; 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 new file mode 100644 index 0000000000..4d6dc7b995 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/GOLDEN_PARTIAL.js @@ -0,0 +1,654 @@ +/**************************************************************************************************** + * PARTIAL FILE: some.directive.js + ****************************************************************************************************/ +import { Directive } from '@angular/core'; +import * as i0 from "@angular/core"; +export class SomeDirective { +} +SomeDirective.ɵfac = function SomeDirective_Factory(t) { return new (t || SomeDirective)(); }; +SomeDirective.ɵdir = i0.ɵɵngDeclareDirective({ version: 1, type: SomeDirective, selector: "[someDir]", ngImport: i0 }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(SomeDirective, [{ + type: Directive, + args: [{ + selector: '[someDir]', + }] + }], null, null); })(); + +/**************************************************************************************************** + * PARTIAL FILE: some.directive.d.ts + ****************************************************************************************************/ +import * as i0 from "@angular/core"; +export declare class SomeDirective { + static ɵfac: i0.ɵɵFactoryDef{{ names[0] }}
+{{ names[1] }}
+ `, isInline: true } }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(MyComp, [{ + type: Component, + args: [{ + selector: 'my-comp', + template: ` +{{ names[0] }}
+{{ names[1] }}
+ ` + }] + }], null, { names: [{ + type: Input + }] }); })(); +export class MyApp { + constructor() { + this.customName = 'Bess'; + } +} +MyApp.ɵfac = function MyApp_Factory(t) { return new (t || MyApp)(); }; +MyApp.ɵcmp = i0.ɵɵngDeclareComponent({ version: 1, type: MyApp, selector: "my-app", ngImport: i0, template: { source: ` +{{ config['duration'] }}
+{{ config.animation }}
+ `, isInline: true } }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(ObjectComp, [{ + type: Component, + args: [{ + selector: 'object-comp', + template: ` +{{ config['duration'] }}
+{{ config.animation }}
+ ` + }] + }], null, { config: [{ + type: Input + }] }); })(); +export class MyApp { + constructor() { + this.name = 'slide'; + } +} +MyApp.ɵfac = function MyApp_Factory(t) { return new (t || MyApp)(); }; +MyApp.ɵcmp = i0.ɵɵngDeclareComponent({ version: 1, type: MyApp, selector: "my-app", ngImport: i0, template: { source: ` +{{ config.animation }}
+{{config.actions[0].opacity }}
+{{config.actions[1].duration }}
+ `, isInline: true } }); +/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NestedComp, [{ + type: Component, + args: [{ + selector: 'nested-comp', + template: ` +{{ config.animation }}
+{{config.actions[0].opacity }}
+{{config.actions[1].duration }}
+ ` + }] + }], null, { config: [{ + type: Input + }] }); })(); +export class MyApp { + constructor() { + this.name = 'slide'; + this.duration = 100; + } +} +MyApp.ɵfac = function MyApp_Factory(t) { return new (t || MyApp)(); }; +MyApp.ɵcmp = i0.ɵɵngDeclareComponent({ version: 1, type: MyApp, selector: "my-app", ngImport: i0, template: { source: ` +