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

@fgz/wxmini-sdk

v1.0.1

Published

WxMini Bridge SDK - 微信小程序桥接通信 SDK

Readme

wxmini-sdk

微信小程序桥接通信 SDK,通过 WebSocket CSON-RPC 协议与微信小程序原生端通信。

特性

  • 🚀 纯 TypeScript — 无 Vue/React 等框架依赖
  • 📦 多格式输出 — 同时支持 ESM 和 CJS
  • 🔌 即插即用 — 包含完整的类型定义 (.d.ts)
  • 🔄 WebSocket RPC — 基于 CSON 二进制协议的高效通信

安装

npm install wxmini-sdk

快速开始

import { WxMini } from 'wxmini-sdk'

const wxMini = new WxMini()

// 配置
wxMini.serverUrl = 'https://your-server.com'
wxMini.appUuid = 'your-app-uuid'
wxMini.bridgeWebSocketUrl = 'wss://your-bridge-ws-url'

// 使用
const config = wxMini.queryConfig()

构建

# 安装依赖
npm install

# 构建
npm run build

# 开发模式(监听变化)
npm run dev

输出

构建后将在 dist/ 目录生成:

  • index.js — ESM 模块
  • index.cjs — CommonJS 模块
  • index.d.ts — TypeScript 类型定义

项目结构

wxmini-sdk/
├── src/
│   ├── index.ts            # 入口文件 & 公共API导出
│   ├── wx-mini.ts          # WxMini 核心类
│   ├── ws-client.ts        # WebSocket RPC 客户端
│   ├── cson.ts             # CSON 编解码
│   ├── cson-core.ts        # CSON 基础类型
│   ├── pojo.ts             # WxMini 相关 POJO 类
│   ├── pojo-registry.ts    # POJO 类型注册表
│   ├── rpc-core.ts         # RPC 服务基类
│   ├── rpc-interface.ts    # IWxMiniBridgeService
│   ├── device-info.ts      # 设备/环境检测
│   └── utils.ts            # 通用工具类
├── package.json
├── tsconfig.json
└── tsup.config.ts

从原 Vue 项目的变更说明

本 SDK 从 jdv_wxmini Vue 项目中抽取而来,主要变更:

  1. 移除 Vue 依赖 — 所有 @/ 路径别名替换为相对路径
  2. 移除 GuiMgr 依赖WsClient 中的服务端回调处理改为可注入的 ServerCallbackHandler 接口
  3. 精简 POJO — 从 7000+ 行的 all_pojo.ts 中仅抽取 WxMini 所需的类
  4. 环境检测改为函数isWxMiniprogram 等改为函数调用,支持 SSR 环境
  5. 新增 close() 方法WxMini 类新增资源清理方法