1 |
|
2 | import * as TsconfigPaths from "tsconfig-paths";
|
3 | import * as Options from "./options";
|
4 | import * as Logger from "./logger";
|
5 | import * as fs from "fs";
|
6 | import { ResolvePluginInstance, Resolver } from "webpack";
|
7 | import { AsyncSeriesBailHook } from "tapable";
|
8 | import { ResolveContext, ResolveRequest } from "enhanced-resolve";
|
9 | export interface LegacyResolverPlugin {
|
10 | readonly apply: (resolver: LegacyResolver) => void;
|
11 | }
|
12 | export interface LegacyResolver {
|
13 | readonly apply: (plugin: LegacyResolverPlugin) => void;
|
14 | readonly plugin: (source: string, cb: ResolverCallbackLegacy) => void;
|
15 | readonly doResolve: doResolveLegacy | doResolve;
|
16 | readonly join: (relativePath: string, innerRequest: Request) => Request;
|
17 | readonly fileSystem: LegacyResolverFileSystem;
|
18 | readonly getHook: (hook: string) => AsyncSeriesBailHook<[
|
19 | ResolveRequest,
|
20 | ResolveContext
|
21 | ], null | ResolveRequest>;
|
22 | }
|
23 | export type doResolveLegacy = (target: string, req: Request, desc: string, callback: Callback) => void;
|
24 | export type doResolve = (hook: AsyncSeriesBailHook<[
|
25 | ResolveRequest,
|
26 | ResolveContext
|
27 | ], null | ResolveRequest>, req: Request, message: string, resolveContext: LegacyResolveContext, callback: Callback) => void;
|
28 | export type ReadJsonCallback = (error: Error | undefined | null, result?: {}) => void;
|
29 | export type ReadJson = (path2: string, callback: ReadJsonCallback) => void;
|
30 | export type LegacyResolverFileSystem = typeof fs & {
|
31 | readJson?: ReadJson;
|
32 | };
|
33 | export interface LegacyResolveContext {
|
34 | log?: string;
|
35 | stack?: string;
|
36 | missing?: string;
|
37 | }
|
38 | export type ResolverCallbackLegacy = (request: Request, callback: Callback) => void;
|
39 | export type ResolverCallback = (request: Request, resolveContext: LegacyResolveContext, callback: Callback) => void;
|
40 | export interface Request {
|
41 | readonly request?: Request | string;
|
42 | readonly relativePath: string;
|
43 | readonly path: string;
|
44 | readonly context: {
|
45 | readonly issuer: string;
|
46 | };
|
47 | }
|
48 | export interface Callback {
|
49 | (err?: Error, result?: string): void;
|
50 | log?: string;
|
51 | stack?: string;
|
52 | missing?: string;
|
53 | }
|
54 | export declare class TsconfigPathsPlugin implements Exclude<ResolvePluginInstance, Function> {
|
55 | source: string;
|
56 | target: string;
|
57 | log: Logger.Logger;
|
58 | baseUrl: string | undefined;
|
59 | absoluteBaseUrl: string;
|
60 | extensions: ReadonlyArray<string>;
|
61 | referenceMatchMap: Record<string, TsconfigPaths.MatchPathAsync>;
|
62 | matchPath: TsconfigPaths.MatchPathAsync;
|
63 | constructor(rawOptions?: Partial<Options.Options>);
|
64 | apply(resolver: Resolver): void;
|
65 | }
|