Skip to content

Commit

Permalink
refactor(compiler-cli): propagate standalone flag in .d.ts metadata (#…
Browse files Browse the repository at this point in the history
…45672)

This commit adds a type field to .d.ts metadata for directives, components,
and pipes which carries a boolean literal indicating whether the given type
is standalone or not. For backwards compatibility, this flag defaults to
`false`.

Tests are added to validate that standalone types coming from .d.ts files
can be correctly imported into new standalone components.

PR Close #45672
  • Loading branch information
alxhub committed Apr 20, 2022
1 parent 80d2cda commit d3c0fa3
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 81 deletions.
48 changes: 24 additions & 24 deletions goldens/public-api/common/index.md
Expand Up @@ -45,7 +45,7 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<AsyncPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async">;
static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async", false>;
}

// @public
Expand All @@ -70,7 +70,7 @@ export class CurrencyPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency">;
static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", false>;
}

// @public
Expand All @@ -88,7 +88,7 @@ export class DatePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }]>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date">;
static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date", false>;
}

// @public
Expand All @@ -103,7 +103,7 @@ export class DecimalPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<DecimalPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number">;
static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number", false>;
}

// @public
Expand Down Expand Up @@ -239,7 +239,7 @@ export class I18nPluralPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<I18nPluralPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural">;
static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural", false>;
}

// @public
Expand All @@ -251,7 +251,7 @@ export class I18nSelectPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<I18nSelectPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect">;
static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect", false>;
}

// @public
Expand All @@ -273,7 +273,7 @@ export class JsonPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<JsonPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json">;
static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json", false>;
}

// @public
Expand Down Expand Up @@ -304,7 +304,7 @@ export class KeyValuePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue">;
static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue", false>;
}

// @public
Expand Down Expand Up @@ -388,7 +388,7 @@ export class LowerCasePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<LowerCasePipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase">;
static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase", false>;
}

// @public
Expand All @@ -403,7 +403,7 @@ export class NgClass implements DoCheck {
// (undocumented)
ngDoCheck(): void;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": "class"; "ngClass": "ngClass"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": "class"; "ngClass": "ngClass"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgClass, never>;
}
Expand All @@ -426,7 +426,7 @@ export class NgComponentOutlet implements OnChanges, OnDestroy {
// (undocumented)
ngOnDestroy(): void;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet, "[ngComponentOutlet]", never, { "ngComponentOutlet": "ngComponentOutlet"; "ngComponentOutletInjector": "ngComponentOutletInjector"; "ngComponentOutletContent": "ngComponentOutletContent"; "ngComponentOutletNgModule": "ngComponentOutletNgModule"; "ngComponentOutletNgModuleFactory": "ngComponentOutletNgModuleFactory"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet, "[ngComponentOutlet]", never, { "ngComponentOutlet": "ngComponentOutlet"; "ngComponentOutletInjector": "ngComponentOutletInjector"; "ngComponentOutletContent": "ngComponentOutletContent"; "ngComponentOutletNgModule": "ngComponentOutletNgModule"; "ngComponentOutletNgModuleFactory": "ngComponentOutletNgModuleFactory"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgComponentOutlet, never>;
}
Expand All @@ -442,7 +442,7 @@ export class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCh
get ngForTrackBy(): TrackByFunction<T>;
static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": "ngForOf"; "ngForTrackBy": "ngForTrackBy"; "ngForTemplate": "ngForTemplate"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": "ngForOf"; "ngForTrackBy": "ngForTrackBy"; "ngForTemplate": "ngForTemplate"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgForOf<any, any>, never>;
}
Expand Down Expand Up @@ -477,7 +477,7 @@ export class NgIf<T = unknown> {
static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
static ngTemplateGuard_ngIf: 'binding';
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": "ngIf"; "ngIfThen": "ngIfThen"; "ngIfElse": "ngIfElse"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": "ngIf"; "ngIfThen": "ngIfThen"; "ngIfElse": "ngIfElse"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgIf<any>, never>;
}
Expand Down Expand Up @@ -521,7 +521,7 @@ export class NgPlural {
// (undocumented)
set ngPlural(value: number);
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": "ngPlural"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": "ngPlural"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgPlural, never>;
}
Expand All @@ -532,7 +532,7 @@ export class NgPluralCase {
// (undocumented)
value: string;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgPluralCase, [{ attribute: "ngPluralCase"; }, null, null, { host: true; }]>;
}
Expand All @@ -547,7 +547,7 @@ export class NgStyle implements DoCheck {
[klass: string]: any;
} | null);
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": "ngStyle"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": "ngStyle"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgStyle, never>;
}
Expand All @@ -557,7 +557,7 @@ export class NgSwitch {
// (undocumented)
set ngSwitch(newValue: any);
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": "ngSwitch"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": "ngSwitch"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitch, never>;
}
Expand All @@ -568,7 +568,7 @@ export class NgSwitchCase implements DoCheck {
ngDoCheck(): void;
ngSwitchCase: any;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": "ngSwitchCase"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": "ngSwitchCase"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchCase, [null, null, { optional: true; host: true; }]>;
}
Expand All @@ -577,7 +577,7 @@ export class NgSwitchCase implements DoCheck {
export class NgSwitchDefault {
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchDefault, [null, null, { optional: true; host: true; }]>;
}
Expand All @@ -591,7 +591,7 @@ export class NgTemplateOutlet implements OnChanges {
ngTemplateOutletContext: Object | null;
ngTemplateOutletInjector: Injector | null;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": "ngTemplateOutletContext"; "ngTemplateOutlet": "ngTemplateOutlet"; "ngTemplateOutletInjector": "ngTemplateOutletInjector"; }, {}, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": "ngTemplateOutletContext"; "ngTemplateOutlet": "ngTemplateOutlet"; "ngTemplateOutletInjector": "ngTemplateOutletInjector"; }, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<NgTemplateOutlet, never>;
}
Expand Down Expand Up @@ -667,7 +667,7 @@ export class PercentPipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<PercentPipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent">;
static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent", false>;
}

// @public
Expand Down Expand Up @@ -755,7 +755,7 @@ export class SlicePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice">;
static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice", false>;
}

// @public
Expand All @@ -775,7 +775,7 @@ export class TitleCasePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<TitleCasePipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase">;
static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase", false>;
}

// @public
Expand All @@ -797,7 +797,7 @@ export class UpperCasePipe implements PipeTransform {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<UpperCasePipe, never>;
// (undocumented)
static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase">;
static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase", false>;
}

// @public (undocumented)
Expand Down

0 comments on commit d3c0fa3

Please sign in to comment.