
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
strap-trousers
Advanced tools
在strap-trousers中 connectStraw模块用于解决、减轻在项目中api请求封装遇到的问题和时间,同时让请求封装不再繁琐 同时,在strap-trousers/common/mixComputing中也有分类好常用的js计算方法
$ npm i strap-trousers
$ yarn add strap-trousers
import axios from "axios";
import { connectStraw, ConnectStrawPlus, Debounce, Post, Get, Res } from "strap-trousers"
/**
* @ConnectStrawPlus 装饰器
* 用于创建请求模块
*/
@ConnectStrawPlus({
lib: axios,
name: "test",
rootUrl: 'http://localhost:8202/',
headers: {
'Token': 'test_token',
},
})
class Test {
/**防抖*/
@Debounce()
/**Post请求*/
@Post('/user/login')
static Login(e: {
[key: string]: any
}) {
/** 用于收集返回Promise类型*/
return Res<{
data: any
}>()
}
/**Get请求*/
@Get('/user/list')
static List() {
return Res<{
data: any
}>()
}
}
import { connectStraw } from "strap-trousers";
import axios from "axios"
const test = connectStraw({
config: {
//使用请求库
lib: axios,
name: "test",
rootUrl: 'http://127.0.0.1:8202/',
},
action: {
//函数写法
list1: () => ({
url: 'user/list',
method: "GET",
}),
//对象写法
list2: {
url: 'user/list',
debounce: true,
method: "GET",
//Typescript工程下 api.object会继承fn()的出入参类型
fn() {
return {} as {
data: string
value: string
}
}
}
}
})
(async function(){
const res1 = test.list1()
const res2 = test.list2()
})()
✨增加
| 【StrawPlus】模块
使用装饰器实现接口
✨增加
| 【test】模块
| 统一使用package.json的version
🦄重构
|【straw】中请求体使用iife方式,减少请求判断,优化请求实际执行速度
🐞修复
| 修复小程序使用【straw】时地址拼接不完整问题
| 修复小程序使用【straw】时没有合并请求参数问题
🦄重构 优化项目结构
| 关闭冗余导出
| 增加部分描述
| 原functions移动至common
✨增加 【strawApi】 返回值:实例、参数、缓存池
🐞修复 【strawApi】 当请求失败时,没有删除当前请求缓存
🐞修复 【strawApi】 公共data不生效问题
| 增加部分描述
✨ 测试 Fetch
✨ 修改StrawApi拦截器
✨ 修改EaseApi拦截器
🦄 refactor(抽离Axios)
🦄 refactor(抽离小程序适配器)
✨ feat(【StrawApi】) : 相比easeApi,更好地对输入类型支持。写法略有不同
1:修复使用 axios 请求时,没有拼接传入的params
2:增加 axios 动态 header 、 params。
使用时在createConnect中的 header|params 中需要动态数据的参数中
传一个return动态参数 的方法即可
FAQs
#### 🐣 strap-trousers
We found that strap-trousers demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.