diff --git a/doc/api/n-api.md b/doc/api/n-api.md index e3e3242ef321bb..9d8874b8b062be 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2,7 +2,7 @@ -> 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-inl.h b/src/env-inl.h index 4b6f147f64778c..e856b0fea65b90 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -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 diff --git a/src/env.cc b/src/env.cc index e105fcd7c57ef1..e6788249d8c230 100644 --- a/src/env.cc +++ b/src/env.cc @@ -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 promise, v8::Local parent) { diff --git a/src/env.h b/src/env.h index 15eacdb54fa139..1e4e798bfd3df2 100644 --- a/src/env.h +++ b/src/env.h @@ -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. @@ -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 destroy_async_id_list_; diff --git a/src/node.cc b/src/node.cc index 694497eb0a4093..ddd99b00aa9c67 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2666,12 +2666,9 @@ static void DLOpen(const FunctionCallbackInfo& 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), diff --git a/src/node_api.cc b/src/node_api.cc index b0456811bfb1dd..6990d1ccd904cf 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 #include #include // INT_MAX diff --git a/src/node_api.h b/src/node_api.h index d2a0886d5a058c..aaf002b7584449 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 a44593e2518c24..00000000000000 --- 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 c82008435fd8fd..00000000000000 --- 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 d0821be1f2268d..00000000000000 --- a/test/addons-napi/test_warning/test_warning.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#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 3c8ee9db01390b..00000000000000 --- a/test/addons-napi/test_warning/test_warning2.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#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)