UNPKG

1.11 kBPlain TextView Raw
1import type {loader} from 'webpack';
2import type glob from 'glob';
3
4export type Loader = loader.Loader;
5
6export type LoaderContext = loader.LoaderContext;
7
8export type LoaderCallback = loader.loaderCallback;
9
10export type StyleResourcesFileFormat = 'css' | 'sass' | 'scss' | 'less' | 'styl';
11
12export interface StyleResource {
13 file: string;
14 content: string;
15}
16
17export type StyleResources = StyleResource[];
18
19export type StyleResourcesFunctionalInjector = (
20 this: LoaderContext,
21 source: string,
22 resources: StyleResources,
23) => string | Promise<string>;
24
25export type StyleResourcesInjector = 'prepend' | 'append' | StyleResourcesFunctionalInjector;
26
27export type StyleResourcesNormalizedInjector = StyleResourcesFunctionalInjector;
28
29export interface StyleResourcesLoaderOptions {
30 patterns: string | string[];
31 injector?: StyleResourcesInjector;
32 globOptions?: glob.IOptions;
33 resolveUrl?: boolean;
34}
35
36export interface StyleResourcesLoaderNormalizedOptions extends NonNullable<StyleResourcesLoaderOptions> {
37 patterns: string[];
38 injector: StyleResourcesNormalizedInjector;
39}