Draft
Conversation
Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- 创建 docs/sop/ 目录,包含 SOP 总览 + 9 个 Phase 文档 - 引入 es-toolkit (替代 lodash)、p-limit@7 (并发管理)、zod (数据验证) - 确认 wappalyzer@6.10.66 的 API (init/open/analyze/destroy) - 每个 Phase 均包含 TDD 流程:测试代码 → 实现代码 → 验证清单 - 更新 REFACTORING_PLAN.md 技术选型和里程碑索引 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- 配置 tsconfig.json, biome.json - 创建 src/ 目录骨架 (core, plugins, utils, schemas) - 创建 tests/ 目录骨架 - 定义基础类型 (Plugin, PluginContext, HttpResponse) - 安装依赖 (es-toolkit, p-limit, zod, commander, picocolors 等) - smoke test 通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/utils/url.ts: normalizeUrl + Zod urlSchema - src/utils/dns.ts: resolve4 (node:dns/promises) - src/utils/ip.ts: ipToLong/longToIp/expandCIDR (Generator) - src/utils/http.ts: httpGet/httpHead (原生 fetch + AbortController) - src/utils/concurrency.ts: mapConcurrent (基于 p-limit@7) - 29 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/plugins/types.ts: Plugin/PluginContext/PluginMeta + Zod schemas - src/core/plugin-loader.ts: PluginLoader (register/getAll/get/withBuiltins) - 6 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/plugins/base-info.ts: 状态码/标题/重定向/x-*头提取 - src/plugins/email.ts: 邮箱正则 + es-toolkit uniq 去重 - src/plugins/geoip.ts: DNS 解析 + geoip-lite 地理位置 - 注册到 PluginLoader.withBuiltins() - 23 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/plugins/wappalyzer.ts: init/open/analyze/destroy 生命周期 - finally 确保 destroy 清理浏览器进程 - 错误时优雅返回 null - 3 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/plugins/bbscan/rule-parser.ts: Zod schema 验证规则,Bun.Glob 加载文件 - src/plugins/bbscan/scanner.ts: 404 检测, p-limit 并发 50, 路径变量替换 - src/plugins/bbscan/index.ts: Plugin 接口实现 - 含 tag 规则用 GET、其他用 HEAD (修复原代码 bug) - 13 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- src/core/scanner.ts: Scanner 类, Zod 参数验证, 插件错误隔离 - src/index.ts: 导出 Scanner/PluginLoader/类型 - 支持自定义 PluginLoader 和默认内置插件 - 5 个测试全部通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
…imit/zod) - src/schemas/cli.ts: Zod CLI 参数验证 schema - src/core/reporter.ts: 彩色控制台输出 + JSONL 文件输出 - src/cli.ts: 完整 CLI (commander@12/picocolors/cli-progress/p-limit/es-toolkit) - 全部 87 个测试通过,lint 无错误 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- tests/integration/e2e.test.ts: 端到端集成测试 (Scanner + CLI) - 删除旧文件: index.js, whatsweb.js, utils.js, plugins/ - 更新 README.md (新架构文档) - 更新 docs/sop/README.md 进度表 (全部 ✅) - 更新 .gitignore, .npmignore 最终结果: 89 tests, 0 failures, 506 assertions Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- SingleBar 没有 .log() 方法,改为手动 ANSI 转义清行后打印 - process.stdout.clearLine 在 Bun 中不可用,改用 \x1b[2K\x1b[0G - 修复 rate 计算逻辑 - 真实 URL 测试通过 (https://www.baidu.com) Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- 卸载 @biomejs/biome,删除 biome.json - 安装 eslint@10 + typescript-eslint@8 + eslint-config-prettier + prettier@3 - 创建 eslint.config.mjs (ESLint 9 flat config) - 创建 .prettierrc + .prettierignore - 更新 package.json scripts (lint/lint:fix/format/format:check) - Prettier 格式化全量代码 - 修复 ESLint 发现的 2 个 unused-vars 问题 - 更新所有 SOP 文档和 REFACTORING_PLAN.md 中的 Biome 引用 - 89 个测试全部通过,ESLint + Prettier 检查均通过 Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
- 将 REFACTORING_PLAN.md 移至 docs/2026-04-01/ - 将 docs/sop/ 移至 docs/2026-04-01/sop/ - 更新所有文档内部交叉引用 - 更新 .npmignore 排除 docs/ 目录(发布包不含文档) Co-authored-by: M4ster <monkeym4ster@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
将 WhatsWeb 从 Node.js + CommonJS + JavaScript 全面重构为 Bun + TypeScript + ESM 架构。
测试结果
重构前 vs 重构后
架构变更
新目录结构
已删除文件
index.js,whatsweb.js,utils.jsplugins/*.js(5 个旧插件文件)保持不变
rules/目录 (所有规则文件完全不变)-f,-c,--network,--timeout,--user-agent,-o,--show-error)提交历史
chore: Phase 1— Bun 项目初始化、TS/Biome 配置feat: Phase 2— 工具层 TDD (url/dns/ip/http/concurrency)feat: Phase 3— 插件类型定义与加载器 (Zod 验证)feat: Phase 4— 基础插件 TDD (base-info/email/geoip)feat: Phase 5— Wappalyzer 插件 (wappalyzer@6.10.66)feat: Phase 6— BBScan 插件 (rule-parser/scanner/p-limit/Zod)feat: Phase 7— 核心扫描引擎 Scannerfeat: Phase 8— CLI + Reporterfeat: Phase 9— 集成测试、清理、文档更新