Skip to content

Commit d3c0fa3

Browse files
committed
refactor(compiler-cli): propagate standalone flag in .d.ts metadata (#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
1 parent 80d2cda commit d3c0fa3

File tree

11 files changed

+240
-81
lines changed

11 files changed

+240
-81
lines changed

goldens/public-api/common/index.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
4545
// (undocumented)
4646
static ɵfac: i0.ɵɵFactoryDeclaration<AsyncPipe, never>;
4747
// (undocumented)
48-
static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async">;
48+
static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async", false>;
4949
}
5050

5151
// @public
@@ -70,7 +70,7 @@ export class CurrencyPipe implements PipeTransform {
7070
// (undocumented)
7171
static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipe, never>;
7272
// (undocumented)
73-
static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency">;
73+
static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", false>;
7474
}
7575

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

9494
// @public
@@ -103,7 +103,7 @@ export class DecimalPipe implements PipeTransform {
103103
// (undocumented)
104104
static ɵfac: i0.ɵɵFactoryDeclaration<DecimalPipe, never>;
105105
// (undocumented)
106-
static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number">;
106+
static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number", false>;
107107
}
108108

109109
// @public
@@ -239,7 +239,7 @@ export class I18nPluralPipe implements PipeTransform {
239239
// (undocumented)
240240
static ɵfac: i0.ɵɵFactoryDeclaration<I18nPluralPipe, never>;
241241
// (undocumented)
242-
static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural">;
242+
static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural", false>;
243243
}
244244

245245
// @public
@@ -251,7 +251,7 @@ export class I18nSelectPipe implements PipeTransform {
251251
// (undocumented)
252252
static ɵfac: i0.ɵɵFactoryDeclaration<I18nSelectPipe, never>;
253253
// (undocumented)
254-
static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect">;
254+
static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect", false>;
255255
}
256256

257257
// @public
@@ -273,7 +273,7 @@ export class JsonPipe implements PipeTransform {
273273
// (undocumented)
274274
static ɵfac: i0.ɵɵFactoryDeclaration<JsonPipe, never>;
275275
// (undocumented)
276-
static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json">;
276+
static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json", false>;
277277
}
278278

279279
// @public
@@ -304,7 +304,7 @@ export class KeyValuePipe implements PipeTransform {
304304
// (undocumented)
305305
static ɵfac: i0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
306306
// (undocumented)
307-
static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue">;
307+
static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue", false>;
308308
}
309309

310310
// @public
@@ -388,7 +388,7 @@ export class LowerCasePipe implements PipeTransform {
388388
// (undocumented)
389389
static ɵfac: i0.ɵɵFactoryDeclaration<LowerCasePipe, never>;
390390
// (undocumented)
391-
static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase">;
391+
static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase", false>;
392392
}
393393

