Skip to content

Commit b35ecee

Browse files
crisbetopkozlowski-opensource
authored andcommitted
refactor(core): clean up standalone flag (angular#58478)
The `NG_STANDALONE_DEFAULT_VALUE` is no longer being patched internally and can be removed. PR Close angular#58478
1 parent 940be19 commit b35ecee

File tree

7 files changed

+5
-27
lines changed

7 files changed

+5
-27
lines changed

packages/core/src/core_render3_private_export.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,3 @@ export {
309309
} from './render3/deps_tracker/deps_tracker';
310310
export {generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError} from './render3/jit/module';
311311
export {getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn} from './render3/metadata';
312-
export {NG_STANDALONE_DEFAULT_VALUE as ɵNG_STANDALONE_DEFAULT_VALUE} from './render3/standalone-default-value';

packages/core/src/render3/definition.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {InputFlags} from './interfaces/input_flags';
3939
import type {TAttributes, TConstantsOrFactory} from './interfaces/node';
4040
import {CssSelectorList} from './interfaces/projection';
4141
import {stringifyCSSSelectorList} from './node_selector_matcher';
42-
import {NG_STANDALONE_DEFAULT_VALUE} from './standalone-default-value';
4342
import {StandaloneService} from './standalone_service';
4443

4544
/**
@@ -615,7 +614,7 @@ export function ɵɵdefinePipe<T>(pipeDef: {
615614
name: pipeDef.name,
616615
factory: null,
617616
pure: pipeDef.pure !== false,
618-
standalone: pipeDef.standalone ?? NG_STANDALONE_DEFAULT_VALUE,
617+
standalone: pipeDef.standalone ?? true,
619618
onDestroy: pipeDef.type.prototype.ngOnDestroy || null,
620619
};
621620
}
@@ -635,7 +634,7 @@ function getNgDirectiveDef<T>(directiveDefinition: DirectiveDefinition<T>): Dire
635634
inputTransforms: null,
636635
inputConfig: directiveDefinition.inputs || EMPTY_OBJ,
637636
exportAs: directiveDefinition.exportAs || null,
638-
standalone: directiveDefinition.standalone ?? NG_STANDALONE_DEFAULT_VALUE,
637+
standalone: directiveDefinition.standalone ?? true,
639638
signals: directiveDefinition.signals === true,
640639
selectors: directiveDefinition.selectors || EMPTY_ARRAY,
641640
viewQuery: directiveDefinition.viewQuery || null,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {
4141
patchComponentDefWithScope,
4242
transitiveScopesFor,
4343
} from './module';
44-
import {NG_STANDALONE_DEFAULT_VALUE} from '../standalone-default-value';
4544
import {isComponent, verifyStandaloneImport} from './util';
4645

4746
/**
@@ -453,8 +452,7 @@ export function directiveMetadata(type: Type<any>, metadata: Directive): R3Direc
453452
exportAs: extractExportAs(metadata.exportAs),
454453
providers: metadata.providers || null,
455454
viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
456-
isStandalone:
457-
metadata.standalone === undefined ? NG_STANDALONE_DEFAULT_VALUE : !!metadata.standalone,
455+
isStandalone: metadata.standalone === undefined ? true : !!metadata.standalone,
458456
isSignal: !!metadata.signals,
459457
hostDirectives:
460458
metadata.hostDirectives?.map((directive) =>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {Pipe} from '../../metadata/directives';
1717
import {NG_FACTORY_DEF, NG_PIPE_DEF} from '../fields';
1818

1919
import {angularCoreEnv} from './environment';
20-
import {NG_STANDALONE_DEFAULT_VALUE} from '../standalone-default-value';
2120

2221
export function compilePipe(type: Type<any>, meta: Pipe): void {
2322
let ngPipeDef: any = null;
@@ -74,6 +73,6 @@ function getPipeMetadata(type: Type<any>, meta: Pipe): R3PipeMetadataFacade {
7473
name: type.name,
7574
pipeName: meta.name,
7675
pure: meta.pure !== undefined ? meta.pure : true,
77-
isStandalone: meta.standalone === undefined ? NG_STANDALONE_DEFAULT_VALUE : !!meta.standalone,
76+
isStandalone: meta.standalone === undefined ? true : !!meta.standalone,
7877
};
7978
}

packages/core/src/render3/standalone-default-value.ts

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

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,9 +2033,6 @@
20332033
{
20342034
"name": "init_skip_hydration"
20352035
},
2036-
{
2037-
"name": "init_standalone_default_value"
2038-
},
20392036
{
20402037
"name": "init_standalone_service"
20412038
},

packages/core/testing/src/test_bed_compiler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ import {
6565
ɵɵInjectableDeclaration as InjectableDeclaration,
6666
NgZone,
6767
ErrorHandler,
68-
ɵNG_STANDALONE_DEFAULT_VALUE as NG_STANDALONE_DEFAULT_VALUE,
6968
} from '@angular/core';
7069

7170
import {ComponentDef, ComponentType} from '../../src/render3';
@@ -103,7 +102,7 @@ function assertNoStandaloneComponents(
103102
types.forEach((type) => {
104103
if (!getAsyncClassMetadataFn(type)) {
105104
const component = resolver.resolve(type);
106-
if (component && (component.standalone ?? NG_STANDALONE_DEFAULT_VALUE)) {
105+
if (component && (component.standalone == null || component.standalone)) {
107106
throw new Error(ɵgenerateStandaloneInDeclarationsError(type, location));
108107
}
109108
}

0 commit comments

Comments
 (0)