-
Notifications
You must be signed in to change notification settings - Fork 74
/
options.ts
72 lines (63 loc) · 1.79 KB
/
options.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Options as SassOptions } from 'sass';
import type tsModule from 'typescript/lib/tsserverlibrary';
import { DotenvConfigOptions } from 'dotenv';
import { CSSExports } from 'icss-utils';
import stylus from 'stylus';
import { Logger } from './helpers/logger';
import type { RawSourceMap } from 'source-map-js';
// NOTE: Stylus doesn't directly export RenderOptions.
type StylusRenderOptions = Parameters<typeof stylus>[1];
export interface PostcssOptions {
excludePlugins?: string[];
useConfig?: boolean;
}
export interface RendererOptions {
less?: Partial<Less.Options>;
sass?: Partial<SassOptions<'sync'>>;
stylus?: Partial<StylusRenderOptions>;
}
export interface Options {
additionalData?: string;
allowUnknownClassnames?: boolean;
classnameTransform?: ClassnameTransformOptions;
customMatcher?: string;
customRenderer?: string;
customTemplate?: string;
dotenvOptions?: Omit<DotenvConfigOptions, 'path'> & { path?: string };
goToDefinition?: boolean;
namedExports?: boolean;
noUncheckedIndexedAccess?: boolean;
postcssOptions?: PostcssOptions;
/** @deprecated To align with naming in other projects. */
postCssOptions?: PostcssOptions;
rendererOptions?: RendererOptions;
}
export type ClassnameTransformOptions =
| 'asIs'
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly';
export interface CustomRendererOptions {
fileName: string;
logger: Logger;
compilerOptions: tsModule.CompilerOptions;
}
export type CustomRenderer = (
css: string,
options: CustomRendererOptions,
) =>
| string
| {
css: string;
sourceMap?: RawSourceMap;
};
export interface CustomTemplateOptions {
classes: CSSExports;
fileName: string;
logger: Logger;
}
export type CustomTemplate = (
dts: string,
options: CustomTemplateOptions,
) => string;