-
Notifications
You must be signed in to change notification settings - Fork 64
Switch addon to N-API with prebuildify toolchain (2.0.0-beta) #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mathiask88
wants to merge
13
commits into
master
Choose a base branch
from
napi-rewrite
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build and packaging - replace NAN include with node-addon-api target and disable deprecated APIs - enforce no-exceptions builds per platform (linux/freebsd/mac/win) while keeping hidden visibility flags - keep snap7 secondary target, enabling exceptions where needed on native sources - add node-gyp-build loader (binding.js) to resolve local builds or prebuilds - move package.json to 2.0.0-beta with exports map (CJS/ESM/types) and .d.ts entry - raise engines to >=18; switch runtime dep to node-gyp-build - replace prebuild/install flow with prebuildify/prebuildify-ci/prebuildify-cross scripts - add devDeps for node-addon-api, node-gyp, and prebuildify toolchain; update rebuild/test/download scripts JavaScript API - route native binding through node-gyp-build; export both CJS and ESM entry points - wrap S7Server with EventEmitter using util.inherits - generate client methods that return promises with optional callback bridges - add Sync variants calling underscore-prefixed native methods - recreate DB/MB/EB/AB/TM/CT helpers for async/sync read/write with optional db number - update copyright headers to 2025 Types - add lib/node-snap7.d.ts defining Snap7Error, client/server methods, areas/word lengths, and helper shapes - ensure exports map points to types for TS consumers Addon entry - convert module init from NAN to NODE_API_MODULE using Napi::Env/Napi::Object exports - register S7Client/S7Server via N-API init functions Native client - port NAN class wrapper to N-API (ObjectWrap/DefineClass) with StaticValue constant exports - update constructors/destructors and mutex handling for N-API - switch method signatures to Napi::CallbackInfo, throw Napi::TypeError on bad args - promise-returning methods with internal sync variants for ReadArea/WriteArea/MultiVars/etc. - rewrite Upload/FullUpload/Download to allocate buffers via N-API and return JS buffers - move shared helpers into new node_snap7_helpers.h; drop Nan::To and legacy buffer helpers - refresh error/enum exports to StaticValue instead of prototype templates Native server - port server wrapper from NAN templates to N-API DefineClass - export server constants via StaticValue; align method bindings to N-API signatures - update constructor/registration and status handling for N-API - keep snap7 server setup and callbacks consistent with new wrapper types Headers/helpers - add node_snap7_helpers.h for shared conversions/buffer helpers - update client/server headers for N-API class declarations and exports ESM support - add lib/node-snap7.mjs as ESM entry that re-exports the CJS binding Notes - large deletions come from removing NAN scaffolding in favor of N-API - promise-first API remains callback-compatible via optional last-arg callback
- add Node/Electron test runner scripts with runtime version logging - update npm scripts and .npmignore to use new runners - run Electron tests on Ubuntu CI (AppArmor tweak + xvfb) - clarify README testing section for Node vs Electron suites
Drop LastError bindings and state; rely on thrown/rejected Snap7Error instead.
…stency in Promise and callback return types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
lib/node-snap7.{js,mjs,d.ts}) via exports map