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

@stbzmi/imsdk

v1.30.4

Published

```bash npm run dev #运行开发服务器,项目入口 example #暂无build sdk npm run build #仅打包模块,不打包依赖 npm run build:all_dep #打包并且将依赖打包进去 ```

Readme

运行

npm run dev #运行开发服务器,项目入口 example
#暂无build sdk
npm run build #仅打包模块,不打包依赖
npm run build:all_dep #打包并且将依赖打包进去

npm package name

项目相关

  • 添加模块请加入 peerDependencies or devDependencies , 尽可能不加入 dependencies

文档

  • sdk: https://shimo.im/docs/LfSep3MinZALlNgY
  • api: http://148.70.15.154:8889/web/#/235?page_id=4424

文件结构

  • example 例子
  • sdkAssets sdk受用不同项目,资源通过npm scripts切换。不同资源放置不同位置
  • src
    • api 接口代码
    • assets 资源文件
    • common 各平台通用,满足ECMA-262 2015+环境即可,跟SDK相关逻辑
      • log.ts
      • exception.ts 抛出异常
    • components 视图组件
    • context instance上下文
      • db
        • operator 提供dao所需要的数据库表的读写能力,操作适配层
        • dao 对接数据库表访问,提供持久化能力
      • net socket请求实例
      • store 视图状态层
    • platform 平台相关
      • node NodeJs平台代码
      • browser Browser平台代码
    • services 对应不同表的不同行为
    • types 一些公共类型
    • utils 工具函数,和common不同的是提供存粹的js工具函数
    • IMSDK.ts 暴露类

开发事项

持久化数据

./src/utils/fileSystem/index.ts

提供了前端文件读写的能力,文件目录下README提供了使用例子。支持流式API读写。数据落地到idb。优点不需要区分环境。缓存随着清理消失。缺点相较于系统读写慢,可做日志存储,缓存存储。

如何输出日志

//实例logger到需要打印的类中
//例如
Context.loggerService = new LoggerService()

//...code
try{
  throw new ApiException({xxx})
} catch (exception) {
  Context.loggerService.error(exception.message)
}

//全局日志
IMSDK.logger.xxx() 

如何抛出错误

import {ApiException,/* ...more exception */} from '@/common/exception'

throw new ApiException({})

worker运行某部分功能

import {WorkerEx} from '@/utils'
function add(a: any, b: any): number {
  return a + b;
}
const worker = new WorkerEx(
  (a, b) => {
    return add(a, b);
  },
  { add: add }
);
worker.init();
const result = await worker.run(1, 2);
console.log("main :", result);

业务层ID转换到SDK ID

业务层ID为A开头的对应ID

import {ChatId} from '@/common/id'

//所有的id转换都在id下
ChatId.create(message.achatId)

销毁器

  • 规范销毁方式
const disposer = new Disposer();
disposer.add(()=>{console.log('dispose xxx')})


disposer.dispose()

开发组件

  • 参考 example/route.tsx
  • 新增 route, 添加自己的组件即可,隔离上下文只用来开发视图