
Security News
/Research
Fake Corepack Site Distributes Infostealer and Proxyware to Developers
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.
uniapp 跨平台小程序工具库,提供扫码、摄像头、手势检测等常用功能
npm install l-mini-fn
# 或
yarn add l-mini-fn
# 或
pnpm add l-mini-fn
import { getLaunchOptions, getScanParams, getQueryParams } from 'l-mini-fn';
// 在小程序页面的 onLoad 中使用
onLoad(options) {
// 获取扫码参数
getScanParams(options, (url, params) => {
console.log('扫码URL:', url);
console.log('解析参数:', params);
// url: "https://example.com?id=123&name=test"
// params: { id: "123", name: "test" }
});
}
// 解析 URL 参数
const params = getQueryParams('https://example.com?id=123&name=test');
console.log(params); // { id: '123', name: 'test' }
import { hasCameraAccess, requestCameraPermission } from 'l-mini-fn';
// 检测摄像头权限
const hasPermission = await hasCameraAccess();
if (!hasPermission) {
// 请求权限
const granted = await requestCameraPermission();
if (granted) {
console.log('用户已授权');
} else {
console.log('用户拒绝授权');
}
}
import { detectDirectionDebounce, resetSwipeDetect } from 'l-mini-fn';
// 在 Vue 组件中使用
onTouchMove(e) {
detectDirectionDebounce(e, (direction) => {
console.log('滑动方向:', direction); // 'up' | 'down' | 'left' | 'right'
}, { threshold: 10, delay: 50 });
}
onTouchEnd() {
resetSwipeDetect();
}
import {
getPlatform,
isWeixin,
isAlipay,
isOneOf
} from 'l-mini-fn';
// 获取当前平台
const platform = getPlatform();
console.log(platform); // 'wechat' | 'alipay' | 'douyin' | ...
// 判断具体平台
if (isWeixin()) {
console.log('当前运行在微信小程序');
// 微信特有逻辑
} else if (isAlipay()) {
console.log('当前运行在支付宝小程序');
// 支付宝特有逻辑
}
// 批量判断
if (isOneOf(['wechat', 'alipay'])) {
console.log('当前运行在微信或支付宝');
}
import { showCustomModal } from 'l-mini-fn';
// Promise 方式(推荐)
const confirmed = await showCustomModal({
title: '提示',
msg: '确定删除吗?'
});
if (confirmed) {
console.log('用户点击了确认');
}
// 回调方式(兼容旧代码)
showCustomModal(
{ title: '提示', msg: '确定删除吗?' },
() => { console.log('确认'); },
() => { console.log('取消'); }
);
import {
router,
getSystemInfo,
copyText,
showGlobalLoading,
hideGlobalLoading
} from 'l-mini-fn';
// 路由跳转
router('/pages/detail/index', 'navigateTo');
// 获取系统信息
const systemInfo = await getSystemInfo();
console.log(systemInfo.model); // 设备型号
// 复制文本
copyText('Hello World', '复制成功');
// 加载提示
await showGlobalLoading('加载中...');
// ... 执行操作
await hideGlobalLoading();
import { storage, writeJSON, readJSON, exists, deleteFile } from 'l-mini-fn';
// 方式一:使用默认实例(推荐)
// 写入 JSON
await storage.writeJSON('user.json', { name: '张三', age: 25 });
// 读取 JSON
const user = await storage.readJSON('user.json');
console.log(user.name); // '张三'
// 检查文件是否存在
const hasUser = await storage.exists('user.json');
// 删除文件
await storage.delete('user.json');
// 方式二:使用便捷函数
await writeJSON('config.json', { theme: 'dark' });
const config = await readJSON('config.json');
| 函数 | 说明 |
|---|---|
getLaunchOptions() | 获取小程序启动参数 |
getScanParams(options, callback) | 解析扫码参数 |
getQueryParams(url) | 解析 URL 查询参数 |
| 函数 | 说明 |
|---|---|
hasCameraAccess() | 检测摄像头权限 |
requestCameraPermission() | 请求摄像头权限 |
| 函数 | 说明 |
|---|---|
detectDirectionDebounce(e, callback, options) | 检测滑动方向 |
resetSwipeDetect() | 重置检测状态 |
getPlatform() - 获取当前平台类型isWeixin() - 判断是否为微信小程序isAlipay() - 判断是否为支付宝小程序isDouyin() - 判断是否为抖音小程序isBaidu() - 判断是否为百度小程序isJD() - 判断是否为京东小程序isQQ() - 判断是否为QQ小程序isKuaishou() - 判断是否为快手小程序isH5() - 判断是否为H5isApp() - 判断是否为AppisOneOf(platforms) - 判断是否在指定平台之一showCustomModal(options, confirmCallBack, cancelCallback) - 自定义模态框router(url, type) - 路由跳转(navigateTo/reLaunch/switchTab/redirectTo)getEnvVersion() - 获取平台版本(正式版/体验版/开发版)getSystemInfo() - 获取系统信息getMiniVersion() - 获取小程序版本号getMenuButtonInfo() - 获取胶囊按钮信息selectSystemPhoto(callback, params) - 选择系统相册图片getWxImage(filePath) - 转换微信协议图片为可回显路径getCachedImage(url, cache, options) - 图片缓存showGlobalLoading(msg) - 显示全局加载(支持引用计数)hideGlobalLoading() - 隐藏全局加载calcSquareItemHeight(columns, margin, containerWidth) - 计算正方形元素高度getKeyBoardHeight(changeCallBack) - 获取键盘高度(含安全区)copyText(text, successToast) - 复制文本到剪贴板writeFile(fileName, content, options) - 写入文本文件writeJSON(fileName, data, options) - 写入 JSON 文件readFile(fileName, options) - 读取文本文件readJSON(fileName, options) - 读取 JSON 文件exists(fileName) - 检查文件是否存在delete(fileName) - 删除文件clear() - 清空目录getFileInfo(fileName) - 获取文件信息writeFile() - 写入文件(使用默认实例)writeJSON() - 写入 JSON(使用默认实例)readFile() - 读取文件(使用默认实例)readJSON() - 读取 JSON(使用默认实例)exists() - 检查文件是否存在(使用默认实例)deleteFile() - 删除文件(使用默认实例)storage - 默认 FileStorage 实例l-mini-fn/
├── src/
│ ├── index.ts # 统一导出入口
│ ├── miniprogram/ # 小程序专用模块
│ │ ├── scan.ts # 扫码相关
│ │ ├── camera.ts # 摄像头相关
│ │ ├── common.ts # 通用工具
│ │ └── file-storage.ts # 文件存储
│ ├── utils/ # 通用工具模块
│ │ ├── gesture.ts # 手势检测
│ │ └── internal.ts # 内部工具(不对外导出)
│ └── types/ # 类型定义
├── __tests__/ # 单元测试
├── dist/ # 构建输出(自动生成)
├── tsup.config.ts # 构建配置
├── tsconfig.json # TypeScript 配置
└── package.json
# 监听模式开发(热重载)
npm run dev
# 清理并构建生产版本
npm run build
# 清理 dist 目录
npm run clean
# 重装依赖
npm run reload
# 运行测试
npm test
# 生成 API 文档
npm run docs
# 本地预览文档
npm run docs:serve
# 发布到 npm
npm run publish:npm
| 平台 | 支持情况 |
|---|---|
| 微信小程序 | ✅ 完全支持 |
| 支付宝小程序 | ✅ 完全支持 |
| 抖音小程序 | ✅ 平台检测支持 |
| 百度小程序 | ✅ 平台检测支持 |
| 京东小程序 | ✅ 平台检测支持 |
| QQ小程序 | ✅ 平台检测支持 |
| 快手小程序 | ✅ 平台检测支持 |
| H5 | ✅ 部分支持 |
遵循 Conventional Commits 规范:
git commit -m "feat: 添加新功能"
git commit -m "fix: 修复bug"
git commit -m "docs: 更新文档"
# 运行测试
npm test
# 生成覆盖率报告
npm run test:coverage
# 监听模式运行测试
npm run test:watch
欢迎提交 Issue 和 Pull Request!
享受编码! 🎉
FAQs
A brief description of your package
We found that l-mini-fn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.

Research
/Security News
A large-scale campaign abused GitHub Actions in compromised repositories to exploit CVE-2026-41940 in cPanel and WHM and steal server credentials.

Security News
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.