This commit is contained in:
Yulong Wang 2018-05-01 18:58:32 -07:00
Родитель 1d621cebcb 621ae944ef
Коммит 5488dab8bd
8 изменённых файлов: 34 добавлений и 16 удалений

Просмотреть файл

@ -1,11 +1,11 @@
language: node_js
node_js:
- '9.2.1'
- '8.9.4'
- '7'
- '6'
- '5'
- '4'
- '6'
- '7'
- '8'
- '9'
- '10'
os:
- linux
- osx

Просмотреть файл

@ -13,11 +13,21 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set symbol visibility to hidden by default.
# Napa shared library shares a few classes with napa-binding.node with different compile definition,
# exposing the same symbols from both shared libraries may cause improper behaviors under gcc.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN)
if (NOT WIN32 AND NOT APPLE)
# Set symbol visibility to hidden by default.
# Napa shared library shares a few classes with napa-binding.node with different compile definition,
# exposing the same symbols from both shared libraries may cause improper behaviors under gcc.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN)
# Prevent symbol relocations internal to our wrapper library to be overwritten by the application.
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
# Mark object non-lazy runtime binding.
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,now")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,now")
endif ()
# Build napa shared library.
add_subdirectory(src)

Просмотреть файл

@ -7,11 +7,11 @@ environment:
matrix:
- nodejs_version: 4
- nodejs_version: 5
- nodejs_version: 6
- nodejs_version: 7
- nodejs_version: 8
- nodejs_version: 9
- nodejs_version: 10
platform:
- x64

Просмотреть файл

@ -27,9 +27,15 @@ namespace v8_helpers {
}
/// <summary> JSON.parse </summary>
#if (V8_MINOR_VERSION >= 6)
inline v8::MaybeLocal<v8::Value> Parse(v8::Local<v8::Context> context, const v8::Local<v8::String>& jsonString) {
return v8::JSON::Parse(context, jsonString);
}
#else
inline v8::MaybeLocal<v8::Value> Parse(const v8::Local<v8::String>& jsonString) {
return v8::JSON::Parse(jsonString);
}
#endif
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "napajs",
"description": "Napa.js is a multi-threaded JavaScript runtime built on V8",
"version": "0.2.2",
"version": "0.2.3",
"author": "napajs",
"main": "./lib/index.js",
"types": "./types/index.d.ts",

Просмотреть файл

@ -44,7 +44,7 @@ void LockWrap::GuardSyncCallback(const v8::FunctionCallbackInfo<v8::Value>& args
auto holder = args.Holder();
auto thisObject = NAPA_OBJECTWRAP::Unwrap<LockWrap>(args.Holder());
v8::TryCatch tryCatch;
v8::TryCatch tryCatch(isolate);
try {
auto mutex = thisObject->Get<std::mutex>();
std::lock_guard<std::mutex> guard(*mutex);

Просмотреть файл

@ -46,7 +46,7 @@ bool JavascriptModuleLoader::TryGet(const std::string& path, v8::Local<v8::Value
_moduleCache.Upsert(path, module_loader_helpers::ExportModule(moduleContext->Global(), nullptr));
}
v8::TryCatch tryCatch;
v8::TryCatch tryCatch(isolate);
{
auto origin = v8::ScriptOrigin(v8_helpers::MakeV8String(isolate, path));
auto script = v8::Script::Compile(source, &origin);

Просмотреть файл

@ -341,10 +341,12 @@ describe('napajs/transport', () => {
let builtinTestGroup = 'Transport built-in objects';
let nodeVersionMajor = parseInt(process.versions.node.split('.')[0]);
if (nodeVersionMajor >= 9) {
// TODO #223: Fix transportation support for builtin types, which is broken due to breaking changes of v8 introduced from node v10.0.0.
if (nodeVersionMajor == 9) {
describe(builtinTestGroup, transportBuiltinObjects);
} else {
describe.skip(builtinTestGroup, transportBuiltinObjects);
require('npmlog').warn(builtinTestGroup, 'This test group is skipped since it requires node v9.0.0 or above.');
require('npmlog').warn(builtinTestGroup, 'This test group is skipped since it requires node v9.0.0 .');
}
});