RELEASES.md
cargo-cp-artifact0.1.9 supports a breaking change in cargo that converts artifact names from kebab-case to snake_case.
Deferred::settle() and Deferred::try_settle()Our strong commitment to compatibility since the 1.0 release remains unchanged. New functionality that has not yet stabilized is published under feature flags, so the only breaking changes that we expect to publish are those that affect the unstable features, or, as always, safety bugfixes.
Hotfix for Node-API versions lower than 5 (https://github.com/neon-bindings/neon/pull/1106).
FromArgs impl on T: TryFromJs and add cx.{arg, arg_opt} (https://github.com/neon-bindings/neon/pull/1096)With (https://github.com/neon-bindings/neon/pull/1086)JsBox::{deref, as_inner} to get long-lived reference to JsBox contents (https://github.com/neon-bindings/neon/pull/1087)TryIntoJs and TryFromJs take Cx instead of generic Context (https://github.com/neon-bindings/neon/pull/1062)Result types in #[export] (https://github.com/neon-bindings/neon/pull/1057)Cx instead of generic Context (https://github.com/neon-bindings/neon/pull/1048)With for TryIntoJs (https://github.com/neon-bindings/neon/pull/1059)#[export] (https://github.com/neon-bindings/neon/pull/1055)TryIntoJs and TryFromJs for common container types (https://github.com/neon-bindings/neon/pull/1066)Cx in exported functions (https://github.com/neon-bindings/neon/pull/1068)#[export] macro (https://github.com/neon-bindings/neon/pull/1025)npm init neon --lib (https://github.com/neon-bindings/neon/pull/1014 and https://github.com/neon-bindings/neon/pull/1041)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.
JsFunction (https://github.com/neon-bindings/neon/pull/989)JsArray::new takes a usize instead of a u32 (https://github.com/neon-bindings/neon/pull/988)Context::global read a key and added Context::global_object (https://github.com/neon-bindings/neon/pull/987)unhandledRejection with JsPromise::to_future (https://github.com/neon-bindings/neon/pull/1008)cargo-cp-artifact help (https://github.com/neon-bindings/neon/pull/998)https://github.com/neon-bindings/neon/pull/1010
Patch to enable new features flags in docs.rs.
Managed traitJsBigInt (https://github.com/neon-bindings/neon/pull/963).JsString (https://github.com/neon-bindings/neon/pull/944).Send constraints (https://github.com/neon-bindings/neon/pull/979)sys feature (https://github.com/neon-bindings/neon/pull/970)cargo-cp-artifact0.1.8 fixes sending additional arguments on Windows (https://github.com/neon-bindings/neon/pull/972).
neon::object::Thishttps://github.com/neon-bindings/neon/pull/918
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::thishttps://github.com/neon-bindings/neon/pull/918
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.
https://github.com/neon-bindings/neon/pull/937
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.
execute_scoped to allow valid code to compile. (https://github.com/neon-bindings/neon/pull/919)from_slice helper on TypedArray (https://github.com/neon-bindings/neon/pull/925)JsTypedArray construction and type aliases (https://github.com/neon-bindings/neon/pull/909)Channel (https://github.com/neon-bindings/neon/pull/934)JsBox to prevent undefined behavior when multiple native add-ons are used (https://github.com/neon-bindings/neon/pull/907)TypedArray (https://github.com/neon-bindings/neon/pull/909)Channel docs (https://github.com/neon-bindings/neon/pull/925)cargo-cp-artifact0.1.7 includes a fix to unlink .node files before copying to address common code signing errors on macOS (https://github.com/neon-bindings/neon/pull/921).
Pre-release of a major milestone for Neon. 1.0.
neon::result::JsResultExt in favor of more general neon::result::ResultExt (https://github.com/neon-bindings/neon/pull/904)argument, argument_ops, len) use usize instead of i32 (https://github.com/neon-bindings/neon/pull/889)neon::meta::version returns semver@1 version instead of 0.9 (https://github.com/neon-bindings/neon/pull/912)Object.freeze and Object.seal (https://github.com/neon-bindings/neon/pull/891)JoinHandle from sending an event on a ChannelJsPromise to JsFutureTypedArray borrows (https://github.com/neon-bindings/neon/pull/877)JsArrayBuffer::external and JsBuffer::external (https://github.com/neon-bindings/neon/pull/897)Object::get docs (https://github.com/neon-bindings/neon/pull/903)cargo-cp-artirfact into the monorepo (https://github.com/neon-bindings/neon/pull/905)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::sendJsPromise and TaskBuildersyn-mid for faster compile timesObject::getObject::get_opt and Object::get_valueJsValue types !CopyRoot 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 JsFunctionThanks 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
EventHandlerUnpublished / 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 projectsGetFunctionnan from devDependencies to dependencies in neon-runtimedylib to cdylibCARGO_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-runtimeneon-build as a build dependency (see neon-bindings/neon-cli#46).This trait to allow user-level abstractions involving FunctionCallbuild.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)