mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
d322052db3
`importProvidersFrom` provides a bridge from the world of NgModule-based DI configuration to the new, "standalone" world of direct providers and environment injectors. Early user feedback suggested some confusion around where this function was supposed to be used, particularly around importing NgModule-based providers into standalone component `providers` arrays, which is not the intended use. This confusion is exacerbated by the fact that due to the unified `Provider` type, this kind of misconfiguration was happily accepted by the type system. This commit changes the return type of `importProvidersFrom` to wrap the returned providers in an opaque type that prevents them from being used in component provider contexts. This, together with stronger documentation around the purpose and functionality of `importProvidersFrom`, should address some of the above confusion. PR Close #45838
3.0 KiB
3.0 KiB
API Report File for "@angular/platform-server"
Do not edit this file. It is a report generated by API Extractor.
import * as i0 from '@angular/core';
import * as i1 from '@angular/common/http';
import * as i2 from '@angular/platform-browser/animations';
import * as i3 from '@angular/platform-browser';
import { ImportedNgModuleProviders } from '@angular/core';
import { InjectionToken } from '@angular/core';
import { NgModuleFactory } from '@angular/core';
import { PlatformRef } from '@angular/core';
import { Provider } from '@angular/core';
import { StaticProvider } from '@angular/core';
import { Type } from '@angular/core';
import { Version } from '@angular/core';
// @public
export const BEFORE_APP_SERIALIZED: InjectionToken<(() => void | Promise<void>)[]>;
// @public
export const INITIAL_CONFIG: InjectionToken<PlatformConfig>;
// @public
export interface PlatformConfig {
baseUrl?: string;
document?: string;
url?: string;
useAbsoluteUrl?: boolean;
}
// @public
export const platformDynamicServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
// @public (undocumented)
export const platformServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
// @public
export class PlatformState {
constructor(_doc: any);
getDocument(): any;
renderToString(): string;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<PlatformState, never>;
// (undocumented)
static ɵprov: i0.ɵɵInjectableDeclaration<PlatformState>;
}
// @public
export function renderApplication<T>(rootComponent: Type<T>, options: {
appId: string;
document?: string;
url?: string;
providers?: Array<Provider | ImportedNgModuleProviders>;
platformProviders?: Provider[];
}): Promise<string>;
// @public
export function renderModule<T>(module: Type<T>, options: {
document?: string;
url?: string;
extraProviders?: StaticProvider[];
}): Promise<string>;
// @public @deprecated
export function renderModuleFactory<T>(moduleFactory: NgModuleFactory<T>, options: {
document?: string;
url?: string;
extraProviders?: StaticProvider[];
}): Promise<string>;
// @public
export class ServerModule {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<ServerModule, never>;
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<ServerModule>;
// (undocumented)
static ɵmod: i0.ɵɵNgModuleDeclaration<ServerModule, never, [typeof i1.HttpClientModule, typeof i2.NoopAnimationsModule], [typeof i3.BrowserModule]>;
}
// @public
export class ServerTransferStateModule {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<ServerTransferStateModule, never>;
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<ServerTransferStateModule>;
// (undocumented)
static ɵmod: i0.ɵɵNgModuleDeclaration<ServerTransferStateModule, never, never, never>;
}
// @public (undocumented)
export const VERSION: Version;
// (No @packageDocumentation comment for this package)