The Neon Command-Line Tool
Automatically create and build Neon modules.
For more information, see the Neon home page!
Build and load native Rust/Neon modules.
Automatically create and build Neon modules.
For more information, see the Neon home page!
Fix a soundness hole in JsArrayBuffer::external
and JsBuffer::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 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.
Channel::send
JsPromise
and TaskBuilder
syn-mid
for faster compile timesObject::get
Object::get_opt
and Object::get_value
JsValue
types !Copy
Root
with instance idcreate-neon
no longer leaves partial project on diskFinalize
trait as neon::types::Finalize
so that docs are visiblecreate-neon
to make release builds more
discoverable (https://github.com/neon-bindings/neon/pull/771)nan
to fix an Electron 13 incompatibility (https://github.com/neon-bindings/neon/pull/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 (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).
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 (https://github.com/neon-bindings/neon/pull/752).
Channel::try_send
docs (https://github.com/neon-bindings/neon/pull/767)neon::object
(https://github.com/neon-bindings/neon/pull/740)Root
(https://github.com/neon-bindings/neon/pull/750)neon new
(https://github.com/neon-bindings/neon/pull/722)legacy-backend
for Node 16 (https://github.com/neon-bindings/neon/pull/715)as_slice
and as_mut_slice
properly handle a null
pointer from an empty buffer (https://github.com/neon-bindings/neon/pull/681)Root
(https://github.com/neon-bindings/neon/pull/700)neon::reflect::eval
(https://github.com/neon-bindings/neon/pull/692)create-neon
for creating an N-API project (https://github.com/neon-bindings/neon/pull/690)README.md
generated by create-neon
(https://github.com/neon-bindings/neon/pull/697)cargo-cp-artifact
(https://github.com/neon-bindings/neon/pull/687)impl<T: Finalize> Finalize for Option<T>
(https://github.com/neon-bindings/neon/pull/680)cargo fmt
(https://github.com/neon-bindings/neon/pull/698)JsDate
to N-API backend (https://github.com/neon-bindings/neon/pull/639)JsBuffer::unitialized
for N-API backend (https://github.com/neon-bindings/neon/pull/664)Root
is leaked after the event loop has stopped (https://github.com/neon-bindings/neon/pull/677)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
(https://github.com/neon-bindings/neon/pull/631). This API is strictly more powerful and allows users to return both JavaScript and Rust values from try_catch
closures.
Upgrade node-gyp
(https://github.com/neon-bindings/neon/pull/623)
Added neon::main
macro as a replacement for register_module!
(https://github.com/neon-bindings/neon/pull/636)
Builds occassionally fail with Windows, Node 15 and npm 7 (https://github.com/neon-bindings/neon/issues/642)
Added support for additional arguments passed to cargo build
. Resolves https://github.com/neon-bindings/neon/issues/471.
neon build --release -- --features awesome
NPM_CONFIG_DISTURL
supportsmallvec
is used for collecting arguments and yields a small performance gain when calling JsFunction
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.
DowncastError
Display
impl (https://github.com/neon-bindings/neon/pull/606)Unpublished / Yanked
EventHandler
Unpublished / Yanked
Added the cx.try_catch
API of RFC 29. This feature is behind the try-catch-api
feature flag.
async_context
to node::MakeCallback
(https://github.com/neon-bindings/neon/pull/498)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.
EventHandler
APIThe 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.
Hot fix for neon build
in projects with many dependencies.
cargo test
to be used on neon modulesCARGO_TARGET_DIR
locations (e.g., workspaces)neon::prelude
to improve ergonomics in Rust 2018win_delay_hook
when building with electron-build-env
, fixing Windows Electron__cxa_pure_virtual
on LinuxOUT_DIR
and build there to fix cargo publish
and follow best practicesmem::uniitialized()
usage, reducing warnings and fixing an instance of undefined behaviorThe 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.
legacy-runtime
and n-api
feature flags for toggling neon runtimenodejs-sys
craten-api
implementationfeature
flag to neon-cli
to help configuring n-api
projectsGetFunction
nan
from devDependencies
to dependencies
in neon-runtime
dylib
to cdylib
CARGO_BUILD_TARGET
environment variableSee 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!
ArrayBuffer
views API -- see RFC 5 (#306)JsString
constructor -- see RFC 21 (#322)JsInteger
, JsVariant
, callee()
-- see RFC 22 (#323)Key
to PropertyKey
and its method names -- see RFC 22 (#323)JsError
API -- see RFC 23 (#325)ToJsString
API -- see RFC 22 (#326)NEON_NODE_ABI
env var -- see RFC 22 (#327)Buffer
construction safe by default (#329, #331)Throw
not implement std::error::Error
to avoid accidental suppression, thanks to @kjvalencik (#334)Task
API, thanks to @kjvalencik (#335)Scope
structures, thanks to @maciejhirsz (#282)Task
API, thanks to @kjvalencik (#291)JsInteger
(although it's deprecated) for now, to be removed in 0.2. (#279)Error
for Throw
(#201)neon build
to optionally take module names (neon-bindings/neon-cli#48).neon-sys
to neon-runtime
neon-build
as a build dependency (see neon-bindings/neon-cli#46).This
trait to allow user-level abstractions involving FunctionCall
build.rs
to make Windows work (see neon-bindings/neon-cli#42 and neon-bindings/neon-cli#44).JsError
API with support for throwing all standard error typesas_slice
and as_mut_slice
methods to CSlice
API.JsTypeError
type is gone, and replaced by the more general JsError
type.neon::js::error::JsTypeError::throw(msg)
is now neon::js::error::JsError::throw(neon::js::error::kind::TypeError, msg)