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

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 committed Mar 14, 2018
1 parent 040dd24 commit cd7d7b1
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 88 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
7 changes: 0 additions & 7 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Environment::Environment(IsolateData* isolate_data,
printed_error_(false),
trace_sync_io_(false),
abort_on_uncaught_exception_(false),
emit_napi_warning_(true),
emit_env_nonstring_warning_(true),
makecallback_cntr_(0),
should_abort_on_uncaught_toggle_(isolate_, 1),
Expand Down Expand Up @@ -350,12 +349,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 @@ -725,7 +725,6 @@ class Environment {

void AddPromiseHook(promise_hook_func fn, void* arg);
bool RemovePromiseHook(promise_hook_func fn, void* arg);
bool EmitNapiWarning();
inline bool EmitProcessEnvWarning() {
bool current_value = emit_env_nonstring_warning_;
emit_env_nonstring_warning_ = false;
Expand Down Expand Up @@ -784,7 +783,6 @@ class Environment {
bool printed_error_;
bool trace_sync_io_;
bool abort_on_uncaught_exception_;
bool emit_napi_warning_;
bool emit_env_nonstring_warning_;
size_t makecallback_cntr_;
std::vector<double> destroy_async_id_list_;
Expand Down
11 changes: 2 additions & 9 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2286,15 +2286,8 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
return;
}

if (mp->nm_version == -1) {
if (env->EmitNapiWarning()) {
if (ProcessEmitWarning(env, "N-API is an experimental feature and could "
"change at any time.").IsNothing()) {
dlib.Close();
return;
}
}
} 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 cd7d7b1

Please sign in to comment.