neon-runtime
Bindings to the Node.js native addon API, used by the Neon implementation.
0.10.1
6.6M downloads/mo
#3933 most downloaded on crates.io
neon-bindings/neon
What this package is like to depend on
Last release 4 years ago
no release in 18 months
Ships fairly regularly
a new release about every 5 weeks
Most releases are documented
notes for 28 of 32 stable releases
4 versions withdrawn
withdrawn after publishing
10 years old
39 releases · first in 2017
0 releases in the last 12 months
see the full history below
Release timeline
39 releases · Feb 2017 to May 2022Releases
latest 39-
0.10.123 May 2022Release notes
Open source →Fix a soundness hole in
JsArrayBuffer::external
andJsBuffer::external(#897).Thanks to @Cassy343 for finding the issue!
In previous versions of Neon, it was possible to create a
JsArrayBufferorJsBufferthat references data without the'staticlifetime.pub fn soundness_hole(mut cx: FunctionContext) -> JsResult<JsArrayBuffer> { let mut data = vec![0u8, 1, 2, 3]; // Creating an external from `&mut [u8]` instead of `Vec<u8>` since there is a blanket impl // of `AsMut<T> for &mut T` let buf = JsArrayBuffer::external(&mut cx, data.as_mut_slice()); // `buf` is still holding a reference to `data`! drop(data); Ok(buf) }
Release notes
Open source →Fix a soundness hole in
JsArrayBuffer::externalandJsBuffer::external(https://github.com/neon-bindings/neon/pull/897).Thanks to @Cassy343 for finding the issue!
In previous versions of Neon, it was possible to create a
JsArrayBufferorJsBufferthat references data without the'staticlifetime.pub fn soundness_hole(mut cx: FunctionContext) -> JsResult<JsArrayBuffer> { let mut data = vec![0u8, 1, 2, 3]; // Creating an external from `&mut [u8]` instead of `Vec<u8>` since there is a blanket impl // of `AsMut<T> for &mut T` let buf = JsArrayBuffer::external(&mut cx, data.as_mut_slice()); // `buf` is still holding a reference to `data`! drop(data); Ok(buf) } -
0.10.007 Mar 2022Nothing published for this version
-
0.10.0-alpha.308 Dec 2021 pre-releaseNothing published for this version
-
0.10.0-alpha.217 Sep 2021 pre-releaseNothing published for this version
-
0.10.0-alpha.130 Aug 2021 pre-releaseNothing published for this version
-
0.10.0-alpha.030 Aug 2021 pre-release withdrawnNothing published for this version
-
0.9.126 Aug 2021Release notes
Open source →- Expose the
Finalizetrait asneon::types::Finalizeso that docs are visible - Improved docs and build scripts in
create-neonto make release builds more discoverable (https://github.com/neon-bindings/neon/pull/771) - Update
nanto fix an Electron 13 incompatibility (https://github.com/neon-bindings/neon/pull/778)
- Expose the
-
0.9.026 Jul 2021Release notes
Open source →Performance
Channel, formerlyEventQueue, are now cloneable. Clones share a backing queue to take advantage of an optimization in Node threadsafe functions. Additionally, when specifying Node API 6 or higher (napi-6), callingcx.channel()will return a shared queue (https://github.com/neon-bindings/neon/pull/739).The change may cause a performance regression in some pathological use cases (https://github.com/neon-bindings/neon/issues/762).
Deprecation
EventQueueandEventQueueErrorhave been renamed toChannelandChannelErrorrespectively to clarify their function and similarity to Rust channels. The types are available as deprecated aliases (https://github.com/neon-bindings/neon/pull/752).Docs
- Document error causes for
Channel::try_senddocs (https://github.com/neon-bindings/neon/pull/767) - Document
neon::object(https://github.com/neon-bindings/neon/pull/740)
Fixes
- Fix usage of a removed API in legacy buffers (https://github.com/neon-bindings/neon/pull/769)
- Document error causes for
-
0.8.302 Jun 2021Release notes
Open source →- Fix crash caused by non-thread safety in napi_threadsafefunction on early termination (https://github.com/neon-bindings/neon/pull/744)
- Fix memory leak in
Root(https://github.com/neon-bindings/neon/pull/750)
-
0.8.218 May 2021Release notes
Open source →- More docs improvements
- Added a deprecation warning to
neon new(https://github.com/neon-bindings/neon/pull/722)
-
0.8.130 Apr 2021Release notes
Open source →- Fix
legacy-backendfor Node 16 (https://github.com/neon-bindings/neon/pull/715) - Various docs improvements
- Fix
-
0.8.023 Mar 2021Release notes
Open source →Fixes
as_sliceandas_mut_sliceproperly handle anullpointer from an empty buffer (https://github.com/neon-bindings/neon/pull/681)- Global drop queue added to avoid panics on N-API 6+ when dropping a
Root(https://github.com/neon-bindings/neon/pull/700)
Features
- Added
neon::reflect::eval(https://github.com/neon-bindings/neon/pull/692) - Added
create-neonfor creating an N-API project (https://github.com/neon-bindings/neon/pull/690) - Added details to the
README.mdgenerated bycreate-neon(https://github.com/neon-bindings/neon/pull/697)
Improvements
- Switched N-API tests to
cargo-cp-artifact(https://github.com/neon-bindings/neon/pull/687) - Added
impl<T: Finalize> Finalize for Option<T>(https://github.com/neon-bindings/neon/pull/680) - Added a N-API migration guide (https://github.com/neon-bindings/neon/pull/685)
Housekeeping
- Lint fixes (https://github.com/neon-bindings/neon/pull/609)
- Lint CI enforcement and
cargo fmt(https://github.com/neon-bindings/neon/pull/698)
-
0.7.104 Feb 2021Release notes
Open source →Features
- Added
JsDateto N-API backend (https://github.com/neon-bindings/neon/pull/639) - Implement
JsBuffer::unitializedfor N-API backend (https://github.com/neon-bindings/neon/pull/664)
Fixes
- Do not panic if a
Rootis leaked after the event loop has stopped (https://github.com/neon-bindings/neon/pull/677) - Stubs for features that will not be implemented in the N-API backend are removed (https://github.com/neon-bindings/neon/pull/663)
- Fix doc URL link (https://github.com/neon-bindings/neon/pull/663)
- Added
-
0.7.005 Jan 2021Release notes
Open source →N-API
Version Selection
Neon supports a large number of different Node versions which may have different N-API requirements. Neon now supports selecting the minimum required N-API version required by a module. For example, for N-API Version 4:
neon = { version = "0.7", default-features = false, features = ["napi-4"] }If the Neon module is loaded in an older version of Node that does not support that N-API version, a
panicmessage will inform the user.Threadsafe Functions
A prerelease version of
EventQueuefor calling into the main JavaScript thread from Rust threads can be enabled with theevent-queue-apifeature flag. The API is considered unstable and may change in the future until the RFC is merged. -
0.6.009 Dec 2020Release notes
Open source →The
cx.try_catch(..)API has been updated to returnT: Sizedinstead ofT: Value(https://github.com/neon-bindings/neon/pull/631). This API is strictly more powerful and allows users to return both JavaScript and Rust values fromtry_catchclosures.N-API
- N-API symbols are now loaded dynamically (https://github.com/neon-bindings/neon/pull/646)
- Build process for N-API is greatly simplified by leveraging dynamic loading (https://github.com/neon-bindings/neon/pull/647)
-
0.5.324 Nov 2020Release notes
Open source →Bug Fixes
Upgrade
node-gyp(https://github.com/neon-bindings/neon/pull/623)- Fix Windows Node 15
- Fix Apple M1
Features
Added
neon::mainmacro as a replacement forregister_module!(https://github.com/neon-bindings/neon/pull/636)Known Issues
Builds occassionally fail with Windows, Node 15 and npm 7 (https://github.com/neon-bindings/neon/issues/642)
-
0.5.216 Nov 2020Release notes
Open source →CLI
Added support for additional arguments passed to
cargo build. Resolves https://github.com/neon-bindings/neon/issues/471.neon build --release -- --features awesomeN-API
- Improved arguments performance
- Add redirect and
NPM_CONFIG_DISTURLsupport
-
0.5.128 Oct 2020Release notes
Open source →Performance
smallvecis used for collecting arguments and yields a small performance gain when callingJsFunction
Broader Support
Thanks to @staltz, neon now builds for both iOS and Android with nodejs-mobile.
-
0.5.012 Oct 2020Release notes
Open source →Re-publish
Versions
0.4.1and0.4.2included a breaking change inneon-runtime. At the time, this was considered acceptable becauseneon-runtimeis considered an internal crate and not part of the public API. However, it was discovered, after publishing, thatneon-serde, a commonly used crate in theneonecosystem, contained a direct dependency onneon-runtime. In order to best support users, versions0.4.1and0.4.2were "yanked" and re-published as0.5.0.Additionally, the team is working with the authors of
neon-serdeto remove the dependency onneon-runtimeto prevent future issues.Bug Fixes
- Fix stack overflow in
DowncastErrorDisplayimpl (https://github.com/neon-bindings/neon/pull/606)
- Fix stack overflow in
-
0.4.223 Sep 2020 withdrawnRelease notes
Open source →Unpublished / Yanked
Bug Fixes
- Fix memory leak and race condition in
EventHandler
- Fix memory leak and race condition in
-
0.4.118 Sep 2020 withdrawnRelease notes
Open source →Unpublished / Yanked
Features
Try Catch
Added the
cx.try_catchAPI of RFC 29. This feature is behind thetry-catch-apifeature flag.Bug Fixes
- Pass
async_contexttonode::MakeCallback(https://github.com/neon-bindings/neon/pull/498) - Cache bust neon if node version changes (https://github.com/neon-bindings/neon/pull/388)
- Fix debug builds in windows (https://github.com/neon-bindings/neon/pull/400)
- Fix cross compiling architectures (https://github.com/neon-bindings/neon/pull/491)
- Fix neon new hanging on Windows (https://github.com/neon-bindings/neon/pull/537)
CI Improvements
The Neon Project now uses Github Actions thanks to @lhr0909! As part of this change, CI now runs on all of our supported platforms (macOS, Windows, linux) and Node versions.
- Pass
-
0.4.014 Feb 2020Nothing published for this version
-
0.3.322 Oct 2019 -
0.3.218 Oct 2019Release notes
Open source →Bug fixes and Small Features
- Disable node module registration on test build, allowing
cargo testto be used on neon modules - Added support for alternate
CARGO_TARGET_DIRlocations (e.g., workspaces) - Added macros to
neon::preludeto improve ergonomics in Rust 2018 - Link
win_delay_hookwhen building withelectron-build-env, fixing Windows Electron - Fixed missing
__cxa_pure_virtualon Linux - Copy native files into
OUT_DIRand build there to fixcargo publishand follow best practices - Eliminated
mem::uniitialized()usage, reducing warnings and fixing an instance of undefined behavior
Potentially Breaking
The macOS link arguments were moved from
neon-clitoneon-build. This is more idiomatic, but makesneon-buildrequired for macOS builds where it was unnecessary before.Since
neon-buildhas been included in the project template since0.1this change was not deemed significant enough to warrant a major revision.N-API
Neon 0.3.2 lays the groundwork for the next major revision. Development of Neon against an ABI stable Node API (N-API) will occur on main.
- Added
legacy-runtimeandn-apifeature flags for toggling neon runtime - Moved the legacy runtime to
nodejs-syscrate - Stubbed required
n-apiimplementation - Added
featureflag toneon-clito help configuringn-apiprojects
- Disable node module registration on test build, allowing
-
0.3.122 Aug 2019 -
0.3.022 Aug 2019Nothing published for this version
-
0.2.025 Jul 2018Nothing published for this version
-
0.1.2303 Jun 2018Release notes
Open source →- Optimization in
Scopestructures, thanks to @maciejhirsz (#282) - Fixed a memory leak in the
TaskAPI, thanks to @kjvalencik (#291) - Add support for Node 10, thanks to @mhsjlw and @nomadtechie (#314)
- Optimization in
-
0.1.2224 Nov 2017Release notes
Open source →- Reinstate
JsInteger(although it's deprecated) for now, to be removed in 0.2. (#279)
- Reinstate
-
0.1.2114 Nov 2017 withdrawnRelease notes
Open source →- Fix a bug that was causing annoying unnecessary rebuilds (#242).
- New API for getting the global object (#249).
-
0.1.2023 Aug 2017 -
0.1.1911 Aug 2017Release notes
Open source →- TypeScript upgrade fixes (neon-bindings/neon-cli#62, neon-bindings/neon-cli#65).
-
0.1.1828 May 2017 -
0.1.1708 May 2017 -
0.1.1606 May 2017 -
0.1.1522 Apr 2017Release notes
Open source →- Better Electron support in CLI's build process.
- Better support for Electron via the artifacts file (neon-bindings/neon-cli#52).
-
0.1.1402 Apr 2017Release notes
Open source →- Ensure failing tests break the build (#191)
- Catch Rust panics and convert them to JS exceptions (#192)
- Implement
ErrorforThrow(#201) - Clean up the CLI and allow
neon buildto optionally take module names (neon-bindings/neon-cli#48).
-
0.1.1320 Feb 2017Release notes
Open source →- More robust build scripts for neon-runtime, fixing Homebrew node installations (see #189)
-
0.1.1217 Feb 2017Release notes
Open source →- Optimized rooting protocol
- Eliminate rustc warnings
- Lots of internal API docs
- Windows support! :tada:
- Renamed
neon-systoneon-runtime - Depend on
neon-buildas a build dependency (see neon-bindings/neon-cli#46).