diff --git a/types/webpack-plugin-serve/index.d.ts b/types/webpack-plugin-serve/index.d.ts index 1233333ebc..ad735ab3bb 100644 --- a/types/webpack-plugin-serve/index.d.ts +++ b/types/webpack-plugin-serve/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack-plugin-serve 0.7 +// Type definitions for webpack-plugin-serve 0.10 // Project: https://github.com/shellscape/webpack-plugin-serve // Definitions by: Matheus Gonçalves da Silva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,7 @@ import { Compiler } from 'webpack'; import { Options as HistoryApiFallbackOptions } from 'connect-history-api-fallback'; import { CompressOptions } from 'koa-compress'; import { Options as KoaStaticOptions } from 'koa-static'; +import { Options as FastGlobOptions } from 'fast-glob'; export interface Builtins { proxy: (args: HttpProxyMiddlewareConfig) => Proxy; @@ -28,6 +29,11 @@ export interface Builtins { four0four: (fn?: (ctx: Koa.Context) => void) => void; } +export interface StaticObject { + glob?: string | string[]; + options?: FastGlobOptions; +} + export interface WebpackPluginServeOptions { client?: { address?: string; @@ -54,7 +60,7 @@ export interface WebpackPluginServeOptions { }; port?: number | Promise; progress?: boolean | 'minimal'; - static?: string | string[]; + static?: string | string[] | StaticObject; status?: boolean; waitForBuild?: boolean; } diff --git a/types/webpack-plugin-serve/package.json b/types/webpack-plugin-serve/package.json new file mode 100644 index 0000000000..fe492c2e59 --- /dev/null +++ b/types/webpack-plugin-serve/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "fast-glob": "^2.2.6" + } +} diff --git a/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts b/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts index 7abddcc600..28dcba127a 100644 --- a/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts +++ b/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts @@ -37,3 +37,10 @@ const baseConfig = { }; const configWithServer = usage(baseConfig); + +const newConfigWithGlobby = new WebpackPluginServe({ + static: { + glob: ['dist/**/public'], + options: { onlyDirectories: true } + } +});