Skip to content

Commit 798752b

Browse files
crisbetothePunderWoman
authored andcommitted
refactor(compiler): remove input transforms feature (#59980)
An earlier refactor made the `InputTransformsFeature` a no-op so these changes remove the code that was generating it. PR Close #59980
1 parent 9511782 commit 798752b

File tree

11 files changed

+3
-84
lines changed

11 files changed

+3
-84
lines changed

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_input_outputs/input_transform_definition.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ MyDirective.ɵdir = /*@__PURE__*/ $r3$.ɵɵdefineDirective({
44
functionDeclarationInput: [2, "functionDeclarationInput", "functionDeclarationInput", toNumber],
55
inlineFunctionInput: [2, "inlineFunctionInput", "inlineFunctionInput", (value, _) => value ? 1 : 0]
66
},
7-
standalone: false,
8-
features: [$r3$.ɵɵInputTransformsFeature]
7+
98
});

packages/compiler-cli/test/compliance/test_cases/signal_inputs/mixed_input_types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ TestDir.ɵdir = /* @__PURE__ */ $r3$.ɵɵdefineDirective({
77
decoratorInput: "decoratorInput",
88
decoratorInputWithAlias: [0, "publicNameDecorator", "decoratorInputWithAlias"],
99
decoratorInputWithTransformAndAlias: [2, "publicNameDecorator2", "decoratorInputWithTransformAndAlias", convertToBoolean]
10-
},
10+
}
1111
12-
});
12+
});

packages/compiler-cli/test/ngtsc/ngtsc_spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10482,7 +10482,6 @@ runInEachFileSystem((os: string) => {
1048210482
const dtsContents = env.getContents('test.d.ts');
1048310483

1048410484
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10485-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1048610485
expect(dtsContents).toContain('static ngAcceptInputType_value: boolean | string;');
1048710486
});
1048810487

@@ -10507,7 +10506,6 @@ runInEachFileSystem((os: string) => {
1050710506
const dtsContents = env.getContents('test.d.ts');
1050810507

1050910508
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10510-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1051110509
expect(dtsContents).toContain('static ngAcceptInputType_value: boolean | string;');
1051210510
});
1051310511

