# polyserve

> A simple dev server for bower components

Latest version **0.27.15** (published 2019-01-10) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install polyserve
pnpm add polyserve
yarn add polyserve
bun add polyserve
```

Provides the command `polyserve`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.27.15 |
| Published | 2019-01-10 |
| First published | 2015-03-19 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 34 |
| Unpacked size | 183.1 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | The Polymer Project Authors |
| Maintainers | aomarks, azakus, bicknellr, emarquez, justinfagnani, keanulee, notwaldorf, polymer-devs, samli, sorvell, tvanderlippe, usergenic |
| Keywords | polymer, polyserve |

## Links

- npm: https://www.npmjs.com/package/polyserve
- Repository: https://github.com/Polymer/tools
- Homepage: https://github.com/Polymer/tools/tree/master/packages/polyserve
- Issues: https://github.com/Polymer/tools/issues
- npm.io page: https://npm.io/package/polyserve

## Dependencies (34)

- [mz](https://npm.io/package/mz.md) ^2.4.0
- [opn](https://npm.io/package/opn.md) ^3.0.2
- [pem](https://npm.io/package/pem.md) ^1.8.3
- [cors](https://npm.io/package/cors.md) ^2.8.4
- [mime](https://npm.io/package/mime.md) ^2.3.1
- [send](https://npm.io/package/send.md) ^0.16.2
- [spdy](https://npm.io/package/spdy.md) ^3.3.3
- [express](https://npm.io/package/express.md) ^4.8.5
- [resolve](https://npm.io/package/resolve.md) ^1.5.0
- [@types/mz](https://npm.io/package/@types/mz.md) 0.0.29
- [find-port](https://npm.io/package/find-port.md) ^1.0.1
- [lru-cache](https://npm.io/package/lru-cache.md) ^4.0.2
- [requirejs](https://npm.io/package/requirejs.md) ^2.3.4
- [@types/opn](https://npm.io/package/@types/opn.md) ^3.0.28
- [@types/pem](https://npm.io/package/@types/pem.md) ^1.8.1
- [@types/mime](https://npm.io/package/@types/mime.md) ^2.0.0
- [@types/spdy](https://npm.io/package/@types/spdy.md) ^3.4.1
- [compression](https://npm.io/package/compression.md) ^1.6.2
- [escape-html](https://npm.io/package/escape-html.md) ^1.0.3
- [bower-config](https://npm.io/package/bower-config.md) ^1.4.1
- [content-type](https://npm.io/package/content-type.md) ^1.0.2
- [@types/parse5](https://npm.io/package/@types/parse5.md) ^2.2.34
- [polymer-build](https://npm.io/package/polymer-build.md) ^3.1.0
- [@types/express](https://npm.io/package/@types/express.md) ^4.0.36
- [@types/resolve](https://npm.io/package/@types/resolve.md) 0.0.6
- [command-line-args](https://npm.io/package/command-line-args.md) ^5.0.2
- [@types/compression](https://npm.io/package/@types/compression.md) ^0.0.33
- [@types/escape-html](https://npm.io/package/@types/escape-html.md) 0.0.20
- [command-line-usage](https://npm.io/package/command-line-usage.md) ^5.0.5
- [@types/content-type](https://npm.io/package/@types/content-type.md) ^1.1.0
- [@types/serve-static](https://npm.io/package/@types/serve-static.md) ^1.7.31
- [browser-capabilities](https://npm.io/package/browser-capabilities.md) ^1.0.0
- [http-proxy-middleware](https://npm.io/package/http-proxy-middleware.md) ^0.17.2
- [polymer-project-config](https://npm.io/package/polymer-project-config.md) ^4.0.0

## Recent versions

- 0.27.15 (latest) — 2019-01-10
- 0.27.14 — 2018-12-19
- 0.27.13 — 2018-10-16
- 0.27.12 — 2018-06-28
- 0.27.11 — 2018-05-08
- 0.27.10 — 2018-05-04
- 0.27.9 — 2018-05-02
- 0.27.8 — 2018-04-26
- 0.27.7 — 2018-04-24
- 0.27.6 — 2018-04-19
- 0.27.5 — 2018-04-18
- 0.27.4 — 2018-04-12
- 0.27.3 — 2018-04-12
- 0.27.2 — 2018-04-11
- 0.27.1 — 2018-04-10
- … 45 more at https://npm.io/package/polyserve/versions

## README

[![Build Status](https://travis-ci.org/Polymer/polyserve.svg?branch=master)](https://travis-ci.org/Polymer/polyserve)
[![NPM version](http://img.shields.io/npm/v/polyserve.svg)](https://www.npmjs.com/package/polyserve)

# polyserve

A simple development server for web projects.

`polyserve` serves project files from a URL root that allows relative URLs
that reach out of the project, like those starting with `../`, to work. This is
necessary for referencing other packages by path when stored as a flat directory
such as how Bower works.

The local package is served at the URL `/components/{bower-name}/`, with files
served from the current directory. Other packages are served at
`/components/{packageName}` with files served from their directory under
`./bower_components/`.

## Installation

    $ npm install polyserve -g

## Usage

### Run `polyserve`

    $ cd my-element/
    $ polyserve

### Browse files

Navigate to `localhost:8080/components/my-element/demo.html`

### Options

 * `--version`: Print version info.                                                           
 * `--root` _string_: The root directory of your project. Defaults to the current working directory.                                                                    
 * `--compile` _string_: Compiler options. Valid values are "auto", "always" and "never". "auto" compiles JavaScript to ES5 for browsers that don't fully support ES6.         
 * `--module-resolution` _string_: Algorithm to use for resolving module specifiers in import and export statements when rewriting them to be web-compatible. Valid values are "none" and "node". "none" disables module specifier rewriting. "node" uses Node.js resolution to find modules.
 * `--compile-cache` _number_: Maximum size in bytes (actually, UTF-8 characters) of the cache used to store results for JavaScript compilation. Cache size includes the uncompiled and compiled file content lengths. Defaults to 52428800 (50MB).
 * `-p`, `--port` _number_: The port to serve from. Serve will choose an open port for you by default.
 * `-H`, `--hostname` _string_: The hostname to serve from. Defaults to localhost.          
 * `-c`, `--component-dir` _string_: The component directory to use. Defaults to reading from the Bower config (usually bower_components/).
 * `-u`, `--component-url` _string_: The component url to use. Defaults to reading from the Bower config (usually bower_components/).
 * `-n`, `--package-name` _string_: The package name to use for the root directory. Defaults to reading from bower.json.
 * `--npm`: Sets npm mode: component directory is "node_modules" and the package name is read from package.json
 * `-o`, `--open`: The page to open in the default browser on startup.
 * `-b`, `--browser` _string[]_: The browser(s) to open with when using the --open option. Defaults to your default web browser.
 * `--open-path` _string_: The URL path to open when using the --open option. Defaults to "index.html".
 * `-P`, `--protocol` _string_: The server protocol to use {h2, https/1.1, http/1.1}. Defaults to "http/1.1".
 * `--key` _string_: Path to TLS certificate private key file for https. Defaults to "key.pem".
 * `--cert` _string_: Path to TLS certificate file for https. Defaults to "cert.pem".
 * `--manifest` _string_: Path to HTTP/2 Push Manifest.    
 * `--proxy-path` _string_: Top-level path that should be redirected to the proxy-target. E.g. `api/v1` when you want to redirect all requests of `https://localhost/api/v1/`.
 * `--proxy-target` _string_: Host URL to proxy to, for example `https://myredirect:8080/foo`.
 * `--help`: Shows this help message

## Compiling from Source

    $ npm install
    $ npm run build

You can compile and run polyserve from source by cloning the repo from Github and then running `npm run build`. Make sure you have already run `npm install` before building.

### Run Tests

    $ npm test

---
_Source: https://npm.io/package/polyserve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
