Skip to content

Commit 6119a3c

Browse files
committed
refine index.d.ts
1 parent ebe2090 commit 6119a3c

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

index.d.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Plugin, PluginBuild } from 'esbuild';
22

3-
export interface Options {
3+
declare interface BuildOptions {
44
/** force to build modules-css files even if `bundle` is disabled in esbuild, default is `false` */
55
force?: boolean;
66
/** inline images imported in css as data url even if `bundle` is false */
@@ -49,21 +49,27 @@ export interface Options {
4949
};
5050
}
5151

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;
6253

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+
}
6467

65-
export type setup = (build: PluginBuild, options: Options) => void;
68+
export type setup = (build: PluginBuild, options: Options) => void;
6669

67-
export interface Build extends PluginBuild {
68-
context: BuildContext;
70+
export interface Build extends PluginBuild {
71+
context: BuildContext;
72+
}
6973
}
74+
75+
export = CssModulesPlugin;

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"checkJs": true,
88
"strict": true,
99
"lib": [
10-
"ES2022"
10+
"ESNext"
1111
],
1212
"skipDefaultLibCheck": true,
1313
"skipLibCheck": true,
14-
"module": "NodeNext",
15-
"target": "ES2022",
16-
"moduleResolution": "nodenext",
14+
"module": "ESNext",
15+
"target": "ESNext",
16+
"moduleResolution": "bundler",
1717
"allowSyntheticDefaultImports": true,
1818
"esModuleInterop": true
1919
},

0 commit comments

Comments
 (0)