[WPS] Add changes made to static object. (#35221)

* feat: add changes to static

* fix test

* fix lint error
This commit is contained in:
Matheus Gonçalves da Silva 2019-05-06 19:36:11 -03:00 committed by Jesse Trinity
parent c1a9e2b043
commit d17c14a550
3 changed files with 21 additions and 2 deletions

View File

@ -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 <https://github.com/PlayMa256>
// 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<number>;
progress?: boolean | 'minimal';
static?: string | string[];
static?: string | string[] | StaticObject;
status?: boolean;
waitForBuild?: boolean;
}

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"fast-glob": "^2.2.6"
}
}

View File

@ -37,3 +37,10 @@ const baseConfig = {
};
const configWithServer = usage(baseConfig);
const newConfigWithGlobby = new WebpackPluginServe({
static: {
glob: ['dist/**/public'],
options: { onlyDirectories: true }
}
});