- 用C++实现了Node.js的常用API接口
- 底层使用libuv, 支持事件驱动、非阻塞IO
- 实现了几个Node.js项目中被大量依赖的第三库
- 使用方式基本上和Node.js保持一致,开发过程中可直接参考Node.js的API文档
- 大量使用了C++11中的lambda,动态参数模版等特性,目前只在VS2015中编译通过
- 最新的Node.js已经不支持xp系统
- Node.js目前在前端容易遭到破解
- Node.js本身的尺寸较大,安装包在11M左右
// fs
fs.readFile(filePath, [](const Buffer& buf) {
...
});
- buffer
- core-math // js内置的math库
- child_process
- crypto
- dns
- fs
- http
- net
- os
- stream
- path
- process
- querystring
- thread
- timers
- url
- zlib
- lodash
- underscore.string
- moment
- iconv
- file-url
- commander
- later
- semver
- winreg
- keyboard-code-trans
- 字符串转键盘虚拟键值
灵感来自于Electron
- wm-code-trans
- WindowsMessage转字符串
- pe-cert
- 用于检测程序的数字签名
- shm
- 共享内存
- dll-util
- 包装了对dll的一些常用操作,如获取dll的绝对路径
- detours-hooker
- 包装了detours,方便hooker api,启动进程前注入dll
- ini
- 包装了ini文件的解析
- singleton
- 单例的包装类
- std-redex-ex
- 扩展了std::regex_replace
支持formart回调
- 需提前编译Detours.lib放入
nmake
- 需安装CMake,并为glog3生成工程
cmake -G "Visual Studio 14"
- 需安装gyp
gyp --depth=. xxx.gyp
- 在deps目录,下载各个模块
git clone -b 1.2 https://github.com/KjellKod/g3log.git
git clone -b v2.7.0 https://github.com/nodejs/http-parser.git
git clone -b v1.2.8 https://github.com/madler/zlib.git
git clone -b release-1.7.0 https://github.com/google/googletest.git gtest
- 生成VS工程
- g3log -> cmake
- http-parser -> gyp
- zlib -> cmake
- openssl -> gyp
- libuv -> vcbuild.bat
- gtest -> cmake
- Output Directory:
$(SolutionDir)bin$ (Configuration)\ - Intermediate Directory:
$(SolutionDir)bin\obj$ (Configuration)$(ProjectName)\ - C/C++ => General => Additional Include Directory
../deps/uv
- VC++ Directories => Library Directories
$(SolutionDir)bin/$ (Configuration)/lib