npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ksr-serve

v4.0.3

Published

构建器线上版本

Downloads

177

Readme

ksr-serve

线上使用包装好 node静态服务

使用


#静态服务
$ ksr-serve --help

  Usage: ksr-serve [options]

  Options:

    -p, --port [port]      start port (default: 8089)
    -h, --host [host]      start port (default: 127.0.0.1)
    --proxy [proxy]        proxy file , default ".proxy.js" (default: .proxy.js)
    -s, --static [static]  static dir , 逗号分隔 , 默认是当前目录下的dist (default: dist)
    -h, --help             output usage information
  1. 支持代理设置 .proxy.js , **此文件需要在线上环境运行, dev 环境也会使用此配置 , 如设置不能再线上运行需要注意判断线上线下环境 ** , 语法请参见 http-proxy , 可根据环境变量区分线上,开发环境
  2. 一般不需配置 增加.ksr.serve.conf.js文件 , **此文件需要在线上环境运行, dev 环境也会使用此配置 , 如设置不能再线上运行需要注意判断线上线下环境 **, 所有在此文件中添加的模块依赖需要添加到 package.jsondependencies选项中 具体参数 如下所示:
module.exports = {
    //webpack-hot-client
    hot:{},
    //webpack-dev-middleware
    dev:{},
    static:[],
    middleware:[],
    proxy: { //[http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware#options)
      "/api": "http://localhost:3000",
      "/api1": {
          target: "http://localhost:3000",
          pathRewrite: {"^/api" : ""}
      },
      "/api2": {
          target: "https://other-server.example.com",
          secure: false
       },
       "/api3": {
           target: "http://localhost:3000",
           bypass: function(req, res, proxyOptions) {
             if (req.headers.accept.indexOf("html") !== -1) {
               console.log("Skipping proxy for browser request.");
               return "/index.html";
             }
           }
        }
    }
}