summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dawson <michael_dawson@ca.ibm.com>2018-03-09 12:07:37 -0500
committerMichael Dawson <michael_dawson@ca.ibm.com>2018-03-14 17:12:58 -0400
commitcd7d7b15c1eeccfe2facdf9a671034d93b6bf467 (patch)
treeb38192f388500549afd3de9370e3a2561fbf83fc
parent040dd244de14f51b4757c25311164e36f72238c3 (diff)
downloadnode-new-cd7d7b15c1eeccfe2facdf9a671034d93b6bf467.tar.gz
n-api: take n-api out of experimental
Take n-api out of experimental as per: https://github.com/nodejs/TSC/issues/501 PR-URL: https://github.com/nodejs/node/pull/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>
-rw-r--r--doc/api/n-api.md2
-rw-r--r--src/env.cc7
-rw-r--r--src/env.h2
-rw-r--r--src/node.cc11
-rw-r--r--src/node_api.cc10
-rw-r--r--src/node_api.h9
-rw-r--r--test/addons-napi/test_warning/binding.gyp12
-rw-r--r--test/addons-napi/test_warning/test.js16
-rw-r--r--test/addons-napi/test_warning/test_warning.c11
-rw-r--r--test/addons-napi/test_warning/test_warning2.c11
10 files changed, 3 insertions, 88 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index d67d428051..5b36479cae 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -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
diff --git a/src/env.cc b/src/env.cc
index 913f0e865b..36a3612a78 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -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),
@@ -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) {
diff --git a/src/env.h b/src/env.h
index e6060b9e6f..c778e7ba11 100644
--- a/src/env.h
+++ b/src/env.h
@@ -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;
@@ -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_;
diff --git a/src/node.cc b/src/node.cc
index c03c753c37..ede8314924 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -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),
diff --git a/src/node_api.cc b/src/node_api.cc
index 63ce1d8e86..bb027822f1 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -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
diff --git a/src/node_api.h b/src/node_api.h
index e9b3645e40..791a8f8725 100644
--- a/src/node_api.h
+++ b/src/node_api.h
@@ -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_
diff --git a/test/addons-napi/test_warning/binding.gyp b/test/addons-napi/test_warning/binding.gyp
deleted file mode 100644
index a44593e251..0000000000
--- a/test/addons-napi/test_warning/binding.gyp
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "targets": [
- {
- "target_name": "test_warning",
- "sources": [ "test_warning.c" ]
- },
- {
- "target_name": "test_warning2",
- "sources": [ "test_warning2.c" ]
- }
- ]
-}
diff --git a/test/addons-napi/test_warning/test.js b/test/addons-napi/test_warning/test.js
deleted file mode 100644
index c82008435f..0000000000
--- a/test/addons-napi/test_warning/test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-if (process.argv[2] === 'child') {
- const common = require('../../common');
- console.log(require(`./build/${common.buildType}/test_warning`));
- console.log(require(`./build/${common.buildType}/test_warning2`));
-} else {
- const run = require('child_process').spawnSync;
- const assert = require('assert');
- const warning = 'Warning: N-API is an experimental feature and could ' +
- 'change at any time.';
-
- const result = run(process.execPath, [__filename, 'child']);
- assert.deepStrictEqual(result.stdout.toString().match(/\S+/g), ['42', '1337']);
- assert.deepStrictEqual(result.stderr.toString().split(warning).length, 2);
-}
diff --git a/test/addons-napi/test_warning/test_warning.c b/test/addons-napi/test_warning/test_warning.c
deleted file mode 100644
index d0821be1f2..0000000000
--- a/test/addons-napi/test_warning/test_warning.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <node_api.h>
-#include "../common.h"
-
-napi_value Init(napi_env env, napi_value exports) {
- napi_value result;
- NAPI_CALL(env,
- napi_create_uint32(env, 42, &result));
- return result;
-}
-
-NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)
diff --git a/test/addons-napi/test_warning/test_warning2.c b/test/addons-napi/test_warning/test_warning2.c
deleted file mode 100644
index 3c8ee9db01..0000000000
--- a/test/addons-napi/test_warning/test_warning2.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <node_api.h>
-#include "../common.h"
-
-napi_value Init(napi_env env, napi_value exports) {
- napi_value result;
- NAPI_CALL(env,
- napi_create_uint32(env, 1337, &result));
- return result;
-}
-
-NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)