394394
// @public
@@ -403,7 +403,7 @@ export class NgClass implements DoCheck {
403403
// (undocumented)
404404
ngDoCheck(): void;
405405
// (undocumented)
406-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": "class"; "ngClass": "ngClass"; }, {}, never>;
406+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": "class"; "ngClass": "ngClass"; }, {}, never, never, false>;
407407
// (undocumented)
408408
static ɵfac: i0.ɵɵFactoryDeclaration<NgClass, never>;
409409
}
@@ -426,7 +426,7 @@ export class NgComponentOutlet implements OnChanges, OnDestroy {
426426
// (undocumented)
427427
ngOnDestroy(): void;
428428
// (undocumented)
429-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet, "[ngComponentOutlet]", never, { "ngComponentOutlet": "ngComponentOutlet"; "ngComponentOutletInjector": "ngComponentOutletInjector"; "ngComponentOutletContent": "ngComponentOutletContent"; "ngComponentOutletNgModule": "ngComponentOutletNgModule"; "ngComponentOutletNgModuleFactory": "ngComponentOutletNgModuleFactory"; }, {}, never>;
429+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet, "[ngComponentOutlet]", never, { "ngComponentOutlet": "ngComponentOutlet"; "ngComponentOutletInjector": "ngComponentOutletInjector"; "ngComponentOutletContent": "ngComponentOutletContent"; "ngComponentOutletNgModule": "ngComponentOutletNgModule"; "ngComponentOutletNgModuleFactory": "ngComponentOutletNgModuleFactory"; }, {}, never, never, false>;
430430
// (undocumented)
431431
static ɵfac: i0.ɵɵFactoryDeclaration<NgComponentOutlet, never>;
432432
}
@@ -442,7 +442,7 @@ export class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCh
442442
get ngForTrackBy(): TrackByFunction<T>;
443443
static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
444444
// (undocumented)
445-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": "ngForOf"; "ngForTrackBy": "ngForTrackBy"; "ngForTemplate": "ngForTemplate"; }, {}, never>;
445+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": "ngForOf"; "ngForTrackBy": "ngForTrackBy"; "ngForTemplate": "ngForTemplate"; }, {}, never, never, false>;
446446
// (undocumented)
447447
static ɵfac: i0.ɵɵFactoryDeclaration<NgForOf<any, any>, never>;
448448
}
@@ -477,7 +477,7 @@ export class NgIf<T = unknown> {
477477
static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
478478
static ngTemplateGuard_ngIf: 'binding';
479479
// (undocumented)
480-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": "ngIf"; "ngIfThen": "ngIfThen"; "ngIfElse": "ngIfElse"; }, {}, never>;
480+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": "ngIf"; "ngIfThen": "ngIfThen"; "ngIfElse": "ngIfElse"; }, {}, never, never, false>;
481481
// (undocumented)
482482
static ɵfac: i0.ɵɵFactoryDeclaration<NgIf<any>, never>;
483483
}
@@ -521,7 +521,7 @@ export class NgPlural {
521521
// (undocumented)
522522
set ngPlural(value: number);
523523
// (undocumented)
524-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": "ngPlural"; }, {}, never>;
524+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": "ngPlural"; }, {}, never, never, false>;
525525
// (undocumented)
526526
static ɵfac: i0.ɵɵFactoryDeclaration<NgPlural, never>;
527527
}
@@ -532,7 +532,7 @@ export class NgPluralCase {
532532
// (undocumented)
533533
value: string;
534534
// (undocumented)
535-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never>;
535+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never, never, false>;
536536
// (undocumented)
537537
static ɵfac: i0.ɵɵFactoryDeclaration<NgPluralCase, [{ attribute: "ngPluralCase"; }, null, null, { host: true; }]>;
538538
}
@@ -547,7 +547,7 @@ export class NgStyle implements DoCheck {
547547
[klass: string]: any;
548548
} | null);
549549
// (undocumented)
550-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": "ngStyle"; }, {}, never>;
550+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": "ngStyle"; }, {}, never, never, false>;
551551
// (undocumented)
552552
static ɵfac: i0.ɵɵFactoryDeclaration<NgStyle, never>;
553553
}
@@ -557,7 +557,7 @@ export class NgSwitch {
557557
// (undocumented)
558558
set ngSwitch(newValue: any);
559559
// (undocumented)
560-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": "ngSwitch"; }, {}, never>;
560+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": "ngSwitch"; }, {}, never, never, false>;
561561
// (undocumented)
562562
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitch, never>;
563563
}
@@ -568,7 +568,7 @@ export class NgSwitchCase implements DoCheck {
568568
ngDoCheck(): void;
569569
ngSwitchCase: any;
570570
// (undocumented)
571-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": "ngSwitchCase"; }, {}, never>;
571+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": "ngSwitchCase"; }, {}, never, never, false>;
572572
// (undocumented)
573573
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchCase, [null, null, { optional: true; host: true; }]>;
574574
}
@@ -577,7 +577,7 @@ export class NgSwitchCase implements DoCheck {
577577
export class NgSwitchDefault {
578578
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
579579
// (undocumented)
580-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never>;
580+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never, never, false>;
581581
// (undocumented)
582582
static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchDefault, [null, null, { optional: true; host: true; }]>;
583583
}
@@ -591,7 +591,7 @@ export class NgTemplateOutlet implements OnChanges {
591591
ngTemplateOutletContext: Object | null;
592592
ngTemplateOutletInjector: Injector | null;
593593
// (undocumented)
594-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": "ngTemplateOutletContext"; "ngTemplateOutlet": "ngTemplateOutlet"; "ngTemplateOutletInjector": "ngTemplateOutletInjector"; }, {}, never>;
594+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": "ngTemplateOutletContext"; "ngTemplateOutlet": "ngTemplateOutlet"; "ngTemplateOutletInjector": "ngTemplateOutletInjector"; }, {}, never, never, false>;
595595
// (undocumented)
596596
static ɵfac: i0.ɵɵFactoryDeclaration<NgTemplateOutlet, never>;
597597
}
@@ -667,7 +667,7 @@ export class PercentPipe implements PipeTransform {
667667
// (undocumented)
668668
static ɵfac: i0.ɵɵFactoryDeclaration<PercentPipe, never>;
669669
// (undocumented)
670-
static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent">;
670+
static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent", false>;
671671
}
672672

673673
// @public
@@ -755,7 +755,7 @@ export class SlicePipe implements PipeTransform {
755755
// (undocumented)
756756
static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
757757
// (undocumented)
758-
static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice">;
758+
static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice", false>;
759759
}
760760

761761
// @public
@@ -775,7 +775,7 @@ export class TitleCasePipe implements PipeTransform {
775775
// (undocumented)
776776
static ɵfac: i0.ɵɵFactoryDeclaration<TitleCasePipe, never>;
777777
// (undocumented)
778-
static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase">;
778+
static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase", false>;
779779
}
780780

781781
// @public
@@ -797,7 +797,7 @@ export class UpperCasePipe implements PipeTransform {
797797
// (undocumented)
798798
static ɵfac: i0.ɵɵFactoryDeclaration<UpperCasePipe, never>;
799799
// (undocumented)
800-
static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase">;
800+
static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase", false>;
801801
}
802802

803803
// @public (undocumented)

0 commit comments

Comments
 (0)