|
1 | 1 | import type { Plugin, PluginBuild } from 'esbuild'; |
2 | 2 |
|
3 | | -export interface Options { |
| 3 | +declare interface BuildOptions { |
4 | 4 | /** force to build modules-css files even if `bundle` is disabled in esbuild, default is `false` */ |
5 | 5 | force?: boolean; |
6 | 6 | /** inline images imported in css as data url even if `bundle` is false */ |
@@ -49,21 +49,27 @@ export interface Options { |
49 | 49 | }; |
50 | 50 | } |
51 | 51 |
|
52 | | -interface BuildContext { |
53 | | - options: Options; |
54 | | - buildId: string; |
55 | | - buildRoot: string; |
56 | | - packageName: string; |
57 | | - packageVersion: string; |
58 | | - log: (...args: any[]) => void; |
59 | | - relative: (to: string) => string; |
60 | | - normalizedEntries: string[]; |
61 | | -} |
| 52 | +declare function CssModulesPlugin(options?: BuildOptions): Plugin; |
62 | 53 |
|
63 | | -declare function CssModulesPlugin(options?: Options): Plugin; |
| 54 | +declare namespace CssModulesPlugin { |
| 55 | + export interface Options extends BuildOptions {}; |
| 56 | + |
| 57 | + export interface BuildContext { |
| 58 | + options: Options; |
| 59 | + buildId: string; |
| 60 | + buildRoot: string; |
| 61 | + packageName: string; |
| 62 | + packageVersion: string; |
| 63 | + log: (...args: any[]) => void; |
| 64 | + relative: (to: string) => string; |
| 65 | + normalizedEntries: string[]; |
| 66 | + } |
64 | 67 |
|
65 | | -export type setup = (build: PluginBuild, options: Options) => void; |
| 68 | + export type setup = (build: PluginBuild, options: Options) => void; |
66 | 69 |
|
67 | | -export interface Build extends PluginBuild { |
68 | | - context: BuildContext; |
| 70 | + export interface Build extends PluginBuild { |
| 71 | + context: BuildContext; |
| 72 | + } |
69 | 73 | } |
| 74 | + |
| 75 | +export = CssModulesPlugin; |
0 commit comments