import type { Options } from "html-webpack-plugin";
/**
* Интерфейс для объекта стилей
*/
export interface IStyle {
use?: Function;
unuse?: Function;
locals?: Object;
id?: string;
options?: Object;
}
/**
* Интерфейс опций для функции `styleTagTransform` (автоматической вставки стилей)
*/
export interface IStyleTransformOptions {
id?: string;
[key: string]: unknown;
}
/**
* Интерфейс для иконок
*/
export interface ISvgIcon {
[key: string]: unknown;
}
/**
* Тип опций для функции `getHTMLPluginInstances`
*/
export type TGetHTMLPluginInstancesOptions = Partial<{
options: Options;
dirs: TGetHTMLPluginInstancesPageOptions[];
extensions: string[];
loaders: string[];
getFilterFn: (idPage: string) => boolean;
}>;
/**
* Тип для опций каждого типа страницы для функции `getHTMLPluginInstances`
*/
export type TGetHTMLPluginInstancesPageOptions = {
filePath: string;
outputPath: string;
inject?: boolean;
[key: string]: unknown;
};
/**
* Тип для функции `import.meta.webpackContext`
*/
export type TWebpackAsyncRequestFn = (
request: string,
options: TWebpackAsyncRequestOptions
) => TWebpackAsyncRequestResult;
/**
* Тип для опций функции `import.meta.webpackContext`
*/
export type TWebpackAsyncRequestOptions = ({
recursive?: boolean;
regExp?: RegExp;
include?: RegExp;
exclude?: RegExp;
preload?: boolean | number;
prefetch?: boolean | number;
chunkName?: string;
exports?: string | string[][];
mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
});
/**
* Результат выполнения функции `import.meta.webpackContext`
*/
export type TWebpackAsyncRequestResult = Function & {
keys: Function;
id: unknown;
resolve: Function;
};
/**
* Интерйейс опций для функции `getFilesWithContext` (поиск файлов)
*/
export type TWebpackRequireContextOptions = {
module: unknown;
path: string;
items: string[];
index: number;
};