This repository has been archived by the owner on Aug 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss-load-config.d.ts
48 lines (39 loc) · 1.8 KB
/
postcss-load-config.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Type definitions for postcss-load-config 2.0
// Project: https://github.com/michael-ciniawsky/postcss-load-config#readme
// Definitions by: Bob Matcuk <https://github.com/bmatcuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
declare module "postcss-load-config" {
import type { AcceptedPlugin, ProcessOptions } from "postcss";
// eslint-disable-next-line node/no-missing-import
import type { Options as CosmiconfigOptions } from "cosmiconfig";
// In the ConfigContext, these three options can be instances of the
// appropriate class, or strings. If they are strings, postcss-load-config will
// require() them and pass the instances along.
interface ProcessOptionsPreload {
parser?: string | ProcessOptions["parser"];
stringifier?: string | ProcessOptions["stringifier"];
syntax?: string | ProcessOptions["syntax"];
}
// The remaining ProcessOptions, sans the three above.
type RemainingProcessOptions = Pick<ProcessOptions, Exclude<keyof ProcessOptions, keyof ProcessOptionsPreload>>;
// Additional context options that postcss-load-config understands.
interface Context {
cwd?: string;
env?: string;
}
// The full shape of the ConfigContext.
type ConfigContext = Context & ProcessOptionsPreload & RemainingProcessOptions;
// Result of postcssrc is a Promise containing the filename plus the options
// and plugins that are ready to pass on to postcss.
interface Result {
file: string;
options: ProcessOptions;
plugins: AcceptedPlugin[];
}
declare function postcssrc(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Promise<Result>;
declare namespace postcssrc {
function sync(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Result;
}
export = postcssrc;
}