webpack

package
v0.0.0-...-e2c53ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

README

Package cloudeng.io/webapp/webpack

import cloudeng.io/webapp/webpack

Types

Type DevServer
type DevServer struct {
	// contains filtered or unexported fields
}

DevServer represents a webpack dev server.

Functions
func NewDevServer(ctx context.Context, dir string, command string, args ...string) *DevServer

NewDevServer creates a new instance of DevServer. Note, that the server is not started at this point. The dir argument specifies the directory containing the webpack configuration. Context, command and args are passed to exec.CommandContext. A typical usage would be:

NewDevServer(ctx, "./frontend", "webpack", "serve", "-c", "webpack.dev.js")

Additional, optional configuration is possible via the Configure method.

Methods
func (ds *DevServer) Configure(opts ...DevServerOption)

Configure applies options and mus be called before Start.

func (ds *DevServer) Shutdown()

Shutdown asks the dev server to shut itself down.

func (ds *DevServer) Start() error

Start starts the dev server.

func (ds *DevServer) WaitForURL(ctx context.Context) (*url.URL, error)

WaitForURL parses the output of the development server looking for a line that specifies the URL it is listening on.

Type DevServerFlags
type DevServerFlags struct {
	WebpackDir    string `subcmd:"webpack-dir,,'set to a directory containing a webpack configuration with the webpack dev server configured. This dev server will then be started and requests proxied to it.'"`
	WebpackServer string `subcmd:"webpack-server,,set to the url of an already running webpack dev server to which requests will be proxied."`
}

DevServerFlags represents the flags commonly used when using webpack dev servers.

Type DevServerOption
type DevServerOption func(ds *DevServer)

DevServerOption represents an option to Configure.

Functions
func AddrRegularExpression(re *regexp.Regexp) DevServerOption

AddrRegularExpression specifies the regular expression to use for determining the running server's address. The default RE is: 'Project is running at'. However, some configurations may use a different output.

func SetSdoutStderr(stdout, stderr io.Writer) DevServerOption

SetSdoutStderr sets the stdout and stderr io.Writers to be used by the dev server.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevServer

type DevServer struct {
	// contains filtered or unexported fields
}

DevServer represents a webpack dev server.

func NewDevServer

func NewDevServer(ctx context.Context, dir string, command string, args ...string) *DevServer

NewDevServer creates a new instance of DevServer. Note, that the server is not started at this point. The dir argument specifies the directory containing the webpack configuration. Context, command and args are passed to exec.CommandContext. A typical usage would be:

NewDevServer(ctx, "./frontend", "webpack", "serve", "-c", "webpack.dev.js")

Additional, optional configuration is possible via the Configure method.

func (*DevServer) Configure

func (ds *DevServer) Configure(opts ...DevServerOption)

Configure applies options and mus be called before Start.

func (*DevServer) Shutdown

func (ds *DevServer) Shutdown()

Shutdown asks the dev server to shut itself down.

func (*DevServer) Start

func (ds *DevServer) Start() error

Start starts the dev server.

func (*DevServer) WaitForURL

func (ds *DevServer) WaitForURL(ctx context.Context) (*url.URL, error)

WaitForURL parses the output of the development server looking for a line that specifies the URL it is listening on.

type DevServerFlags

type DevServerFlags struct {
	WebpackDir    string `` /* 182-byte string literal not displayed */
	WebpackServer string `subcmd:"webpack-server,,set to the url of an already running webpack dev server to which requests will be proxied."`
}

DevServerFlags represents the flags commonly used when using webpack dev servers.

type DevServerOption

type DevServerOption func(ds *DevServer)

DevServerOption represents an option to Configure.

func AddrRegularExpression

func AddrRegularExpression(re *regexp.Regexp) DevServerOption

AddrRegularExpression specifies the regular expression to use for determining the running server's address. The default RE is: 'Project is running at'. However, some configurations may use a different output.

func SetSdoutStderr

func SetSdoutStderr(stdout, stderr io.Writer) DevServerOption

SetSdoutStderr sets the stdout and stderr io.Writers to be used by the dev server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL