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

gy-roslib

v1.0.14

Published

gy

Downloads

78

Readme

gy-roslib

使用vue3.0+vite+ts封装的roslib组件

该组件支持VUE2.0以及VUE3.0,并针对ES5环境进行了BigInt兼容性处理。

文档地址:https://guoyao132.github.io/npm-main/#/gy-roslib

安装

使用 npm 安装。

npm install gy-roslib --save

BigInt ES5兼容性说明

该库内部使用了BigInt进行大数处理,为了确保在不支持BigInt的ES5环境(如IE11)中正常运行,我们采取了以下兼容性处理:

  1. big-integer库polyfill:使用big-integer库作为BigInt的polyfill
  2. 构建时转换处理:在构建过程中自动将以下类型的BigInt字面量转换为兼容格式:
    • 十进制BigInt(如123nBigInt('123')
    • 十六进制BigInt(如0x7fffffffffffffffnBigInt('0x7fffffffffffffff')
    • 负数值(如-123nBigInt('-123')-0x7fffffffffffffffnBigInt('-0x7fffffffffffffff')
    • 带位运算符的表达式(如~123nBigInt('123').not()~0x7fffffffffffffffnBigInt('0x7fffffffffffffff').not()
  3. 位运算符支持:为polyfill的BigInt对象添加了not()方法,用于支持~按位非运算符

对于使用该库的项目

如果您的项目需要在不支持BigInt的环境中运行,建议在项目中添加以下配置:

// webpack.config.js 或 vite.config.js
module.exports = {
  // ...其他配置
  resolve: {
    alias: {
      // 确保big-integer库被正确解析
      'big-integer': require.resolve('big-integer')
    }
  }
}

常见问题

问:在IE11中使用该库出现"BigInt is not defined"错误怎么办?

答: 确保您的项目正确安装了big-integer依赖,并且在入口文件中引入了该库:

// 在项目入口文件中添加
if (typeof BigInt !== 'function') {
  try {
    const bigInt = require('big-integer');
    window.BigInt = bigInt;
    // 添加位运算符支持
    if (typeof BigInt.prototype.not !== 'function') {
      BigInt.prototype.not = function() { return this.not(); };
    }
  } catch (e) {
    console.warn('无法加载big-integer库,某些功能可能受限');
  }
}

// 如果使用的是十六进制BigInt字面量(如0x7fffffffffffffffn),确保以下代码也被正确转换
// 转换前: return parseBigIntLiteral(str, ~0x7fffffffffffffffn, 0x7fffffffffffffffn);
// 转换后: return parseBigIntLiteral(str, BigInt('0x7fffffffffffffff').not(), BigInt('0x7fffffffffffffff'));

修复说明

我们已经修复了正则表达式处理十六进制BigInt字面量的问题,并创建了专门测试十六进制BigInt字面量的测试文件,确保在各种情况下都能正确转换和处理十六进制BigInt值。