fix(ivy): correctly export all *Def symbols as private (#24862)

Previously, some of the *Def symbols were not exported or were exported
as public API. This commit ensures every definition type is in the
private export namespace.

PR Close #24862
This commit is contained in:
Alex Rickabaugh 2018-07-13 14:32:46 -07:00 committed by Victor Berchet
parent 9fd70c9715
commit d3594fc1c5
11 changed files with 14 additions and 21 deletions

View File

@ -43,7 +43,7 @@ const CORE_SUPPORTED_SYMBOLS = new Set<string>([
'defineInjector', 'defineInjector',
'ɵdefineNgModule', 'ɵdefineNgModule',
'inject', 'inject',
'InjectableDef', 'ɵInjectableDef',
'ɵInjectorDef', 'ɵInjectorDef',
'ɵNgModuleDef', 'ɵNgModuleDef',
]); ]);

View File

@ -119,8 +119,8 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toContain('Service.ngInjectableDef ='); expect(jsContents).toContain('Service.ngInjectableDef =');
expect(jsContents).not.toContain('__decorate'); expect(jsContents).not.toContain('__decorate');
const dtsContents = getContents('test.d.ts'); const dtsContents = getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.InjectableDef<Dep>;'); expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Dep>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.InjectableDef<Service>;'); expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Service>;');
}); });
it('should compile Components without errors', () => { it('should compile Components without errors', () => {

View File

@ -65,7 +65,7 @@ export class Identifiers {
static INJECTOR: o.ExternalReference = {name: 'INJECTOR', moduleName: CORE}; static INJECTOR: o.ExternalReference = {name: 'INJECTOR', moduleName: CORE};
static Injector: o.ExternalReference = {name: 'Injector', moduleName: CORE}; static Injector: o.ExternalReference = {name: 'Injector', moduleName: CORE};
static defineInjectable: o.ExternalReference = {name: 'defineInjectable', moduleName: CORE}; static defineInjectable: o.ExternalReference = {name: 'defineInjectable', moduleName: CORE};
static InjectableDef: o.ExternalReference = {name: 'InjectableDef', moduleName: CORE}; static InjectableDef: o.ExternalReference = {name: 'ɵInjectableDef', moduleName: CORE};
static ViewEncapsulation: o.ExternalReference = { static ViewEncapsulation: o.ExternalReference = {
name: 'ViewEncapsulation', name: 'ViewEncapsulation',
moduleName: CORE, moduleName: CORE,

View File

@ -13,6 +13,7 @@ export {devModeEqual as ɵdevModeEqual} from './change_detection/change_detectio
export {isListLikeIterable as ɵisListLikeIterable} from './change_detection/change_detection_util'; export {isListLikeIterable as ɵisListLikeIterable} from './change_detection/change_detection_util';
export {ChangeDetectorStatus as ɵChangeDetectorStatus, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy} from './change_detection/constants'; export {ChangeDetectorStatus as ɵChangeDetectorStatus, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy} from './change_detection/constants';
export {Console as ɵConsole} from './console'; export {Console as ɵConsole} from './console';
export {InjectableDef as ɵInjectableDef, InjectorDef as ɵInjectorDef} from './di/defs';
export {inject as ɵinject, setCurrentInjector as ɵsetCurrentInjector} from './di/injector'; export {inject as ɵinject, setCurrentInjector as ɵsetCurrentInjector} from './di/injector';
export {APP_ROOT as ɵAPP_ROOT} from './di/scope'; export {APP_ROOT as ɵAPP_ROOT} from './di/scope';
export {ivyEnabled as ɵivyEnabled} from './ivy_switch'; export {ivyEnabled as ɵivyEnabled} from './ivy_switch';

View File

@ -25,7 +25,6 @@ export {
PublicFeature as ɵPublicFeature, PublicFeature as ɵPublicFeature,
InheritDefinitionFeature as ɵInheritDefinitionFeature, InheritDefinitionFeature as ɵInheritDefinitionFeature,
NgOnChangesFeature as ɵNgOnChangesFeature, NgOnChangesFeature as ɵNgOnChangesFeature,
NgModuleDef as ɵNgModuleDef,
NgModuleType as ɵNgModuleType, NgModuleType as ɵNgModuleType,
CssSelectorList as ɵCssSelectorList, CssSelectorList as ɵCssSelectorList,
markDirty as ɵmarkDirty, markDirty as ɵmarkDirty,
@ -100,6 +99,7 @@ export {
I18nInstruction as ɵI18nInstruction, I18nInstruction as ɵI18nInstruction,
I18nExpInstruction as ɵI18nExpInstruction, I18nExpInstruction as ɵI18nExpInstruction,
} from './render3/index'; } from './render3/index';
export {NgModuleDef as ɵNgModuleDef} from './metadata/ng_module';
export { export {
bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml,
bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle,

View File

@ -13,7 +13,7 @@
*/ */
export * from './di/metadata'; export * from './di/metadata';
export {InjectableType, InjectorDef, InjectorType, defineInjectable, defineInjector} from './di/defs'; export {InjectableType, InjectorType, defineInjectable, defineInjector} from './di/defs';
export {forwardRef, resolveForwardRef, ForwardRefFn} from './di/forward_ref'; export {forwardRef, resolveForwardRef, ForwardRefFn} from './di/forward_ref';
export {Injectable, InjectableDecorator, InjectableProvider} from './di/injectable'; export {Injectable, InjectableDecorator, InjectableProvider} from './di/injectable';
export {inject, InjectFlags, INJECTOR, Injector} from './di/injector'; export {inject, InjectFlags, INJECTOR, Injector} from './di/injector';

View File

@ -19,7 +19,7 @@
* The below symbols are used for @Injectable and @NgModule compilation. * The below symbols are used for @Injectable and @NgModule compilation.
*/ */
export {InjectableDef, InjectorDef as ɵInjectorDef, defineInjectable, defineInjector} from './di/defs'; export {InjectableDef as ɵInjectableDef, InjectorDef as ɵInjectorDef, defineInjectable, defineInjector} from './di/defs';
export {inject} from './di/injector'; export {inject} from './di/injector';
export {NgModuleDef as ɵNgModuleDef} from './metadata/ng_module'; export {NgModuleDef as ɵNgModuleDef} from './metadata/ng_module';
export {defineNgModule as ɵdefineNgModule} from './render3/definition'; export {defineNgModule as ɵdefineNgModule} from './render3/definition';

View File

@ -95,7 +95,7 @@ export {
I18nExpInstruction I18nExpInstruction
} from './i18n'; } from './i18n';
export {NgModuleDef, NgModuleFactory, NgModuleRef, NgModuleType} from './ng_module_ref'; export {NgModuleFactory, NgModuleRef, NgModuleType} from './ng_module_ref';
export { export {
AttributeMarker AttributeMarker

View File

@ -11,14 +11,13 @@ import {StaticProvider} from '../di/provider';
import {createInjector} from '../di/r3_injector'; import {createInjector} from '../di/r3_injector';
import {ComponentFactoryResolver as viewEngine_ComponentFactoryResolver} from '../linker/component_factory_resolver'; import {ComponentFactoryResolver as viewEngine_ComponentFactoryResolver} from '../linker/component_factory_resolver';
import {InternalNgModuleRef, NgModuleFactory as viewEngine_NgModuleFactory, NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory'; import {InternalNgModuleRef, NgModuleFactory as viewEngine_NgModuleFactory, NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory';
import {NgModuleDefInternal} from '../metadata/ng_module';
import {Type} from '../type'; import {Type} from '../type';
import {stringify} from '../util'; import {stringify} from '../util';
import {assertDefined} from './assert'; import {assertDefined} from './assert';
import {ComponentFactoryResolver} from './component_ref'; import {ComponentFactoryResolver} from './component_ref';
export interface NgModuleType { ngModuleDef: NgModuleDef; } export interface NgModuleType { ngModuleDef: NgModuleDefInternal<any>; }
export interface NgModuleDef { bootstrap: Type<any>[]; }
export const COMPONENT_FACTORY_RESOLVER: StaticProvider = { export const COMPONENT_FACTORY_RESOLVER: StaticProvider = {
provide: viewEngine_ComponentFactoryResolver, provide: viewEngine_ComponentFactoryResolver,

View File

@ -86,10 +86,9 @@ describe('ApplicationRef bootstrap', () => {
providers: APPLICATION_MODULE_PROVIDERS providers: APPLICATION_MODULE_PROVIDERS
}); });
export function defineNgModule({bootstrap}: {bootstrap?: Type<any>[]}): NgModuleDef { export function defineNgModule({bootstrap}: {bootstrap?: Type<any>[]}):
return { NgModuleDef<any, any, any, any> {
bootstrap: bootstrap || [], return ({ bootstrap: bootstrap || [], } as any);
};
} }
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////

View File

@ -408,12 +408,6 @@ export declare abstract class Injector {
/** @experimental */ /** @experimental */
export declare const INJECTOR: InjectionToken<Injector>; export declare const INJECTOR: InjectionToken<Injector>;
export interface InjectorDef<T> {
factory: () => T;
imports: (InjectorType<any> | InjectorTypeWithProviders<any>)[];
providers: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | any[])[];
}
/** @experimental */ /** @experimental */
export interface InjectorType<T> extends Type<T> { export interface InjectorType<T> extends Type<T> {
ngInjectorDef: never; ngInjectorDef: never;