0.1.9
supports a breaking change in cargo
that converts artifact names from kebab-case
to snake_case
.
The release of Neon 1.0 marks our commitment to backwards-compatibility: starting with 1.0.0, Neon users can be confident that future upgrades to Neon 1.x versions should never require code changes (with the possible exception of safety bugfixes, which we expect to be rare). We also do not anticipate releasing new major versions often and do not have any plans to do so for now.
- Remove the generic parameter from
JsFunction
(neon-bindings#989) JsArray::new
takes ausize
instead of au32
(neon-bindings#988)- Made
Context::global
read a key and addedContext::global_object
(neon-bindings#987) - Deprecated feature flags were removed
- Fix
unhandledRejection
withJsPromise::to_future
(neon-bindings#1008) - Typo in
cargo-cp-artifact
help (neon-bindings#998) - Typo in README (neon-bindings#1012)
- Relaxed error behavior on missing Node-API symbols. Neon will panic on first use instead of aborting the process at module load time.
- Bumped dependency versions
- Changed to edition 2021
- Updated support matrix to Node 18, 20, and 21
Patch to enable new features flags in docs.rs.
- Removed
Managed
trait
- Added
JsBigInt
(neon-bindings#963). - Added UTF-16 functions to
JsString
(neon-bindings#944). - Relaxed
Send
constraints (neon-bindings#979) - Lifecycle support for 32-bit (neon-bindings#977)
- Added
sys
feature (neon-bindings#970)
- Fix a scope leak in release builds (neon-bindings#952).
- Examples added for many types ((neon-bindings#942)).
0.1.8
fixes sending additional arguments on Windows (neon-bindings#972).
Trait neon::object::This
has been removed. This
was primarily added for use with the declare_types!
macro to generate classes. The macro was removed and This
is no longer needed. Additionally, the This
argument on JsFunction
was found to be invalid because it asserted at compile time a type for this
that could change at runtime. (Note that this was not unsound because the type would be checked by Node-API and result in a panic
.)
JsFunction::this
was changed to perform a downcast and be fallible. This is in line with similar APIs (e.g., Object::get
). Additionally, an infallible version, JsValue::this_value
was added that does not perform a downcast.
Electron began using pointer compression on JavaScript values that is incompatible with external buffers. As a preventative measure, JsArrayBuffer::external
and JsBuffer::external
have been placed behind a feature flag that warns of Electron incompatibility.
- Lifetimes were relaxed on
execute_scoped
to allow valid code to compile. (neon-bindings#919) - Added a
from_slice
helper onTypedArray
(neon-bindings#925) JsTypedArray
construction and type aliases (neon-bindings#909)
- Fixed a panic on VM shutdown when using
Channel
(neon-bindings#934) - Type tags were added to
JsBox
to prevent undefined behavior when multiple native add-ons are used (neon-bindings#907)
- Significantly improved documentation of
TypedArray
(neon-bindings#909) - Removed unused values in
Channel
docs (neon-bindings#925)
0.1.7
includes a fix to unlink .node
files before copying to address common code signing errors on macOS (neon-bindings#921).
Pre-release of a major milestone for Neon. 1.0.
- Removed the legacy backend; only Node-API is supported going forward (neon-bindings#881)
- Removed
neon::result::JsResultExt
in favor of more generalneon::result::ResultExt
(neon-bindings#904)
- Length APIs (
argument
,argument_ops
,len
) useusize
instead ofi32
(neon-bindings#889) - Deprecate feature flags for accepted RFCs (neon-bindings#872)
neon::meta::version
returnssemver@1
version instead of0.9
(neon-bindings#912)
- Add
Object.freeze
andObject.seal
(neon-bindings#891) - Futures RFC (neon-bindings#872) Implementation (neon-bindings#874)
- Await
JoinHandle
from sending an event on aChannel
- Adapt
JsPromise
toJsFuture
- Await
- API for thread-local data (i.e., instance data) (neon-bindings#902)
- Add Object::call_with() convenience method to call a method on an object (neon-bindings#879)
- Relax the lifetime constraints on
TypedArray
borrows (neon-bindings#877) - Allowing missing symbols at load time to support bun (neon-bindings#914)
- Prevent a panic when an async event is called after the JavaScript runtime has stopped (neon-bindings#913)
- Fix a soundness hole in
JsArrayBuffer::external
andJsBuffer::external
(neon-bindings#897)
- Fixed mistake in
Object::get
docs (neon-bindings#903) - Fixed link in README to migration guide (neon-bindings#895)
- Moved
cargo-cp-artirfact
into the monorepo (neon-bindings#905) - Decreased the size of the Neon build matrix (neon-bindings#893)
- Removed scope abstraction from legacy backend (neon-bindings#888)
- Improved the monorepo structure of neon (neon-bindings#884)
Fix a soundness hole in JsArrayBuffer::external
and JsBuffer::external
(neon-bindings#897).
Thanks to @Cassy343 for finding the issue!
In previous versions of Neon, it was possible to create a JsArrayBuffer
or JsBuffer
that references data without the 'static
lifetime.
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)
}
See the Neon 0.10 Migration Guide for more details about new features and breaking changes.
- New buffer borrowing API
- Added JoinHandle for
Channel::send
JsPromise
andTaskBuilder
- Handle panics and exceptions in Channels and Tasks
- Function call / construct builders and simplify low level call
- Create functions from closures
- Performance improvements
- Rename N-API to Node-API in docs to match Node changes
- Remove unused cslice dependency
- Switch to
syn-mid
for faster compile times - Downcast in
Object::get
- Added migration guide
- Added
Object::get_opt
andObject::get_value
- [Safety] Make it harder to store and forge Throw
- [Soundness] Make
JsValue
types!Copy
- [Soundness] Tag
Root
with instance id create-neon
no longer leaves partial project on disk- Fix legacy backend on Electron and Windows
- FreeBSD support on legacy backend
- Replace Electron tests with Playwright
- Re-organize Neon into an npm workspace
- Fix crates.io badge
- Doc test fixes
- Fix broken link in the README
- Expose the
Finalize
trait asneon::types::Finalize
so that docs are visible - Improved docs and build scripts in
create-neon
to make release builds more discoverable (neon-bindings#771) - Update
nan
to fix an Electron 13 incompatibility (neon-bindings#778)
Channel
, formerly EventQueue
, 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
), calling cx.channel()
will return a shared queue (neon-bindings#739).
The change may cause a performance regression in some pathological use cases (neon-bindings#762).
EventQueue
and EventQueueError
have been renamed to Channel
and ChannelError
respectively to clarify their function and similarity to Rust channels. The types are available as deprecated aliases (neon-bindings#752).
- Document error causes for
Channel::try_send
docs (neon-bindings#767) - Document
neon::object
(neon-bindings#740)
- Fix usage of a removed API in legacy buffers (neon-bindings#769)
- Fix crash caused by non-thread safety in napi_threadsafefunction on early termination (neon-bindings#744)
- Fix memory leak in
Root
(neon-bindings#750)
- More docs improvements
- Added a deprecation warning to
neon new
(neon-bindings#722)
- Fix
legacy-backend
for Node 16 (neon-bindings#715) - Various docs improvements
as_slice
andas_mut_slice
properly handle anull
pointer from an empty buffer (neon-bindings#681)- Global drop queue added to avoid panics on N-API 6+ when dropping a
Root
(neon-bindings#700)
- Added
neon::reflect::eval
(neon-bindings#692) - Added
create-neon
for creating an N-API project (neon-bindings#690) - Added details to the
README.md
generated bycreate-neon
(neon-bindings#697)
- Switched N-API tests to
cargo-cp-artifact
(neon-bindings#687) - Added
impl<T: Finalize> Finalize for Option<T>
(neon-bindings#680) - Added a N-API migration guide (neon-bindings#685)
- Lint fixes (neon-bindings#609)
- Lint CI enforcement and
cargo fmt
(neon-bindings#698)
- Added
JsDate
to N-API backend (neon-bindings#639) - Implement
JsBuffer::unitialized
for N-API backend (neon-bindings#664)
- Do not panic if a
Root
is leaked after the event loop has stopped (neon-bindings#677) - Stubs for features that will not be implemented in the N-API backend are removed (neon-bindings#663)
- Fix doc URL link (neon-bindings#663)
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 panic
message will inform the user.
A prerelease version of EventQueue
for calling into the main JavaScript thread from Rust threads can be enabled with the event-queue-api
feature flag. The API is considered unstable and may change in the future until the RFC is merged.
The cx.try_catch(..)
API has been updated to return T: Sized
instead of T: Value
(neon-bindings#631). This API is strictly more powerful and allows users to return both JavaScript and Rust values from try_catch
closures.
- N-API symbols are now loaded dynamically (neon-bindings#646)
- Build process for N-API is greatly simplified by leveraging dynamic loading (neon-bindings#647)
Upgrade node-gyp
(neon-bindings#623)
- Fix Windows Node 15
- Fix Apple M1
Added neon::main
macro as a replacement for register_module!
(neon-bindings#636)
Builds occassionally fail with Windows, Node 15 and npm 7 (neon-bindings#642)
Added support for additional arguments passed to cargo build
. Resolves neon-bindings#471.
neon build --release -- --features awesome
- Improved arguments performance
- Add redirect and
NPM_CONFIG_DISTURL
support
smallvec
is used for collecting arguments and yields a small performance gain when callingJsFunction
Thanks to @staltz, neon now builds for both iOS and Android with nodejs-mobile.
Re-publish
Versions 0.4.1
and 0.4.2
included a breaking change in neon-runtime
. At the time, this was considered acceptable because neon-runtime
is considered an internal crate and not part of the public API. However, it was discovered, after publishing, that neon-serde
, a commonly used crate in the neon
ecosystem, contained a direct dependency on neon-runtime
. In order to best support users, versions 0.4.1
and 0.4.2
were "yanked" and re-published as 0.5.0
.
Additionally, the team is working with the authors of neon-serde
to remove the dependency on neon-runtime
to prevent future issues.
- Fix stack overflow in
DowncastError
Display
impl (neon-bindings#606)
Unpublished / Yanked
- Fix memory leak and race condition in
EventHandler
Unpublished / Yanked
Added the cx.try_catch
API of RFC 29. This feature is behind the try-catch-api
feature flag.
- Pass
async_context
tonode::MakeCallback
(neon-bindings#498) - Cache bust neon if node version changes (neon-bindings#388)
- Fix debug builds in windows (neon-bindings#400)
- Fix cross compiling architectures (neon-bindings#491)
- Fix neon new hanging on Windows (neon-bindings#537)
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.
The EventHandler
API is a new feature for scheduling work on the javascript main thread from other threads. Big thanks to @geovie for the RFC and implementation.
This feature is currently unstable and gated by a event-handler-api
feature flag.
- New project template updated for Rust 2018
- Workaround for nodejs/node-gyp#1933
- Docs build fixed
- Temporarily disable static tests which keep breaking CI
- Context/Isolate threading
- Scopes
- Strings
- Primitive values (numbers, undefined, null, boolean)
Hot fix for neon build
in projects with many dependencies.
- Disable node module registration on test build, allowing
cargo test
to be used on neon modules - Added support for alternate
CARGO_TARGET_DIR
locations (e.g., workspaces) - Added macros to
neon::prelude
to improve ergonomics in Rust 2018 - Link
win_delay_hook
when building withelectron-build-env
, fixing Windows Electron - Fixed missing
__cxa_pure_virtual
on Linux - Copy native files into
OUT_DIR
and build there to fixcargo publish
and follow best practices - Eliminated
mem::uniitialized()
usage, reducing warnings and fixing an instance of undefined behavior
The macOS link arguments were moved from neon-cli
to neon-build
. This is more idiomatic, but makes neon-build
required for macOS builds where it was unnecessary before.
Since neon-build
has been included in the project template since 0.1
this change was not deemed significant enough to warrant a major revision.
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-runtime
andn-api
feature flags for toggling neon runtime - Moved the legacy runtime to
nodejs-sys
crate - Stubbed required
n-api
implementation - Added
feature
flag toneon-cli
to help configuringn-api
projects
- Build v0.3 project templates by default in the CLI
- Correctly fail the build if custom build command fails
- Fix breaking changes with v8
GetFunction
- Moved
nan
fromdevDependencies
todependencies
inneon-runtime
- Changed neon crate type from
dylib
tocdylib
- Ensure that neon module loading is not optimized away
- Added support for
CARGO_BUILD_TARGET
environment variable
See the Neon 0.2 Migration Guide for documentation on migrating your projects from the Neon 0.1.x series to Neon 0.2, and please let us know if you need help!
- Release automation (#318)
- New
ArrayBuffer
views API -- see RFC 5 (#306) - VM 2.0 -- see RFC 14 (#306)
- New
JsString
constructor -- see RFC 21 (#322) - Eliminated
JsInteger
,JsVariant
,callee()
-- see RFC 22 (#323) - Renamed
Key
toPropertyKey
and its method names -- see RFC 22 (#323) - Module reorganization -- see RFC 20 (#324)
- New
JsError
API -- see RFC 23 (#325) - Eliminated
ToJsString
API -- see RFC 22 (#326) - Eliminated
NEON_NODE_ABI
env var -- see RFC 22 (#327) - Default to release builds -- see RFC 22 (#328)
- Made
Buffer
construction safe by default (#329, #331) - Made
Throw
not implementstd::error::Error
to avoid accidental suppression, thanks to @kjvalencik (#334) - Fixed a bug causing unnecessary rebuilds, thanks to @kjvalencik (#343)
- Fixed a soundness bug in the
Task
API, thanks to @kjvalencik (#335)
- Optimization in
Scope
structures, thanks to @maciejhirsz (#282) - Fixed a memory leak in the
Task
API, thanks to @kjvalencik (#291) - Add support for Node 10, thanks to @mhsjlw and @nomadtechie (#314)
- Reinstate
JsInteger
(although it's deprecated) for now, to be removed in 0.2. (#279)
- Fix a bug that was causing annoying unnecessary rebuilds (#242).
- New API for getting the global object (#249).
- Background task API (#214).
- Fixes to Windows builds (#221, #227), thanks to @hone's tenacious troubleshooting.
- TypeScript upgrade fixes (neon-bindings/neon-cli#62, neon-bindings/neon-cli#65).
- CLI bugfix (neon-bindings/neon-cli#59).
- JsArrayBuffer (#210).
- CLI bugfix (neon-bindings/neon-cli#57).
- CLI bugfix (neon-bindings/neon-cli#56).
- Better Electron support in CLI's build process.
- Better support for Electron via the artifacts file (neon-bindings/neon-cli#52).
- Ensure failing tests break the build (#191)
- Catch Rust panics and convert them to JS exceptions (#192)
- Implement
Error
forThrow
(#201) - Clean up the CLI and allow
neon build
to optionally take module names (neon-bindings/neon-cli#48).
- More robust build scripts for neon-runtime, fixing Homebrew node installations (see #189)
- Optimized rooting protocol
- Eliminate rustc warnings
- Lots of internal API docs
- Windows support! 🎉
- Renamed
neon-sys
toneon-runtime
- Depend on
neon-build
as a build dependency (see neon-bindings/neon-cli#46).
- Exposed
This
trait to allow user-level abstractions involvingFunctionCall
- Bump version to match Neon so they can be kept in sync from now on.
- Generate a
build.rs
to make Windows work (see neon-bindings/neon-cli#42 and neon-bindings/neon-cli#44).
- Added
JsError
API with support for throwing all standard error types - Test harness and CI integration!! 🎉 🎉 🎉
- API to call JS functions from Rust
- API to new JS functions from Rust
- Added generalized
as_slice
andas_mut_slice
methods toCSlice
API. - Fixed a soundness issue with Locks.
- The
JsTypeError
type is gone, and replaced by the more generalJsError
type. neon::js::error::JsTypeError::throw(msg)
is nowneon::js::error::JsError::throw(neon::js::error::kind::TypeError, msg)