1 | import { BuildFailure, BuildResult, BuildOptions, TsconfigRaw, Plugin } from 'esbuild';
|
2 | export { loadTsConfig } from 'load-tsconfig';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | declare const dynamicImport: RequireFunction;
|
14 |
|
15 | declare const JS_EXT_RE: RegExp;
|
16 |
|
17 | type RequireFunction = (outfile: string, ctx: {
|
18 | format: "cjs" | "esm";
|
19 | }) => any;
|
20 | type GetOutputFile = (filepath: string, format: "esm" | "cjs") => string;
|
21 | type RebuildCallback = (error: Pick<BuildFailure, "errors" | "warnings"> | null, result: BuildResult | null) => void;
|
22 | type ReadFile = (filepath: string) => string;
|
23 | interface Options {
|
24 | cwd?: string;
|
25 | |
26 |
|
27 |
|
28 | filepath: string;
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 | require?: RequireFunction;
|
35 | |
36 |
|
37 |
|
38 |
|
39 | esbuildOptions?: BuildOptions & {
|
40 | |
41 |
|
42 |
|
43 | watch?: boolean | {
|
44 | onRebuild?: RebuildCallback;
|
45 | };
|
46 | };
|
47 | |
48 |
|
49 |
|
50 |
|
51 | getOutputFile?: GetOutputFile;
|
52 | |
53 |
|
54 |
|
55 | onRebuild?: (ctx: {
|
56 | err?: Pick<BuildFailure, "errors" | "warnings">;
|
57 | mod?: any;
|
58 | dependencies?: string[];
|
59 | }) => void;
|
60 |
|
61 | external?: (string | RegExp)[];
|
62 |
|
63 | notExternal?: (string | RegExp)[];
|
64 | |
65 |
|
66 |
|
67 |
|
68 | externalNodeModules?: boolean;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | tsconfig?: string | TsconfigRaw | false;
|
76 | |
77 |
|
78 |
|
79 |
|
80 | preserveTemporaryFile?: boolean;
|
81 | |
82 |
|
83 |
|
84 |
|
85 | format?: "cjs" | "esm";
|
86 | readFile?: ReadFile;
|
87 | }
|
88 |
|
89 | declare const tsconfigPathsToRegExp: (paths: Record<string, any>) => RegExp[];
|
90 | declare const match: (id: string, patterns?: (string | RegExp)[]) => boolean;
|
91 |
|
92 |
|
93 |
|
94 | declare const externalPlugin: ({ external, notExternal, externalNodeModules, }?: {
|
95 | external?: (string | RegExp)[] | undefined;
|
96 | notExternal?: (string | RegExp)[] | undefined;
|
97 | externalNodeModules?: boolean | undefined;
|
98 | }) => Plugin;
|
99 | declare const injectFileScopePlugin: ({ readFile, }?: {
|
100 | readFile?: ReadFile | undefined;
|
101 | }) => Plugin;
|
102 | declare function bundleRequire<T = any>(options: Options): Promise<{
|
103 | mod: T;
|
104 | dependencies: string[];
|
105 | }>;
|
106 |
|
107 | export { GetOutputFile, JS_EXT_RE, Options, ReadFile, RebuildCallback, RequireFunction, bundleRequire, dynamicImport, externalPlugin, injectFileScopePlugin, match, tsconfigPathsToRegExp };
|