1 Star 0 Fork 14

xu_ping/node-gyp

forked from src-openEuler/node-gyp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix-addon-test-for-Node.js-12-and-v8.patch 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
xu_ping 提交于 2023-02-10 17:11 . fix test error
From e6699d13cdcd6abe543b250f4297808912a4a188 Mon Sep 17 00:00:00 2001
From: Richard Lau <riclau@uk.ibm.com>
Date: Tue, 2 Apr 2019 19:42:13 +0100
Subject: [PATCH] test: fix addon test for Node.js 12 and V8 7.4
V8 7.4 removes some API functions. Replace those with their NAN
counterparts.
PR-URL: https://github.com/nodejs/node-gyp/pull/1705
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
---
test/node_modules/hello_world/hello.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/test/node_modules/hello_world/hello.cc b/test/node_modules/hello_world/hello.cc
index 89bfd7ac04..ea724e896c 100644
--- a/test/node_modules/hello_world/hello.cc
+++ b/test/node_modules/hello_world/hello.cc
@@ -1,12 +1,11 @@
#include <nan.h>
-void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+NAN_METHOD(Method) {
info.GetReturnValue().Set(Nan::New("world").ToLocalChecked());
}
-void Init(v8::Local<v8::Object> exports) {
- exports->Set(Nan::New("hello").ToLocalChecked(),
- Nan::New<v8::FunctionTemplate>(Method)->GetFunction());
+NAN_MODULE_INIT(Init) {
+ Nan::SetMethod(target, "hello", Method);
}
NODE_MODULE(hello, Init)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cherry530/node-gyp.git
git@gitee.com:cherry530/node-gyp.git
cherry530
node-gyp
node-gyp
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385