Skip to content

Commit 35055a1

Browse files
mhdawsonMylesBorins
authored andcommitted
n-api: take n-api out of experimental
Take n-api out of experimental as per: nodejs/TSC#501 Backport-PR-URL: #21083 PR-URL: #19262 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 1613b0d commit 35055a1

File tree

11 files changed

+4
-85
lines changed

11 files changed

+4
-85
lines changed

doc/api/n-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!--introduced_in=v7.10.0-->
44

5-
> Stability: 1 - Experimental
5+
> Stability: 2 - Stable
66

77
N-API (pronounced N as in the letter, followed by API)
88
is an API for building native Addons. It is independent from

src/env-inl.h

-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ inline Environment::Environment(IsolateData* isolate_data,
318318
printed_error_(false),
319319
trace_sync_io_(false),
320320
abort_on_uncaught_exception_(false),
321-
emit_napi_warning_(true),
322321
makecallback_cntr_(0),
323322
scheduled_immediate_count_(isolate_, 1),
324323
#if HAVE_INSPECTOR

src/env.cc

-6
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,6 @@ bool Environment::RemovePromiseHook(promise_hook_func fn, void* arg) {
202202
return true;
203203
}
204204

205-
bool Environment::EmitNapiWarning() {
206-
bool current_value = emit_napi_warning_;
207-
emit_napi_warning_ = false;
208-
return current_value;
209-
}
210-
211205
void Environment::EnvPromiseHook(v8::PromiseHookType type,
212206
v8::Local<v8::Promise> promise,
213207
v8::Local<v8::Value> parent) {

src/env.h

-2
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ class Environment {
688688

689689
void AddPromiseHook(promise_hook_func fn, void* arg);
690690
bool RemovePromiseHook(promise_hook_func fn, void* arg);
691-
bool EmitNapiWarning();
692691

693692
typedef void (*native_immediate_callback)(Environment* env, void* data);
694693
// cb will be called as cb(env, data) on the next event loop iteration.
@@ -720,7 +719,6 @@ class Environment {
720719
bool printed_error_;
721720
bool trace_sync_io_;
722721
bool abort_on_uncaught_exception_;
723-
bool emit_napi_warning_;
724722
size_t makecallback_cntr_;
725723
std::vector<double> destroy_async_id_list_;
726724

src/node.cc

+3-6
Original file line numberDiff line numberDiff line change
@@ -2666,12 +2666,9 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
26662666
env->ThrowError("Module did not self-register.");
26672667
return;
26682668
}
2669-
if (mp->nm_version == -1) {
2670-
if (env->EmitNapiWarning()) {
2671-
ProcessEmitWarning(env, "N-API is an experimental feature and could "
2672-
"change at any time.");
2673-
}
2674-
} else if (mp->nm_version != NODE_MODULE_VERSION) {
2669+
2670+
// -1 is used for N-API modules
2671+
if ((mp->nm_version != -1) && (mp->nm_version != NODE_MODULE_VERSION)) {
26752672
char errmsg[1024];
26762673
snprintf(errmsg,
26772674
sizeof(errmsg),

src/node_api.cc

-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
/******************************************************************************
2-
* Experimental prototype for demonstrating VM agnostic and ABI stable API
3-
* for native modules to use instead of using Nan and V8 APIs directly.
4-
*
5-
* The current status is "Experimental" and should not be used for
6-
* production applications. The API is still subject to change
7-
* and as an experimental feature is NOT subject to semver.
8-
*
9-
******************************************************************************/
10-
111
#include <node_buffer.h>
122
#include <node_object_wrap.h>
133
#include <limits.h> // INT_MAX

src/node_api.h

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/******************************************************************************
2-
* Experimental prototype for demonstrating VM agnostic and ABI stable API
3-
* for native modules to use instead of using Nan and V8 APIs directly.
4-
*
5-
* The current status is "Experimental" and should not be used for
6-
* production applications. The API is still subject to change
7-
* and as an experimental feature is NOT subject to semver.
8-
*
9-
******************************************************************************/
101
#ifndef SRC_NODE_API_H_
112
#define SRC_NODE_API_H_
123

test/addons-napi/test_warning/binding.gyp

-12
This file was deleted.

test/addons-napi/test_warning/test.js

-16
This file was deleted.

test/addons-napi/test_warning/test_warning.c

-11
This file was deleted.

test/addons-napi/test_warning/test_warning2.c

-11
This file was deleted.

0 commit comments

Comments
 (0)