Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
test:
timeout-minutes: 30
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -60,6 +60,13 @@ jobs:
- name: Install dependencies
run: |
npm install
# node-gyp@12 (from package.json) supports Visual Studio 2026, but only
# node-gyp@13 emits the linker options that Node.js 26 builds require
# (older node-gyp trips LNK1117 on '/opt:lldltojobs'). Upgrade in place for
# Node.js >= 26; other versions keep node-gyp@12.
- name: Use node-gyp@13 for Node.js >= 26
if: matrix.node-version == '26.x'
run: npm install --no-save node-gyp@13
- name: npm test
shell: bash
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
test:
timeout-minutes: 30
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -55,6 +55,11 @@ jobs:
- name: Install dependencies
run: |
npm install
# Node.js >= 26 requires node-gyp@13; older versions keep node-gyp@12
# (from package.json).
- name: Use node-gyp@13 for Node.js >= 26
if: matrix.node-version == '26.x'
run: npm install --no-save node-gyp@13
- name: npm test
run: |
if [ "${{ matrix.api_version }}" = "experimental" ]; then
Expand Down
33 changes: 33 additions & 0 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4681,48 +4681,71 @@ template <typename T>
template <typename InstanceWrap<T>::InstanceVoidMethodCallback method>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod(
const char* utf8name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// MSVC (as of v145 / Visual Studio 2026) raises an internal compiler error
// (C1001) when a pointer-to-member-function is used as a non-type template
// parameter, as the static compile-time dispatch below does. On MSVC, fall
// back to the runtime overload, which passes `method` as a value instead.
return InstanceMethod(utf8name, method, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = details::TemplatedInstanceVoidCallback<T, method>;
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
template <typename InstanceWrap<T>::InstanceMethodCallback method>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod(
const char* utf8name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// See the note in the InstanceMethod overload above.
return InstanceMethod(utf8name, method, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = details::TemplatedInstanceCallback<T, method>;
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
template <typename InstanceWrap<T>::InstanceVoidMethodCallback method>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod(
Symbol name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// See the note in the InstanceMethod overload above.
return InstanceMethod(name, method, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.name = name;
desc.method = details::TemplatedInstanceVoidCallback<T, method>;
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
template <typename InstanceWrap<T>::InstanceMethodCallback method>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod(
Symbol name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// See the note in the InstanceMethod overload above.
return InstanceMethod(name, method, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.name = name;
desc.method = details::TemplatedInstanceCallback<T, method>;
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
Expand Down Expand Up @@ -4768,27 +4791,37 @@ template <typename InstanceWrap<T>::InstanceGetterCallback getter,
typename InstanceWrap<T>::InstanceSetterCallback setter>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceAccessor(
const char* utf8name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// See the note in the InstanceMethod overload above.
return InstanceAccessor(utf8name, getter, setter, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.getter = details::TemplatedInstanceCallback<T, getter>;
desc.setter = This::WrapSetter(This::SetterTag<setter>());
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
template <typename InstanceWrap<T>::InstanceGetterCallback getter,
typename InstanceWrap<T>::InstanceSetterCallback setter>
inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceAccessor(
Symbol name, napi_property_attributes attributes, void* data) {
#ifdef _MSC_VER
// See the note in the InstanceMethod overload above.
return InstanceAccessor(name, getter, setter, attributes, data);
#else
napi_property_descriptor desc = napi_property_descriptor();
desc.name = name;
desc.getter = details::TemplatedInstanceCallback<T, getter>;
desc.setter = This::WrapSetter(This::SetterTag<setter>());
desc.data = data;
desc.attributes = attributes;
return desc;
#endif
}

template <typename T>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"eslint": "^9.13.0",
"fs-extra": "^11.1.1",
"neostandard": "^0.12.0",
"node-gyp": "^12.4.0",
"pre-commit": "^1.2.2",
"semver": "^7.6.0"
},
Expand Down
Loading