2026-10-07 21:37:37 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2026-10-09 15:56:10 +00:00
|
|
|
* Public programmatic API of `@angular/compiler-cli/preprocessor`.
|
2026-10-07 21:37:37 +00:00
|
|
|
*
|
|
|
|
|
* This module is deliberately **free of static edges to the analysis-engine loader**.
|
|
|
|
|
* The compiler also runs where N-API is unavailable, driven by an out-of-process
|
|
|
|
|
* sidecar binary; a static `import` of `./src/analyzer_loader.js` here would pull
|
|
|
|
|
* engine resolution into module evaluation and break those deployments. The engine is
|
|
|
|
|
* reached only through {@link createAnalyzer}, which loads the resolver lazily.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type {AnalyzerBackend, LoadAnalyzerOptions, LoadedAnalyzer} from './src/analyzer_loader.js';
|
2026-10-23 05:33:41 +00:00
|
|
|
import type {IAnalyzer} from './src/hybrid_compiler.js';
|
2026-10-07 21:37:37 +00:00
|
|
|
|
2026-11-11 09:47:55 +01:00
|
|
|
export {ErrorCode} from './src/error_code.js';
|
2026-11-04 19:55:14 +00:00
|
|
|
export {createHybridCompiler, HybridCompiler} from './src/hybrid_compiler.js';
|
|
|
|
|
export type {
|
|
|
|
|
CreateHybridCompilerOptions,
|
|
|
|
|
HybridCompilerOptions,
|
|
|
|
|
IAnalyzer,
|
|
|
|
|
} from './src/hybrid_compiler.js';
|
2026-10-07 21:37:37 +00:00
|
|
|
|
|
|
|
|
// The sidecar transport: usable with no N-API addon and no wasm engine present.
|
|
|
|
|
export {SidecarAnalyzer} from './src/analyzer_sidecar.js';
|
|
|
|
|
|
|
|
|
|
export {run} from './ngp.js';
|
|
|
|
|
export type {RunOptions} from './ngp.js';
|
|
|
|
|
|
2026-10-23 05:33:41 +00:00
|
|
|
export {WasmAnalyzer, type WasmInner} from './src/analyzer_wasm.js';
|
|
|
|
|
export type {ClassEntity} from './src/indexer_api.js';
|
|
|
|
|
export {IndexerBoundTemplate} from './src/indexing/indexer.js';
|
2026-10-09 16:44:20 +00:00
|
|
|
export {buildTypeCheckingConfig, type NgpTypeCheckingConfig} from './src/tcb.js';
|
2026-10-22 11:33:28 +02:00
|
|
|
export {verifyCompilerOptions, type NgpCompilerOptions} from './src/compiler_options.js';
|
2026-10-29 08:59:19 +01:00
|
|
|
export {IncrementalEmitTracker} from './src/incremental.js';
|
|
|
|
|
export {FileUpdateType} from './src/types.js';
|
2026-10-22 16:44:19 -04:00
|
|
|
export type {
|
|
|
|
|
AnalyzerOptions,
|
|
|
|
|
DefaultHostConfig,
|
|
|
|
|
NgDiagnostic,
|
|
|
|
|
NgRelatedInformation,
|
|
|
|
|
} from './src/types.js';
|
2026-10-23 05:33:41 +00:00
|
|
|
export type {HostDirEntry, HostFileStat, WasmHostFs} from './src/wasm_host_fs.js';
|
2026-10-07 21:37:37 +00:00
|
|
|
export {resolveWorkspaceConfig} from './src/workspace.js';
|
|
|
|
|
export type {WorkspaceConfig} from './src/workspace.js';
|
|
|
|
|
|
|
|
|
|
export type {AnalyzerBackend, LoadAnalyzerOptions, LoadedAnalyzer};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resolves and constructs the analysis engine (native N-API, falling back to wasm).
|
|
|
|
|
*
|
2026-10-23 11:49:10 -04:00
|
|
|
* Accepts either a tsconfig path plus options, or options alone. In the options form
|
|
|
|
|
* `tsconfigPath` is optional; without it, the analyzer is configured from the options only
|
|
|
|
|
* (see {@link AnalyzerOptions}).
|
|
|
|
|
*
|
2026-10-07 21:37:37 +00:00
|
|
|
* Lazy by construction — see the module comment. Callers that only use
|
|
|
|
|
* {@link SidecarAnalyzer} never invoke this and so never load engine-resolution code.
|
|
|
|
|
*/
|
2026-10-23 11:49:10 -04:00
|
|
|
export function createAnalyzer(options: LoadAnalyzerOptions): Promise<IAnalyzer>;
|
|
|
|
|
export function createAnalyzer(
|
2026-10-07 21:37:37 +00:00
|
|
|
tsconfigPath: string,
|
2026-10-23 11:49:10 -04:00
|
|
|
options?: LoadAnalyzerOptions,
|
|
|
|
|
): Promise<IAnalyzer>;
|
|
|
|
|
export async function createAnalyzer(
|
|
|
|
|
tsconfigPathOrOptions: string | LoadAnalyzerOptions,
|
|
|
|
|
options?: LoadAnalyzerOptions,
|
2026-10-07 21:37:37 +00:00
|
|
|
): Promise<IAnalyzer> {
|
2026-10-23 11:49:10 -04:00
|
|
|
const {loadAnalyzer, toLoadAnalyzerOptions} = await import('./src/analyzer_loader.js');
|
|
|
|
|
return loadAnalyzer(toLoadAnalyzerOptions(tsconfigPathOrOptions, options));
|
2026-10-07 21:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** As {@link createAnalyzer}, but also reports which engine actually loaded. */
|
2026-10-23 11:49:10 -04:00
|
|
|
export function createAnalyzerWithInfo(options: LoadAnalyzerOptions): Promise<LoadedAnalyzer>;
|
|
|
|
|
export function createAnalyzerWithInfo(
|
2026-10-07 21:37:37 +00:00
|
|
|
tsconfigPath: string,
|
2026-10-23 11:49:10 -04:00
|
|
|
options?: LoadAnalyzerOptions,
|
|
|
|
|
): Promise<LoadedAnalyzer>;
|
|
|
|
|
export async function createAnalyzerWithInfo(
|
|
|
|
|
tsconfigPathOrOptions: string | LoadAnalyzerOptions,
|
|
|
|
|
options?: LoadAnalyzerOptions,
|
2026-10-07 21:37:37 +00:00
|
|
|
): Promise<LoadedAnalyzer> {
|
2026-10-23 11:49:10 -04:00
|
|
|
const {loadAnalyzerWithInfo, toLoadAnalyzerOptions} = await import('./src/analyzer_loader.js');
|
|
|
|
|
return loadAnalyzerWithInfo(toLoadAnalyzerOptions(tsconfigPathOrOptions, options));
|
2026-10-07 21:37:37 +00:00
|
|
|
}
|