angular/goldens/public-api/compiler-cli/compiler_options.md
Payam Valadkhan e8201a5962 refactor(compiler-cli): add a compiler option to enable checking for orphan component (#52061)
Orphan component is an anti-pattern in Angular where a component is rendered while the NgModule declaring it is not installed. It is not easy to capture this scenario, specially in compile time. But it is possible to capture a special case in runtime where the component is being rendered without its NgModule even loaded into the browser. This change adds a flag in cli compiler option to enable such checking, and throwing a runtime exception if it happens. Note that such check is only done in dev mode.

Currently the check requires some generated code that is behind ngJitMode flag (i.e., call to ɵɵsetNgModuleScope), and the new flag can be set only if JIT mode is enabled (i.e., supportJitMode=true) otherwise an error will be thrown.

The orphan component is a main blocker for rolling out local compilation in g3. This option is needed for identifying and isolating such cases.

PR Close #52061
2023-10-10 15:30:26 -07:00

2 KiB

API Report File for "angular-srcs"

Do not edit this file. It is a report generated by API Extractor.


// @public
export interface BazelAndG3Options {
    annotateForClosureCompiler?: boolean;
    generateDeepReexports?: boolean;
    onlyPublishPublicTypingsForNgModules?: boolean;
}

// @public
export enum DiagnosticCategoryLabel {
    Error = "error",
    Suppress = "suppress",
    Warning = "warning"
}

// @public
export interface DiagnosticOptions {
    extendedDiagnostics?: {
        defaultCategory?: DiagnosticCategoryLabel;
        checks?: {
            [Name in ExtendedTemplateDiagnosticName]?: DiagnosticCategoryLabel;
        };
    };
}

// @public
export interface I18nOptions {
    enableI18nLegacyMessageIdFormat?: boolean;
    i18nInLocale?: string;
    i18nNormalizeLineEndingsInICUs?: boolean;
    i18nOutFile?: string;
    i18nOutFormat?: string;
    i18nOutLocale?: string;
    i18nUseExternalIds?: boolean;
}

// @public
export interface LegacyNgcOptions {
    // @deprecated
    allowEmptyCodegenFiles?: boolean;
    flatModuleId?: string;
    flatModuleOutFile?: string;
    // @deprecated
    fullTemplateTypeCheck?: boolean;
    preserveWhitespaces?: boolean;
    strictInjectionParameters?: boolean;
}

// @public
export interface MiscOptions {
    compileNonExportedClasses?: boolean;
    disableTypeScriptVersionCheck?: boolean;
    forbidOrphanComponents?: boolean;
}

// @public
export interface StrictTemplateOptions {
    strictAttributeTypes?: boolean;
    strictContextGenerics?: boolean;
    strictDomEventTypes?: boolean;
    strictDomLocalRefTypes?: boolean;
    strictInputAccessModifiers?: boolean;
    strictInputTypes?: boolean;
    strictLiteralTypes?: boolean;
    strictNullInputTypes?: boolean;
    strictOutputEventTypes?: boolean;
    strictSafeNavigationTypes?: boolean;
    strictTemplates?: boolean;
}

// @public
export interface TargetOptions {
    compilationMode?: 'full' | 'partial' | 'experimental-local';
}

// (No @packageDocumentation comment for this package)