UNPKG

laravel-mix-glob

Version:

Laravel mix extension that add support for globs usage with an extensive concise api. For a more natural boosted productivity and dynamic. Configure once and forget about adding the files each time.

20 lines (19 loc) 1.06 kB
import { Glob } from "../../Glob"; import { OutConfig } from "../../Glob/OutConfig"; import type { Api as MixApi } from 'laravel-mix'; import { EGlobType } from "../../Glob/Glob"; import type { MixGlob } from '..'; export interface IOptions { mixGlob: MixGlob; } export type TExtendedApi = TMappedExtendedApi & IExtraMethods; interface IExtraMethods { mixGlobSettings: (settings: any) => MixApi; } export type TMappedExtendedApi = { [prop in keyof MixApi]: (MixApi[prop] extends (...args: infer Args) => ReturnType<MixApi[prop]> ? Args[0] extends string | string[] ? Args extends [infer Arg0, ...infer RestArgs] ? (src: Arg0 | Glob, ...args: TMapMixApiFuncsArgs<RestArgs>) => ReturnType<MixApi[prop]> : MixApi[prop] : (...args: [...TMapMixApiFuncsArgs<Args>]) => ReturnType<MixApi[prop]> : MixApi[prop]) | ((argsGlob: Glob<EGlobType.args>) => MixApi); }; type TMapMixApiFuncsArgs<T extends [...any[]]> = { [index in keyof T]: T[index] extends string | string[] ? Glob | T[index] | OutConfig : Glob | T[index]; }; export {};