Skip to content

Commit 5d9cc8f

Browse files
JeanMechealxhub
authored andcommitted
refactor(core): remove the standalone feature (#58288)
By removing the standalone feature, we reduce the amount of code generated for components but at the cost of including the `StandaloneService` in the main bundle even if no standalone components are included in it. PR Close #58288
1 parent c7342be commit 5d9cc8f

File tree

55 files changed

+160
-151
lines changed

Some content is hidden

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

55 files changed

+160
-151
lines changed

goldens/size-tracking/integration-payloads.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"uncompressed": {
1616
"main": 108611,
1717
"polyfills": 34169,
18-
"lazy.routes": 368
18+
"lazy.routes": 361
1919
}
2020
},
2121
"forms": {
@@ -49,7 +49,7 @@
4949
"uncompressed": {
5050
"main": 11497,
5151
"polyfills": 33807,
52-
"defer.component": 351
52+
"defer.component": 345
5353
}
5454
},
5555
"platform-server-hydration/browser": {

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/signals/component.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ SignalCmp.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({
22
type: SignalCmp,
33
selectors: [["ng-component"]],
44
signals: true,
5-
features: [i0.ɵɵStandaloneFeature],
65
decls: 1,
76
vars: 0,
87
template: function SignalCmp_Template(rf, ctx) {

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/standalone/component.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
StandaloneCmp.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({
22
type: StandaloneCmp,
33
selectors: [["ng-component"]],
4-
features: [i0.ɵɵStandaloneFeature],
54
decls: 1,
65
vars: 0,
76
template: function StandaloneCmp_Template(rf, ctx) {

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/standalone/component.local.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
StandaloneCmp.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({
22
type: StandaloneCmp,
33
selectors: [["ng-component"]],
4-
features: [i0.ɵɵStandaloneFeature],
54
decls: 1,
65
vars: 0,
76
template: function StandaloneCmp_Template(rf, ctx) {

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/standalone/forward_ref.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ TestComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({
33
selectors: [
44
["test"]
55
],
6-
features: [i0.ɵɵStandaloneFeature],
76
decls: 1,
87
vars: 0,
98
template: function TestComponent_Template(rf, ctx) {

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10470,9 +10470,7 @@ runInEachFileSystem((os: string) => {
1047010470
const dtsContents = env.getContents('test.d.ts');
1047110471

1047210472
expect(jsContents).toContain('inputs: { value: [2, "value", "value", toNumber] }');
10473-
expect(jsContents).toContain(
10474-
'features: [i0.ɵɵInputTransformsFeature, i0.ɵɵStandaloneFeature]',
10475-
);
10473+
expect(jsContents).toContain('features: [i0.ɵɵInputTransformsFeature]');
1047610474
expect(dtsContents).toContain('static ngAcceptInputType_value: boolean | string;');
1047710475
});
1047810476

packages/compiler/src/render3/r3_identifiers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,6 @@ export class Identifiers {
539539
moduleName: CORE,
540540
};
541541

542-
static StandaloneFeature: o.ExternalReference = {name: 'ɵɵStandaloneFeature', moduleName: CORE};
543-
544542
static ProvidersFeature: o.ExternalReference = {name: 'ɵɵProvidersFeature', moduleName: CORE};
545543

546544
static HostDirectivesFeature: o.ExternalReference = {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ function addFeatures(
148148
if (meta.lifecycle.usesOnChanges) {
149149
features.push(o.importExpr(R3.NgOnChangesFeature));
150150
}
151-
// TODO: better way of differentiating component vs directive metadata.
152-
if (meta.hasOwnProperty('template') && meta.isStandalone) {
153-
features.push(o.importExpr(R3.StandaloneFeature));
154-
}
155151
if ('externalStyles' in meta && meta.externalStyles?.length) {
156152
const externalStyleNodes = meta.externalStyles.map((externalStyle) => o.literal(externalStyle));
157153
features.push(

packages/core/src/application/application_ref.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ import {PendingTasksInternal} from '../pending_tasks';
3333
import {RendererFactory2} from '../render/api';
3434
import {AfterRenderManager} from '../render3/after_render/manager';
3535
import {ComponentFactory as R3ComponentFactory} from '../render3/component_ref';
36-
import {isStandalone} from '../render3/definition';
36+
import {isStandalone} from '../render3/def_getters';
3737
import {ChangeDetectionMode, detectChangesInternal} from '../render3/instructions/change_detection';
38-
import {FLAGS, LView, LViewFlags} from '../render3/interfaces/view';
38+
import {LView} from '../render3/interfaces/view';
3939
import {publishDefaultGlobalUtils as _publishDefaultGlobalUtils} from '../render3/util/global_utils';
40-
import {removeLViewOnDestroy, requiresRefreshOrTraversal} from '../render3/util/view_utils';
40+
import {requiresRefreshOrTraversal} from '../render3/util/view_utils';
4141
import {ViewRef as InternalViewRef} from '../render3/view_ref';
4242
import {TESTABILITY} from '../testability/testability';
4343
import {isPromise} from '../util/lang';

packages/core/src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export {
103103
createEnvironmentInjector,
104104
} from './render3/ng_module_ref';
105105
export {createComponent, reflectComponentType, ComponentMirror} from './render3/component';
106-
export {isStandalone} from './render3/definition';
106+
export {isStandalone} from './render3/def_getters';
107107
export {AfterRenderPhase, AfterRenderRef} from './render3/after_render/api';
108108
export {publishExternalGlobalUtil as ɵpublishExternalGlobalUtil} from './render3/util/global_utils';
109109
export {

0 commit comments

Comments
 (0)