@@ -323,10 +323,10 @@ function wdm(compiler, options = {}, isPlugin = false) {
323323/**
324324 * @template HapiServer
325325 * @template {HapiOptions} HapiOptionsInternal
326- * @param {boolean } usePlugin whether to use as webpack plugin
326+ * @param {boolean= } usePlugin true when need to use as a plugin, otherwise false
327327 * @returns {HapiPlugin<HapiServer, HapiOptionsInternal> } hapi wrapper
328328 */
329- function createHapiWrapper ( usePlugin = false ) {
329+ function hapiWrapper ( usePlugin = false ) {
330330 return {
331331 pkg : {
332332 name : "webpack-dev-middleware" ,
@@ -397,36 +397,17 @@ function createHapiWrapper(usePlugin = false) {
397397 } ;
398398}
399399
400- /**
401- * @template HapiServer
402- * @template {HapiOptions} HapiOptionsInternal
403- * @returns {HapiPlugin<HapiServer, HapiOptionsInternal> } hapi wrapper
404- */
405- function hapiWrapper ( ) {
406- return createHapiWrapper ( false ) ;
407- }
408-
409- /**
410- * @template HapiServer
411- * @template {HapiOptions} HapiOptionsInternal
412- * @returns {HapiPlugin<HapiServer, HapiOptionsInternal> } hapi plugin wrapper
413- */
414- function hapiPluginWrapper ( ) {
415- return createHapiWrapper ( true ) ;
416- }
417-
418400wdm . hapiWrapper = hapiWrapper ;
419- wdm . hapiPluginWrapper = hapiPluginWrapper ;
420401
421402/**
422403 * @template {IncomingMessage} [RequestInternal=IncomingMessage]
423404 * @template {ServerResponse} [ResponseInternal=ServerResponse]
424405 * @param {Compiler | MultiCompiler } compiler compiler
425406 * @param {Options<RequestInternal, ResponseInternal>= } options options
426- * @param {boolean } usePlugin whether to use as webpack plugin
407+ * @param {boolean= } usePlugin whether to use as webpack plugin
427408 * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } kow wrapper
428409 */
429- function createKoaWrapper ( compiler , options , usePlugin = false ) {
410+ function koaWrapper ( compiler , options , usePlugin ) {
430411 const devMiddleware = wdm ( compiler , options , usePlugin ) ;
431412
432413 if ( usePlugin ) {
@@ -542,40 +523,17 @@ function createKoaWrapper(compiler, options, usePlugin = false) {
542523 return webpackDevMiddleware ;
543524}
544525
545- /**
546- * @template {IncomingMessage} [RequestInternal=IncomingMessage]
547- * @template {ServerResponse} [ResponseInternal=ServerResponse]
548- * @param {Compiler | MultiCompiler } compiler compiler
549- * @param {Options<RequestInternal, ResponseInternal>= } options options
550- * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } kow wrapper
551- */
552- function koaWrapper ( compiler , options ) {
553- return createKoaWrapper ( compiler , options , false ) ;
554- }
555-
556- /**
557- * @template {IncomingMessage} [RequestInternal=IncomingMessage]
558- * @template {ServerResponse} [ResponseInternal=ServerResponse]
559- * @param {Compiler | MultiCompiler } compiler compiler
560- * @param {Options<RequestInternal, ResponseInternal>= } options options
561- * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } kow plugin wrapper
562- */
563- function koaPluginWrapper ( compiler , options ) {
564- return createKoaWrapper ( compiler , options , true ) ;
565- }
566-
567526wdm . koaWrapper = koaWrapper ;
568- wdm . koaPluginWrapper = koaPluginWrapper ;
569527
570528/**
571529 * @template {IncomingMessage} [RequestInternal=IncomingMessage]
572530 * @template {ServerResponse} [ResponseInternal=ServerResponse]
573531 * @param {Compiler | MultiCompiler } compiler compiler
574532 * @param {Options<RequestInternal, ResponseInternal>= } options options
575- * @param {boolean } usePlugin whether to use as webpack plugin
533+ * @param {boolean= } usePlugin true when need to use as a plugin, otherwise false
576534 * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } hono wrapper
577535 */
578- function createHonoWrapper ( compiler , options , usePlugin = false ) {
536+ function honoWrapper ( compiler , options , usePlugin ) {
579537 const devMiddleware = wdm ( compiler , options , usePlugin ) ;
580538
581539 /**
@@ -743,42 +701,6 @@ function createHonoWrapper(compiler, options, usePlugin = false) {
743701 return webpackDevMiddleware ;
744702}
745703
746- /**
747- * @template {IncomingMessage} [RequestInternal=IncomingMessage]
748- * @template {ServerResponse} [ResponseInternal=ServerResponse]
749- * @param {Compiler | MultiCompiler } compiler compiler
750- * @param {Options<RequestInternal, ResponseInternal>= } options options
751- * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } hono wrapper
752- */
753- function honoWrapper ( compiler , options ) {
754- return createHonoWrapper ( compiler , options , false ) ;
755- }
756-
757- /**
758- * @template {IncomingMessage} [RequestInternal=IncomingMessage]
759- * @template {ServerResponse} [ResponseInternal=ServerResponse]
760- * @param {Compiler | MultiCompiler } compiler compiler
761- * @param {Options<RequestInternal, ResponseInternal>= } options options
762- * @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void } hono plugin wrapper
763- */
764- function honoPluginWrapper ( compiler , options ) {
765- return createHonoWrapper ( compiler , options , true ) ;
766- }
767-
768704wdm . honoWrapper = honoWrapper ;
769- wdm . honoPluginWrapper = honoPluginWrapper ;
770-
771- /**
772- * @template {IncomingMessage} [RequestInternal=IncomingMessage]
773- * @template {ServerResponse} [ResponseInternal=ServerResponse]
774- * @param {Compiler | MultiCompiler } compiler compiler
775- * @param {Options<RequestInternal, ResponseInternal>= } options options
776- * @returns {API<RequestInternal, ResponseInternal> } webpack dev middleware
777- */
778- function plugin ( compiler , options = { } ) {
779- return wdm ( compiler , options , true ) ;
780- }
781-
782- wdm . plugin = plugin ;
783705
784706module . exports = wdm ;
0 commit comments