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

pop-im-lib

v1.0.42

Published

Web IM SDK used internally at YC, packaged for npm distribution.

Downloads

1,383

Readme

imWebSdk — npm 发布与打包规范

本仓库用于将 utils/ 目录下的 IM 通讯插件打包成 npm 包 pop-im-lib。仓库本身不会改动 utils/ 下的源码,只负责:

  • 通过 Vite 的库模式将源码打包成 ES/CJS/UMD 三种格式;
  • 将产物转译为 ES2015(兼容大多数依赖 ES5 语法的项目,例如 Nuxt2 + Vue2);
  • 只发布 dist/ 目录,以保证 npm 包体积可控。

构建输出

运行 npm run build 后会得到以下文件:

| 文件 | 描述 | 典型用法 | | --- | --- | --- | | dist/popIM.es.js | ES Module | import { init } from 'pop-im-lib' | | dist/popIM.cjs.js | CommonJS | const YCIMLib = require('pop-im-lib') | | dist/popIM.umd.js | UMD(挂载 window.YCIMLib) | 直接通过 <script> 加载 |

所有产物都由 esbuild 按 target: 'es2015' 转译,避免 ?.??、私有字段等语法给旧版 Webpack 带来解析错误。如果业务需要 ES5 runtime polyfill(如 PromiseMap),请在宿主项目自行注入。

目录结构

  • utils/:IM 插件源码;请在这里持续迭代业务逻辑。
  • vite.config.js:仅负责打包配置(入口、外链依赖、输出格式与 ES5 兼容设置)。
  • dist/:构建产物;发布前通过 npm run build 自动生成。

发布流程

  1. 安装依赖

    npm install
  2. 构建

    npm run build
  3. 版本管理

    使用 semver 规范更新版本号:

    npm version patch -m "release: %s"
  4. 发布到 npm

    npm publish --access public
  5. 验证

    npm pack --dry-run
    npx envinfo --system --browsers

    或在干净目录中执行:

    npm install pop-im-lib
    node -e "console.log(Object.keys(require('pop-im-lib')))"

在 Nuxt2 + Vue2 中接入

  1. 确保 node_modules 中安装的是最新版 pop-im-lib

  2. 直接在插件或页面中使用:

    import YCIMLib from 'pop-im-lib';
    
    export default ({ app }, inject) => {
      const sdk = YCIMLib.init('<APP_KEY>');
      inject('ycim', sdk);
    };
  3. 如果目标浏览器不支持 ES2015,请在 Nuxt build.transpile 中添加 ['pop-im-lib'] 或显式引入所需 polyfill。

常见问题

  • Webpack 提示 Module parse failed
    更新到最新版本后,产物已经是 ES2015 语法;若项目本身限定 build.extend 忽略 node_modules 的 Babel 处理,可手动把 pop-im-lib 加入白名单。

  • 需要调试源码
    打包时默认生成 source map,可在调试器中直达 utils/ 原始文件。

以上规范足以覆盖日常发布流程。如需在 utils/ 中新增特性,只需重新运行 npm run build 并按上述步骤发布即可。