阶段 2:把「限量+并发分批」的手写循环收进一个 common util。此形状已被复制进 私有 SLE(friend.ts),是已发生的复制漂移;抽出后堵住它、并给未来的富化点一个 现成原语(cap + 并发批 + best-effort 是防 Tencent 风控封号的标准配方)。 - 新增 common/concurrency.ts:mapWithConcurrency(items, concurrency, fn),批处理 语义(每批 Promise.all 等齐再下一批,非 rolling pool,保持 forward 现有行为), 结果按输入顺序返回。7 个单测覆盖顺序/绝对index/峰值≤limit+跨批serialize/ 不整除/单批/空/concurrency<1。 - 迁移 forward.ts residue 昵称富化的并发批循环;cap(slice MAX)/dedup(Set)/ best-effort(fn 内 try/catch) 保留在 callsite。行为严格不变。 对抗性 Agent 逐条对比 HEAD 确认等价。common 50 / core 467 全绿、typecheck 干净。
70 lines
2.1 KiB
JSON
70 lines
2.1 KiB
JSON
{
|
|
"license": "SEE LICENSE IN LICENSE",
|
|
"name": "@snowluma/common",
|
|
"version": "1.11.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"description": "SnowLuma shared infrastructure — leaf-package utilities with zero business dependencies. Logger / hex codec / log file transport / log line summariser / packet sender wire-protocol types / runtime config loader. Consumed by @snowluma/protocol, @snowluma/core, and @snowluma/onebot. Per-file subpath exports keep import sites unambiguous and let the bundler tree-shake aggressively (importing `@snowluma/common/hex` doesn't pull in `node:fs` from the logger transport).",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./src/index.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./logger": {
|
|
"types": "./src/logger.ts",
|
|
"default": "./src/logger.ts"
|
|
},
|
|
"./coerce": {
|
|
"types": "./src/coerce.ts",
|
|
"default": "./src/coerce.ts"
|
|
},
|
|
"./single-flight-cache": {
|
|
"types": "./src/single-flight-cache.ts",
|
|
"default": "./src/single-flight-cache.ts"
|
|
},
|
|
"./concurrency": {
|
|
"types": "./src/concurrency.ts",
|
|
"default": "./src/concurrency.ts"
|
|
},
|
|
"./hex": {
|
|
"types": "./src/hex.ts",
|
|
"default": "./src/hex.ts"
|
|
},
|
|
"./json": {
|
|
"types": "./src/json.ts",
|
|
"default": "./src/json.ts"
|
|
},
|
|
"./log-file-transport": {
|
|
"types": "./src/log-file-transport.ts",
|
|
"default": "./src/log-file-transport.ts"
|
|
},
|
|
"./log-summary": {
|
|
"types": "./src/log-summary.ts",
|
|
"default": "./src/log-summary.ts"
|
|
},
|
|
"./packet-sender": {
|
|
"types": "./src/packet-sender.ts",
|
|
"default": "./src/packet-sender.ts"
|
|
},
|
|
"./protocol-types": {
|
|
"types": "./src/protocol-types.ts",
|
|
"default": "./src/protocol-types.ts"
|
|
},
|
|
"./runtime": {
|
|
"types": "./src/runtime.ts",
|
|
"default": "./src/runtime.ts"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "vitest run"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^24.12.2",
|
|
"typescript": "catalog:",
|
|
"vitest": "^4.1.4"
|
|
}
|
|
}
|