Skip to content

Commit

Permalink
n-api: take n-api out of experimental
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mhdawson authored and rvagg committed Aug 16, 2018
1 parent c92d66a commit 0b2f527
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 85 deletions.
2 changes: 1 addition & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

> Stability: 1 - Experimental
> Stability: 2 - Stable

N-API (pronounced N as in the letter, followed by API)
is an API for building native Addons. It is independent from
Expand Down
1 change: 0 additions & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ inline Environment::Environment(IsolateData* isolate_data,
printed_error_(false),
trace_sync_io_(false),
abort_on_uncaught_exception_(false),
emit_napi_warning_(true),
makecallback_cntr_(0),
scheduled_immediate_count_(isolate_, 1),
#if HAVE_INSPECTOR
Expand Down
6 changes: 0 additions & 6 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,6 @@ bool Environment::RemovePromiseHook(promise_hook_func fn, void* arg) {
return true;
}

bool Environment::EmitNapiWarning() {
bool current_value = emit_napi_warning_;
emit_napi_warning_ = false;
return current_value;
}

void Environment::EnvPromiseHook(v8::PromiseHookType type,
v8::Local<v8::Promise> promise,
v8::Local<v8::Value> parent) {
Expand Down
2 changes: 0 additions & 2 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ class Environment {

void AddPromiseHook(promise_hook_func fn, void* arg);
bool RemovePromiseHook(promise_hook_func fn, void* arg);
bool EmitNapiWarning();

typedef void (*native_immediate_callback)(Environment* env, void* data);
// cb will be called as cb(env, data) on the next event loop iteration.
Expand Down Expand Up @@ -720,7 +719,6 @@ class Environment {
bool printed_error_;
bool trace_sync_io_;
bool abort_on_uncaught_exception_;
bool emit_napi_warning_;
size_t makecallback_cntr_;
std::vector<double> destroy_async_id_list_;

Expand Down
9 changes: 3 additions & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2666,12 +2666,9 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
env->ThrowError("Module did not self-register.");
return;
}
if (mp->nm_version == -1) {
if (env->EmitNapiWarning()) {
ProcessEmitWarning(env, "N-API is an experimental feature and could "
"change at any time.");
}
} else if (mp->nm_version != NODE_MODULE_VERSION) {

// -1 is used for N-API modules
if ((mp->nm_version != -1) && (mp->nm_version != NODE_MODULE_VERSION)) {
char errmsg[1024];
snprintf(errmsg,
sizeof(errmsg),
Expand Down
10 changes: 0 additions & 10 deletions src/node_api.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
/******************************************************************************
* Experimental prototype for demonstrating VM agnostic and ABI stable API
* for native modules to use instead of using Nan and V8 APIs directly.
*
* The current status is "Experimental" and should not be used for
* production applications. The API is still subject to change
* and as an experimental feature is NOT subject to semver.
*
******************************************************************************/

#include <node_buffer.h>
#include <node_object_wrap.h>
#include <limits.h> // INT_MAX
Expand Down
9 changes: 0 additions & 9 deletions src/node_api.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/******************************************************************************
* Experimental prototype for demonstrating VM agnostic and ABI stable API
* for native modules to use instead of using Nan and V8 APIs directly.
*
* The current status is "Experimental" and should not be used for
* production applications. The API is still subject to change
* and as an experimental feature is NOT subject to semver.
*
******************************************************************************/
#ifndef SRC_NODE_API_H_
#define SRC_NODE_API_H_

Expand Down
12 changes: 0 additions & 12 deletions test/addons-napi/test_warning/binding.gyp

This file was deleted.

16 changes: 0 additions & 16 deletions test/addons-napi/test_warning/test.js

This file was deleted.

11 changes: 0 additions & 11 deletions test/addons-napi/test_warning/test_warning.c

This file was deleted.

11 changes: 0 additions & 11 deletions test/addons-napi/test_warning/test_warning2.c

This file was deleted.

0 comments on commit 0b2f527

Please sign in to comment.