@@ -10541,7 +10539,6 @@ runInEachFileSystem((os: string) => {
1054110539
const dtsContents = env.getContents('test.d.ts');
1054210540

1054310541
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10544-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1054510542
expect(dtsContents).toContain('import * as i1 from "./types"');
1054610543
expect(dtsContents).toContain(
1054710544
'static ngAcceptInputType_value: boolean | string | i1.GenericWrapper<string>;',
@@ -10588,7 +10585,6 @@ runInEachFileSystem((os: string) => {
1058810585
const dtsContents = env.getContents('test.d.ts');
1058910586

1059010587
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10591-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1059210588
expect(dtsContents).toContain('import * as i1 from "./types"');
1059310589
expect(dtsContents).toContain('import * as i2 from "./other-types"');
1059410590
expect(dtsContents).toContain(
@@ -10630,7 +10626,6 @@ runInEachFileSystem((os: string) => {
1063010626

1063110627
expect(jsContents).toContain(`import { externalToNumber } from 'external';`);
1063210628
expect(jsContents).toContain('inputs: { value: [2, "value", "value", externalToNumber] }');
10633-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1063410629
expect(dtsContents).toContain('import * as i1 from "external";');
1063510630
expect(dtsContents).toContain('static ngAcceptInputType_value: i1.ExternalToNumberType;');
1063610631
});
@@ -10668,7 +10663,6 @@ runInEachFileSystem((os: string) => {
1066810663
expect(jsContents).toContain(
1066910664
'inputs: { value: [2, "value", "value", (value) => value ? 1 : 0] }',
1067010665
);
10671-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1067210666
expect(dtsContents).toContain('import * as i1 from "external";');
1067310667
expect(dtsContents).toContain('static ngAcceptInputType_value: i1.ExternalToNumberType;');
1067410668
});
@@ -10701,7 +10695,6 @@ runInEachFileSystem((os: string) => {
1070110695
const dtsContents = env.getContents('test.d.ts');
1070210696

1070310697
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toBoolean] }');
10704-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1070510698
expect(dtsContents).toContain(
1070610699
`static ngAcceptInputType_value: boolean | "" | "true" | "false";`,
1070710700
);
@@ -10728,7 +10721,6 @@ runInEachFileSystem((os: string) => {
1072810721
const dtsContents = env.getContents('test.d.ts');
1072910722

1073010723
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10731-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1073210724
expect(dtsContents).toContain('static ngAcceptInputType_value: boolean | string;');
1073310725
});
1073410726

@@ -10753,40 +10745,9 @@ runInEachFileSystem((os: string) => {
1075310745
const dtsContents = env.getContents('test.d.ts');
1075410746

1075510747
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10756-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1075710748
expect(dtsContents).toContain('static ngAcceptInputType_value: unknown;');
1075810749
});
1075910750

10760-
it('should insert the InputTransformsFeature before the InheritDefinitionFeature', () => {
10761-
env.write(
10762-
'/test.ts',
10763-
`
10764-
import {Directive, Input} from '@angular/core';
10765-
10766-
function toNumber(value: boolean | string) { return 1; }
10767-
10768-
@Directive()
10769-
export class ParentDir {}
10770-
10771-
@Directive()
10772-
export class Dir extends ParentDir {
10773-
@Input({transform: toNumber}) value!: number;
10774-
}
10775-
`,
10776-
);
10777-
10778-
env.driveMain();
10779-
10780-
const jsContents = env.getContents('test.js');
10781-
const dtsContents = env.getContents('test.d.ts');
10782-
10783-
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10784-
expect(jsContents).toContain(
10785-
'features: [i0.ɵɵInputTransformsFeature, i0.ɵɵInheritDefinitionFeature]',
10786-
);
10787-
expect(dtsContents).toContain('static ngAcceptInputType_value: boolean | string;');
10788-
});
10789-
1079010751
it('should compile an input with using an ambient type in the transform function', () => {
1079110752
env.write(
1079210753
'node_modules/external/index.d.ts',
@@ -10818,7 +10779,6 @@ runInEachFileSystem((os: string) => {
1081810779
expect(jsContents).toContain(
1081910780
'inputs: { element: [2, "element", "element", coerceElement] }',
1082010781
);
10821-
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1082210782
expect(dtsContents).toContain(
1082310783
'static ngAcceptInputType_element: HTMLElement | i0.ElementRef<HTMLElement>;',
1082410784
);

packages/compiler/src/render3/r3_identifiers.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,6 @@ export class Identifiers {
551551
moduleName: CORE,
552552
};
553553

554-
static InputTransformsFeatureFeature: o.ExternalReference = {
555-
name: 'ɵɵInputTransformsFeature',
556-
moduleName: CORE,
557-
};
558-
559554
static ExternalStylesFeature: o.ExternalReference = {
560555
name: 'ɵɵExternalStylesFeature',
561556
moduleName: CORE,

packages/compiler/src/render3/view/compiler.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ function addFeatures(
114114

115115
const providers = meta.providers;
116116
const viewProviders = (meta as R3ComponentMetadata<R3TemplateDependency>).viewProviders;
117-
const inputKeys = Object.keys(meta.inputs);
118117

119118
if (providers || viewProviders) {
120119
const args = [providers || new o.LiteralArrayExpr([])];
@@ -123,12 +122,6 @@ function addFeatures(
123122
}
124123
features.push(o.importExpr(R3.ProvidersFeature).callFn(args));
125124
}
126-
for (const key of inputKeys) {
127-
if (meta.inputs[key].transformFunction !== null) {
128-
features.push(o.importExpr(R3.InputTransformsFeatureFeature));
129-
break;
130-
}
131-
}
132125
// Note: host directives feature needs to be inserted before the
133126
// inheritance feature to ensure the correct execution order.
134127
if (meta.hostDirectives?.length) {

packages/core/src/core_render3_private_export.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export {
116116
ɵɵi18nPostprocess,
117117
ɵɵi18nStart,
118118
ɵɵInheritDefinitionFeature,
119-
ɵɵInputTransformsFeature,
120119
ɵɵinjectAttribute,
121120
ɵɵInjectorDeclaration,
122121
ɵɵinvalidFactory,

packages/core/src/render3/features/input_transforms_feature.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/core/src/render3/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineNgModule, ɵɵdefine
99
import {ɵɵCopyDefinitionFeature} from './features/copy_definition_feature';
1010
import {ɵɵHostDirectivesFeature} from './features/host_directives_feature';
1111
import {ɵɵInheritDefinitionFeature} from './features/inherit_definition_feature';
12-
import {ɵɵInputTransformsFeature} from './features/input_transforms_feature';
1312
import {ɵɵNgOnChangesFeature} from './features/ng_onchanges_feature';
1413
import {ɵɵProvidersFeature} from './features/providers_feature';
1514
import {ɵɵExternalStylesFeature} from './features/external_styles_feature';
@@ -246,7 +245,6 @@ export {
246245
ɵɵHostDirectivesFeature,
247246
ɵɵInheritDefinitionFeature,
248247
ɵɵInjectorDeclaration,
249-
ɵɵInputTransformsFeature,
250248
ɵɵNgModuleDeclaration,
251249
ɵɵNgOnChangesFeature,
252250
ɵɵPipeDeclaration,

packages/core/src/render3/jit/environment.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const angularCoreEnv: {[name: string]: unknown} = (() => ({
4949
'ɵɵProvidersFeature': r3.ɵɵProvidersFeature,
5050
'ɵɵCopyDefinitionFeature': r3.ɵɵCopyDefinitionFeature,
5151
'ɵɵInheritDefinitionFeature': r3.ɵɵInheritDefinitionFeature,
52-
'ɵɵInputTransformsFeature': r3.ɵɵInputTransformsFeature,
5352
'ɵɵExternalStylesFeature': r3.ɵɵExternalStylesFeature,
5453
'ɵɵnextContext': r3.ɵɵnextContext,
5554
'ɵɵnamespaceHTML': r3.ɵɵnamespaceHTML,

packages/core/test/bundling/router/bundle.golden_symbols.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@
727727
"{isArray:isArray2}",
728728
"{isArray:isArray}",
729729
"ɵEmptyOutletComponent",
730-
"ɵɵInputTransformsFeature",
731730
"ɵɵNgOnChangesFeature",
732731
"ɵɵattribute",
733732
"ɵɵdefineComponent",

0 commit comments

Comments
 (0)