Skip to content

原生模块移植与重新编译任务追踪 Issue #1

@sanchuanhehe

Description

@sanchuanhehe

⚠️ 原生模块移植与重新编译任务追踪 Issue

❓问题描述

为适配最新的 鸿蒙 Electron 版本,我们发现以下原生 Node.js 模块(.node 扩展)由于依赖特定 V8 ABI 版本且依赖特定c/cpp运行时,无法直接在 Electron 环境中运行,必须重新编译这些模块以兼容目标运行时。


✅ 模块清单

以下是我们需要重新移植编译的 .node 插件列表(包括原生绑定文件):

# 模块名称 GitHub 地址 当前已知用途 编译要求
1 sqlite3 https://github.com/microsoft/vscode-node-sqlite3 数据持久化 Node API / Electron 适配
2 spdlog https://github.com/microsoft/node-spdlog 高性能日志 Node.js C++ API 兼容性
3 vscode-deviceid https://github.com/microsoft/vscode-deviceid 获取设备唯一标识 ?
4 policy-watcher https://github.com/microsoft/vscode-policy-watcher.git 监控 Windows 组策略
5 native-is-elevated https://github.com/arkon/native-is-elevated.git 检查是否管理员权限
6 kerberos https://github.com/mongodb-js/kerberos Kerberos 认证模块 多平台适配
7 node-pty https://github.com/microsoft/node-pty Pseudo Terminal 支持 支持终端模拟器
8 native-keymap https://github.com/Microsoft/node-native-keymap.git 键盘映射管理 Electron 渲染层支持
9 native-watchdog https://github.com/Microsoft/node-native-watchdog.git 性能检测/看门狗
10 watcher https://github.com/parcel-bundler/watcher.git 文件系统监控
11 windows-foreground-love https://github.com/the-ress/node-windows-foreground-love.git Windows 前台进程处理
12 js-debug https://github.com/microsoft/vscode-js-debug VS Code 内建调试器 部分原生组件集成

🗃 任务分配建议

模块名 状态 推荐负责人 说明 难度 依赖环境
sqlite3 已完成 C++ 熟练 修复或升级 binding.gyp ⭐⭐⭐ Node.js + SQLite dev 包
spdlog 待开始 日志专家 引入 spdlog v1.8.0 最新 ⭐⭐⭐⭐ C++17 + spdlog 源码集成
native-pty 部分完成 终端/SSH 通常已有 electron-patch ⭐⭐⭐⭐ pty API, Unix + WinCon
kerberos 待开始 安全认证模块 需要 Kerberos SDK ⭐⭐⭐⭐ GSSAPI + Heimdal 或 MIT
watcher 待开始 文件观察 macOS 实现复杂 ⭐⭐⭐ FSEvents + inotify
windows-foreground-love 待开始 Win32 开发 需测试管理员权限行为 ⭐⭐ Windows SDK
native-keymap 已集成(Electron) 可参考已有 推荐使用 napi ⭐⭐ V8/N-API
js-debug 高优先级 调试器 前端+原生支持 ⭐⭐⭐⭐⭐ TypeScript + Electron 适配
deviceid 待开始 系统模块 需验证是否为纯 JS 文件
native-is-elevated 待完成 管理员权限模块 Windows Only ⭐⭐ Win32 API
policy-watcher 待开始 策略管理 企业版支持 ⭐⭐ Windows Only
native-watchdog 待开始 性能模块 需适配新版 Node ABI ⭐⭐⭐ Node API 稳定性检查

🔧 排期与优先级建议

优先级 模块名 原因
P0 node-pty、sqltie3、spdlog、watcher、js-debug VS Code、IDE 核心模块,直接影响终端功能
P1 native-is-elevated、native-keymap、deviceid UI 功能支持、权限控制
P2 kerberos、watcher、windows-foreground-love 企业/安全模块
P3 policy-watcher、native-watchdog 辅助或监控模块,可延迟

📌 后续建议

  1. ✅ 搭建本地构建环境脚本(build.sh, build.ps1
  2. ✅ 自动化 CI/CD 集成(GitHub Actions / Azure DevOps)(暂时有些困难)
  3. ✅ 构建出 .node 后统一托管(私有 npm / artifact server)?
  4. ✅ 每个模块维护 rebuild 文档(README.build.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions