Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/js_native_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,6 @@
#include <stdbool.h> // NOLINT(modernize-deprecated-headers)
#include <stddef.h> // NOLINT(modernize-deprecated-headers)

// Use INT_MAX, this should only be consumed by the pre-processor anyway.
#define NAPI_VERSION_EXPERIMENTAL 2147483647
#ifndef NAPI_VERSION
#ifdef NAPI_EXPERIMENTAL
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
#else
// The baseline version for N-API.
// The NAPI_VERSION controls which version will be used by default when
// compilling a native addon. If the addon developer specifically wants to use
// functions available in a new version of N-API that is not yet ported in all
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
// depended on that version.
#define NAPI_VERSION 8
#endif
#endif

#if defined(NAPI_EXPERIMENTAL) && \
!defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \
!defined(NODE_WANT_INTERNALS)
#ifdef _MSC_VER
#pragma message("NAPI_EXPERIMENTAL is enabled. " \
"Experimental features may be unstable.")
#else
#warning "NAPI_EXPERIMENTAL is enabled. " \
"Experimental features may be unstable."
#endif
#endif

#include "js_native_api_types.h"

// If you need __declspec(dllimport), either include <node_api.h> instead, or
Expand Down
28 changes: 28 additions & 0 deletions src/js_native_api_types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
#ifndef SRC_JS_NATIVE_API_TYPES_H_
#define SRC_JS_NATIVE_API_TYPES_H_

// Use INT_MAX, this should only be consumed by the pre-processor anyway.
#define NAPI_VERSION_EXPERIMENTAL 2147483647
#ifndef NAPI_VERSION
#ifdef NAPI_EXPERIMENTAL
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
#else
// The baseline version for N-API.
// The NAPI_VERSION controls which version will be used by default when
// compilling a native addon. If the addon developer specifically wants to use
// functions available in a new version of N-API that is not yet ported in all
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
// depended on that version.
#define NAPI_VERSION 8
#endif
#endif

#if defined(NAPI_EXPERIMENTAL) && \
!defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \
!defined(NODE_WANT_INTERNALS)
#ifdef _MSC_VER
#pragma message("NAPI_EXPERIMENTAL is enabled. " \
"Experimental features may be unstable.")
#else
#warning "NAPI_EXPERIMENTAL is enabled. " \
"Experimental features may be unstable."
#endif
#endif

// This file needs to be compatible with C compilers.
// This is a public include file, and these includes have essentially
// became part of it's API.
Expand Down
4 changes: 0 additions & 4 deletions src/node_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ struct uv_loop_s; // Forward declaration.
#define NAPI_NO_RETURN
#endif

typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env,
napi_value exports);
typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void);

// Used by deprecated registration method napi_module_register.
typedef struct napi_module {
int nm_version;
Expand Down
4 changes: 4 additions & 0 deletions src/node_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include "js_native_api_types.h"

typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env,
napi_value exports);
typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void);

typedef struct napi_callback_scope__* napi_callback_scope;
typedef struct napi_async_context__* napi_async_context;
typedef struct napi_async_work__* napi_async_work;
Expand Down
Loading