polyserve
- Version 0.27.15
- Published
- 188 kB
- 34 dependencies
- BSD-3-Clause license
Install
npm i polyserve
yarn add polyserve
pnpm add polyserve
Overview
A simple dev server for bower components
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
Variables
variable args
const args: ArgDescriptor[];
Functions
function getServerUrls
getServerUrls: ( options: ServerOptions, server: http.Server) => { serverUrl: url.Url; componentUrl: url.Url };
Gets the URLs for the main and component pages
Parameter options
Returns
{{serverUrl: {protocol: string, hostname: string, port: string}, componentUrl: url.Url}}
function makeApp
makeApp: (options: AppOptions) => PolyserveApplication;
Make a polyserve express app.
Parameter options
Parameter
{string} options.componentDir The directory to serve components from.
Parameter
{string} options.packageName A name for this polyserve package.
Parameter
{Object} options.headers An object keyed by header name containing header values.
Parameter
{string} options.root The root directory to serve a package from {Object} An express app which can be served with
app.get
function startServer
startServer: ( options: ServerOptions, appMapper?: ExpressAppMapper) => Promise<http.Server>;
Parameter options
used to configure the generated polyserve app and server.
Parameter appMapper
optional mapper function which is called with the generated polyserve app and the options used to generate it and returns an optional substitution Express app. This is usually one that mounts the original app, to add routes or middleware in advance of polyserve's catch-all routes. {Promise} A Promise that completes when the server has started.
Deprecated
Please use
startServers
instead. This function will be removed in a future release.
function startServers
startServers: ( options: ServerOptions, appMapper?: ExpressAppMapper) => Promise<StartServerResult>;
Starts one or more web servers, based on the given options and variant bower_components directories that are found in the root dir.
Interfaces
interface ControlServer
interface ControlServer extends PolyserveServer {}
If more than one server is started by startServers, the main port will serve out a control server. This server serves out an HTML interface that describes the other servers which have been started, and provides convenience links to them.
property kind
kind: 'control';
interface MainlineServer
interface MainlineServer extends PolyserveServer {}
The
default
orprimary
server. If only one ServerInfo is returned from startServers it must be a MainlineServer. This is the server that's running with the default configuration and not running a variant configuration.
property kind
kind: 'mainline';
interface PolyserveServer
interface PolyserveServer {}
interface ServerOptions
interface ServerOptions {}
property additionalRoutes
additionalRoutes?: Map<string, express.RequestHandler>;
An optional list of routes & route handlers to attach to the polyserve app, to be handled before all others
property allowOrigin
allowOrigin?: string;
Sets the value of the Access-Control-Allow-Origin header
property browser
browser?: string[];
The browser(s) to open when run with open argument *
property certPath
certPath?: string;
Path to TLS certificate for HTTPS
property compile
compile?: 'always' | 'never' | 'auto';
Whether or not to compile JavaScript *
property componentDir
componentDir?: string;
The component directory to use *
property componentUrl
componentUrl?: string;
The component url to serve *
property entrypoint
entrypoint?: string;
The path on disk of the entry point HTML file that will be served for app-shell style projects. Must be contained by
root
. Defaults toindex.html
.
property headers
headers?: { [name: string]: string;};
Headers to send with every response
property hostname
hostname?: string;
The hostname to serve from
property keyPath
keyPath?: string;
Path to TLS service key for HTTPS
property moduleResolution
moduleResolution?: 'none' | 'node';
Resolution algorithm to use for rewriting module specifiers
property npm
npm?: boolean;
Sets npm mode: component directory is 'node_modules' and the package name is read from package.json.
property open
open?: boolean;
Whether to open the browser when run *
property openPath
openPath?: string;
The URL path to open in each browser *
property packageName
packageName?: string;
The package name to use for the root directory *
property port
port?: number;
The port to serve from
property protocol
protocol?: string;
The HTTP protocol to use
property proxy
proxy?: { path: string; target: string;};
Proxy to redirect for all matching
path
totarget
property pushManifestPath
pushManifestPath?: string;
Path to H2 push-manifest file
property root
root?: string;
The root directory to serve *
interface VariantServer
interface VariantServer extends PolyserveServer {}
These are servers which are running some named variant configuration. For multiple variant dependency directories are detected/configured, there will be one MainlineServer that serves out the default dependency directory, and one VariantServer for each other dependency directory.
property dependencyDir
dependencyDir: string;
property kind
kind: 'variant';
property variantName
variantName: string;
Type Aliases
type ServerInfo
type ServerInfo = MainlineServer | VariantServer | ControlServer;
Namespaces
namespace bower-config
module 'bower-config' {}
namespace command-line-args
module 'command-line-args' {}
function commandLineArgs
commandLineArgs: ( descriptors: commandLineArgs.ArgDescriptor[], args?: string[]) => any;
Parameter descriptors
An array of objects that describe the arguments that we want to parse.
Parameter args
Optional arguments to parse. If not given, process.argv is used.
interface ArgDescriptor
interface ArgDescriptor {}
property alias
alias?: string;
property defaultOption
defaultOption?: boolean;
property defaultValue
defaultValue?: any;
property description
description?: string;
property group
group?: string;
property multiple
multiple?: boolean;
property name
name: string;
property type
type?: Object;
namespace command-line-usage
module 'command-line-usage' {}
function commandLineUsage
commandLineUsage: (args: commandLineUsage.Section[]) => any;
interface ArgDescriptor
interface ArgDescriptor {}
property alias
alias?: string;
property defaultOption
defaultOption?: boolean;
property defaultValue
defaultValue?: any;
property description
description?: string;
property multiple
multiple?: boolean;
property name
name: string;
property type
type?: Object;
interface Section
interface Section {}
property content
content?: string;
property header
header?: string;
property optionList
optionList?: ArgDescriptor[];
property title
title?: string;
namespace find-port
module 'find-port' {}
function findPort
findPort: ( lower: number, upper: number, callback: (ports: number[]) => void) => void;
namespace http-proxy
module 'http-proxy' {}
interface ProxyError
interface ProxyError extends Error {}
namespace intercept-stdout
module 'intercept-stdout' {}
function intercept
intercept: (onIntercept: (txt: string) => void) => () => void;
namespace send
module 'send' {}
variable send
var send: Send;
interface SendOptions
interface SendOptions {}
property cacheControl
cacheControl?: boolean;
property dotfiles
dotfiles?: string;
property end
end?: number;
property etag
etag?: boolean;
property extensions
extensions?: boolean | Array<string>;
property hidden
hidden?: boolean;
property index
index?: boolean | string;
property lastModified
lastModified?: boolean;
property maxAge
maxAge?: number | string;
property root
root?: string;
property start
start?: number;
Package Files (11)
Dependencies (34)
- @types/compression
- @types/content-type
- @types/escape-html
- @types/express
- @types/mime
- @types/mz
- @types/opn
- @types/parse5
- @types/pem
- @types/resolve
- @types/serve-static
- @types/spdy
- bower-config
- browser-capabilities
- command-line-args
- command-line-usage
- compression
- content-type
- cors
- escape-html
- express
- find-port
- http-proxy-middleware
- lru-cache
- mime
- mz
- opn
- pem
- polymer-build
- polymer-project-config
- requirejs
- resolve
- send
- spdy
Dev Dependencies (12)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/polyserve
.
- Markdown[](https://www.jsdocs.io/package/polyserve)
- HTML<a href="https://www.jsdocs.io/package/polyserve"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3765 ms. - Missing or incorrect documentation? Open an issue for this package.