UNPKG

1.39 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { CompilerOptions } from 'typescript';
9import type { Resolver } from 'webpack';
10export interface TypeScriptPathsPluginOptions extends Pick<CompilerOptions, 'paths' | 'baseUrl'> {
11}
12type ResolverRequest = NonNullable<Parameters<Parameters<Resolver['resolve']>[4]>[2]>;
13interface PathPluginResolverRequest extends ResolverRequest {
14 context?: {
15 issuer?: string;
16 };
17 typescriptPathMapped?: boolean;
18}
19export declare class TypeScriptPathsPlugin {
20 private baseUrl?;
21 private patterns?;
22 constructor(options?: TypeScriptPathsPluginOptions);
23 /**
24 * Update the plugin with new path mapping option values.
25 * The options will also be preprocessed to reduce the overhead of individual resolve actions
26 * during a build.
27 *
28 * @param options The `paths` and `baseUrl` options from TypeScript's `CompilerOptions`.
29 */
30 update(options: TypeScriptPathsPluginOptions): void;
31 apply(resolver: Resolver): void;
32 findReplacements(originalRequest: string): IterableIterator<string>;
33 createReplacementRequests(request: PathPluginResolverRequest, originalRequest: string): IterableIterator<PathPluginResolverRequest>;
34}
35export {};