Skip to content

Commit

Permalink
refine index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
indooorsman committed Jun 12, 2023
1 parent ebe2090 commit 6119a3c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
36 changes: 21 additions & 15 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Plugin, PluginBuild } from 'esbuild';

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

interface BuildContext {
options: Options;
buildId: string;
buildRoot: string;
packageName: string;
packageVersion: string;
log: (...args: any[]) => void;
relative: (to: string) => string;
normalizedEntries: string[];
}
declare function CssModulesPlugin(options?: BuildOptions): Plugin;

declare function CssModulesPlugin(options?: Options): Plugin;
declare namespace CssModulesPlugin {
export interface Options extends BuildOptions {};

export interface BuildContext {
options: Options;
buildId: string;
buildRoot: string;
packageName: string;
packageVersion: string;
log: (...args: any[]) => void;
relative: (to: string) => string;
normalizedEntries: string[];
}

export type setup = (build: PluginBuild, options: Options) => void;
export type setup = (build: PluginBuild, options: Options) => void;

export interface Build extends PluginBuild {
context: BuildContext;
export interface Build extends PluginBuild {
context: BuildContext;
}
}

export = CssModulesPlugin;
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"checkJs": true,
"strict": true,
"lib": [
"ES2022"
"ESNext"
],
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"module": "NodeNext",
"target": "ES2022",
"moduleResolution": "nodenext",
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
Expand Down

0 comments on commit 6119a3c

Please sign in to comment.