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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lsls

v4.3.0

Published

控制台代理服务器工具,提供本地开发时的跨域代理功能。

Readme

lsls

控制台代理服务器工具,提供本地开发时的跨域代理功能。

功能特性

  • 🚀 支持控制台的代理访问
  • 🔧 灵活的命令行参数配置
  • 📋 支持本地配置文件
  • 🌐 CORS 跨域请求支持
  • 🔍 调试模式输出
  • 🎯 多环境域名自动映射
  • 🔐 自动处理认证信息

安装

全局安装

npm install -g lsls

本地安装

npm install lsls

配置文件

工具会自动读取 ~/.local.json 配置文件,支持以下配置项:

{
  "Cookie": "your-base64-encoded-cookie-string",
  "secToken": "your-sec-token-value"
}

命令行参数

| 参数 | 简写 | 描述 | 默认值 | |------|------|------|--------| | --port | -p | 代理服务器端口 | 4099 | | --cookie | -c | 自定义 Cookie 值(需要 Base64 编码) | undefined | | --token | -t | slsaccesstoken 值 | undefined | | --sectoken | -s | 自定义 secToken 值 | undefined | | --debug | -d | 启用调试模式 | false |

使用示例

基本使用

# 使用默认端口 4099 启动代理服务器
lsls

# 指定端口
lsls -p 8080

# 启用调试模式
lsls -d

带认证信息启动

# 使用自定义 Cookie 和 secToken
lsls -c "your-base64-encoded-cookie" -s "your-sec-token"

# 使用 slsaccesstoken
lsls -t "your-sls-access-token"

完整参数示例

lsls -p 8080 -c "your-cookie" -s "your-sectoken" -t "your-token" -d

支持的环境

工具支持以下阿里云环境的自动域名映射:

  • sls-presls-pre.console.aliyun.com
  • sls-stgsls-stg.console.aliyun.com
  • sls-prodsls-prod.console.aliyun.com
  • pre-slspre-sls.console.aliyun.com
  • pre-cmsnextpre-cmsnext.console.aliyun.com
  • pre-stg-cmsnextpre-stg-cmsnext.console.aliyun.com

默认环境:sls.console.aliyun.com

API 接口

获取配置信息

GET /aliyun/config

返回当前配置的 Cookie 和 secToken 信息:

{
  "Cookie": "your-cookie-value",
  "secToken": "your-sectoken-value"
}

代理规则

  1. 请求转发:将请求代理到对应的阿里云控制台域名
  2. 认证处理:自动添加配置的 Cookie、secToken 和 slsaccesstoken 到请求头
  3. CORS 处理:支持跨域请求,允许所有来源和常用请求头

调试模式

启用调试模式(-d 参数)后,会在控制台输出详细的请求信息:

lsls -d

输出示例:

GET https://sls.console.aliyun.com/api/endpoint 200
POST https://sls-pre.console.aliyun.com/api/data 201

状态码会有不同颜色显示:

  • 🟢 2xx: 绿色(成功)
  • 🔵 3xx: 青色(重定向)
  • 🟡 4xx: 黄色(客户端错误)
  • 🔴 5xx: 红色(服务器错误)

注意事项

  1. Cookie 编码:使用 -c 参数时,Cookie 值需要进行 Base64 编码
  2. 端口占用:确保指定的端口没有被其他服务占用
  3. 网络访问:需要确保能够访问阿里云控制台域名
  4. 配置文件:配置文件 ~/.local.json 中的 Cookie 值应该是 Base64 编码后的值

故障排除

常见问题

  1. 代理服务器启动失败

    • 检查端口是否被占用
    • 确认有足够的权限
  2. 请求被拒绝

    • 检查 Cookie 和 secToken 是否正确
    • 确认目标域名是否可访问
  3. CORS 错误

    • 工具已默认配置 CORS,如仍有问题请检查请求头设置

获取帮助

lsls --help

许可证

本项目遵循相关开源许可证。