A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/c2f4d8d688 below:

define version 10 · nodejs/node@c2f4d8d · GitHub

File tree Expand file treeCollapse file tree 14 files changed

+46

-65

lines changed

Filter options

Expand file treeCollapse file tree 14 files changed

+46

-65

lines changed Original file line number Diff line number Diff line change

@@ -1748,7 +1748,7 @@ will not be freed. This can be avoided by calling

1748 1748 1749 1749

**Change History:**

1750 1750 1751 -

* Experimental (`NAPI_EXPERIMENTAL` is defined):

1751 +

* Version 10 (`NAPI_VERSION` is defined as `10` or higher):

1752 1752 1753 1753

References can be created for all value types. The new supported value

1754 1754

types do not support weak reference semantic and the values of these types

@@ -2700,10 +2700,9 @@ JavaScript `TypedArray` objects are described in

2700 2700 2701 2701

<!-- YAML

2702 2702

added: v23.0.0

2703 +

napiVersion: 10

2703 2704

-->

2704 2705 2705 -

> Stability: 1 - Experimental

2706 - 2707 2706

```c

2708 2707

napi_status NAPI_CDECL node_api_create_buffer_from_arraybuffer(napi_env env,

2709 2708

napi_value arraybuffer,

@@ -2965,10 +2964,9 @@ The JavaScript `string` type is described in

2965 2964

added:

2966 2965

- v20.4.0

2967 2966

- v18.18.0

2967 +

napiVersion: 10

2968 2968

-->

2969 2969 2970 -

> Stability: 1 - Experimental

2971 - 2972 2970

```c

2973 2971

napi_status

2974 2972

node_api_create_external_string_latin1(napi_env env,

@@ -3045,10 +3043,9 @@ The JavaScript `string` type is described in

3045 3043

added:

3046 3044

- v20.4.0

3047 3045

- v18.18.0

3046 +

napiVersion: 10

3048 3047

-->

3049 3048 3050 -

> Stability: 1 - Experimental

3051 - 3052 3049

```c

3053 3050

napi_status

3054 3051

node_api_create_external_string_utf16(napi_env env,

@@ -3140,10 +3137,9 @@ creation methods.

3140 3137

added:

3141 3138

- v22.9.0

3142 3139

- v20.18.0

3140 +

napiVersion: 10

3143 3141

-->

3144 3142 3145 -

> Stability: 1 - Experimental

3146 - 3147 3143

```c

3148 3144

napi_status NAPI_CDECL node_api_create_property_key_latin1(napi_env env,

3149 3145

const char* str,

@@ -3175,10 +3171,9 @@ The JavaScript `string` type is described in

3175 3171

added:

3176 3172

- v21.7.0

3177 3173

- v20.12.0

3174 +

napiVersion: 10

3178 3175

-->

3179 3176 3180 -

> Stability: 1 - Experimental

3181 - 3182 3177

```c

3183 3178

napi_status NAPI_CDECL node_api_create_property_key_utf16(napi_env env,

3184 3179

const char16_t* str,

@@ -3208,10 +3203,9 @@ The JavaScript `string` type is described in

3208 3203

added:

3209 3204

- v22.9.0

3210 3205

- v20.18.0

3206 +

napiVersion: 10

3211 3207

-->

3212 3208 3213 -

> Stability: 1 - Experimental

3214 - 3215 3209

```c

3216 3210

napi_status NAPI_CDECL node_api_create_property_key_utf8(napi_env env,

3217 3211

const char* str,

@@ -6531,7 +6525,7 @@ napi_create_threadsafe_function(napi_env env,

6531 6525 6532 6526

**Change History:**

6533 6527 6534 -

* Experimental (`NAPI_EXPERIMENTAL` is defined):

6528 +

* Version 10 (`NAPI_VERSION` is defined as `10` or higher):

6535 6529 6536 6530

Uncaught exceptions thrown in `call_js_cb` are handled with the

6537 6531

[`'uncaughtException'`][] event, instead of being ignored.

Original file line number Diff line number Diff line change

@@ -85,7 +85,7 @@ with:

85 85 86 86

```bash

87 87

grep \

88 -

-E \

88 +

-nHE \

89 89

'N(ODE_)?API_EXPERIMENTAL' \

90 90

src/js_native_api{_types,}.h \

91 91

src/node_api{_types,}.h

@@ -95,13 +95,13 @@ and update the define version guards with the release version:

95 95 96 96

```diff

97 97

- #ifdef NAPI_EXPERIMENTAL

98 -

+ #if NAPI_VERSION >= 10

98 +

+ #if NAPI_VERSION >= 11

99 99 100 100

NAPI_EXTERN napi_status NAPI_CDECL

101 101

node_api_function(napi_env env);

102 102 103 103

- #endif // NAPI_EXPERIMENTAL

104 -

+ #endif // NAPI_VERSION >= 10

104 +

+ #endif // NAPI_VERSION >= 11

105 105

```

106 106 107 107

Remove any feature flags of the form `NODE_API_EXPERIMENTAL_HAS_<FEATURE>`.

@@ -121,11 +121,11 @@ Also, update the Node-API version value of the `napi_get_version` test in

121 121

#### Step 2. Update runtime version guards

122 122 123 123

If this release includes runtime behavior version guards, the relevant commits

124 -

should already include `NAPI_VERSION_EXPERIMENTAL` guard for the change. Check

125 -

for these guards with:

124 +

should already include the `NAPI_VERSION_EXPERIMENTAL` guard for the change.

125 +

Check for these guards with:

126 126 127 127

```bash

128 -

grep NAPI_VERSION_EXPERIMENTAL src/js_native_api_v8* src/node_api.cc

128 +

grep -nH NAPI_VERSION_EXPERIMENTAL src/js_native_api_v8* src/node_api.cc

129 129

```

130 130 131 131

and substitute this guard version with the release version `x`.

@@ -138,7 +138,7 @@ Check for these definitions with:

138 138 139 139

```bash

140 140

grep \

141 -

-E \

141 +

-nHE \

142 142

'N(ODE_)?API_EXPERIMENTAL' \

143 143

test/node-api/*/{*.{h,c},binding.gyp} \

144 144

test/js-native-api/*/{*.{h,c},binding.gyp}

@@ -170,7 +170,7 @@ stability banner:

170 170

<!-- YAML

171 171

added:

172 172

- v1.2.3

173 -

+ napiVersion: 10

173 +

+ napiVersion: 11

174 174

-->

175 175 176 176

- > Stability: 1 - Experimental

@@ -186,7 +186,7 @@ For all runtime version guards updated in Step 2, check for these definitions

186 186

with:

187 187 188 188

```bash

189 -

grep NAPI_EXPERIMENTAL doc/api/n-api.md

189 +

grep -nH NAPI_EXPERIMENTAL doc/api/n-api.md

190 190

```

191 191 192 192

In `doc/api/n-api.md`, update the `experimental` change history item to be the

Original file line number Diff line number Diff line change

@@ -92,8 +92,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,

92 92

const char16_t* str,

93 93

size_t length,

94 94

napi_value* result);

95 -

#ifdef NAPI_EXPERIMENTAL

96 -

#define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS

95 +

#if NAPI_VERSION >= 10

97 96

NAPI_EXTERN napi_status NAPI_CDECL node_api_create_external_string_latin1(

98 97

napi_env env,

99 98

char* str,

@@ -110,17 +109,14 @@ node_api_create_external_string_utf16(napi_env env,

110 109

void* finalize_hint,

111 110

napi_value* result,

112 111

bool* copied);

113 -

#endif // NAPI_EXPERIMENTAL

114 112 115 -

#ifdef NAPI_EXPERIMENTAL

116 -

#define NODE_API_EXPERIMENTAL_HAS_PROPERTY_KEYS

117 113

NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_latin1(

118 114

napi_env env, const char* str, size_t length, napi_value* result);

119 115

NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf8(

120 116

napi_env env, const char* str, size_t length, napi_value* result);

121 117

NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf16(

122 118

napi_env env, const char16_t* str, size_t length, napi_value* result);

123 -

#endif // NAPI_EXPERIMENTAL

119 +

#endif // NAPI_VERSION >= 10

124 120 125 121

NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env,

126 122

napi_value description,

Original file line number Diff line number Diff line change

@@ -2753,7 +2753,7 @@ napi_status NAPI_CDECL napi_create_reference(napi_env env,

2753 2753

CHECK_ARG(env, result);

2754 2754 2755 2755

v8::Local<v8::Value> v8_value = v8impl::V8LocalValueFromJsValue(value);

2756 -

if (env->module_api_version != NAPI_VERSION_EXPERIMENTAL) {

2756 +

if (env->module_api_version < 10) {

2757 2757

if (!(v8_value->IsObject() || v8_value->IsFunction() ||

2758 2758

v8_value->IsSymbol())) {

2759 2759

return napi_set_last_error(env, napi_invalid_arg);

Original file line number Diff line number Diff line change

@@ -234,11 +234,11 @@ inline napi_status napi_set_last_error(node_api_basic_env basic_env,

234 234

CHECK_ENV_NOT_IN_GC((env)); \

235 235

RETURN_STATUS_IF_FALSE( \

236 236

(env), (env)->last_exception.IsEmpty(), napi_pending_exception); \

237 -

RETURN_STATUS_IF_FALSE((env), \

238 -

(env)->can_call_into_js(), \

239 -

(env->module_api_version == NAPI_VERSION_EXPERIMENTAL \

240 -

? napi_cannot_run_js \

241 -

: napi_pending_exception)); \

237 +

RETURN_STATUS_IF_FALSE( \

238 +

(env), \

239 +

(env)->can_call_into_js(), \

240 +

(env->module_api_version >= 10 ? napi_cannot_run_js \

241 +

: napi_pending_exception)); \

242 242

napi_clear_last_error((env)); \

243 243

v8impl::TryCatch try_catch((env))

244 244 Original file line number Diff line number Diff line change

@@ -93,11 +93,11 @@ void node_napi_env__::CallbackIntoModule(T&& call) {

93 93

return;

94 94

}

95 95

node::Environment* node_env = env->node_env();

96 -

// If the module api version is less than NAPI_VERSION_EXPERIMENTAL,

97 -

// and the option --force-node-api-uncaught-exceptions-policy is not

98 -

// specified, emit a warning about the uncaught exception instead of

99 -

// triggering uncaught exception event.

100 -

if (env->module_api_version < NAPI_VERSION_EXPERIMENTAL &&

96 +

// If the module api version is less than 10, and the option

97 +

// --force-node-api-uncaught-exceptions-policy is not specified, emit a

98 +

// warning about the uncaught exception instead of triggering the uncaught

99 +

// exception event.

100 +

if (env->module_api_version < 10 &&

101 101

!node_env->options()->force_node_api_uncaught_exceptions_policy &&

102 102

!enforceUncaughtExceptionPolicy) {

103 103

ProcessEmitDeprecationWarning(

@@ -678,11 +678,13 @@ node::addon_context_register_func get_node_api_context_register_func(

678 678

const char* module_name,

679 679

int32_t module_api_version) {

680 680

static_assert(

681 -

NODE_API_SUPPORTED_VERSION_MAX == 9,

681 +

NODE_API_SUPPORTED_VERSION_MAX == 10,

682 682

"New version of Node-API requires adding another else-if statement below "

683 683

"for the new version and updating this assert condition.");

684 684

if (module_api_version == 9) {

685 685

return node_api_context_register_func<9>;

686 +

} else if (module_api_version == 10) {

687 +

return node_api_context_register_func<10>;

686 688

} else if (module_api_version == NAPI_VERSION_EXPERIMENTAL) {

687 689

return node_api_context_register_func<NAPI_VERSION_EXPERIMENTAL>;

688 690

} else if (module_api_version >= NODE_API_SUPPORTED_VERSION_MIN &&

Original file line number Diff line number Diff line change

@@ -133,16 +133,15 @@ napi_create_external_buffer(napi_env env,

133 133

napi_value* result);

134 134

#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED

135 135 136 -

#ifdef NAPI_EXPERIMENTAL

137 -

#define NODE_API_EXPERIMENTAL_HAS_CREATE_BUFFER_FROM_ARRAYBUFFER

136 +

#if NAPI_VERSION >= 10

138 137 139 138

NAPI_EXTERN napi_status NAPI_CDECL

140 139

node_api_create_buffer_from_arraybuffer(napi_env env,

141 140

napi_value arraybuffer,

142 141

size_t byte_offset,

143 142

size_t byte_length,

144 143

napi_value* result);

145 -

#endif // NAPI_EXPERIMENTAL

144 +

#endif // NAPI_VERSION >= 10

146 145 147 146

NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer_copy(napi_env env,

148 147

size_t length,

Original file line number Diff line number Diff line change

@@ -100,7 +100,7 @@

100 100 101 101

// The NAPI_VERSION supported by the runtime. This is the inclusive range of

102 102

// versions which the Node.js binary being built supports.

103 -

#define NODE_API_SUPPORTED_VERSION_MAX 9

103 +

#define NODE_API_SUPPORTED_VERSION_MAX 10

104 104

#define NODE_API_SUPPORTED_VERSION_MIN 1

105 105 106 106

// Node API modules use NAPI_VERSION 8 by default if it is not explicitly

Original file line number Diff line number Diff line change

@@ -5,14 +5,14 @@

5 5

"sources": [

6 6

"test_cannot_run_js.c"

7 7

],

8 -

"defines": [ "NAPI_EXPERIMENTAL" ],

8 +

"defines": [ "NAPI_VERSION=10" ],

9 9

},

10 10

{

11 11

"target_name": "test_pending_exception",

12 12

"sources": [

13 13

"test_cannot_run_js.c"

14 14

],

15 -

"defines": [ "NAPI_VERSION=8" ],

15 +

"defines": [ "NAPI_VERSION=9" ],

16 16

}

17 17

]

18 18

}

Original file line number Diff line number Diff line change

@@ -22,7 +22,7 @@ static void Finalize(napi_env env, void* data, void* hint) {

22 22

// napi_pending_exception is returned). This is not deterministic from

23 23

// the point of view of the addon.

24 24 25 -

#ifdef NAPI_EXPERIMENTAL

25 +

#if NAPI_VERSION > 9

26 26

NODE_API_BASIC_ASSERT_RETURN_VOID(

27 27

result == napi_cannot_run_js || result == napi_ok,

28 28

"getting named property from global in finalizer should succeed "

@@ -32,19 +32,10 @@ static void Finalize(napi_env env, void* data, void* hint) {

32 32

result == napi_pending_exception || result == napi_ok,

33 33

"getting named property from global in finalizer should succeed "

34 34

"or return napi_pending_exception");

35 -

#endif // NAPI_EXPERIMENTAL

35 +

#endif // NAPI_VERSION > 9

36 36

free(ref);

37 37

}

38 38 39 -

static void BasicFinalize(node_api_basic_env env, void* data, void* hint) {

40 -

#ifdef NAPI_EXPERIMENTAL

41 -

NODE_API_BASIC_CALL_RETURN_VOID(

42 -

env, node_api_post_finalizer(env, Finalize, data, hint));

43 -

#else

44 -

Finalize(env, data, hint);

45 -

#endif

46 -

}

47 - 48 39

static napi_value CreateRef(napi_env env, napi_callback_info info) {

49 40

size_t argc = 1;

50 41

napi_value cb;

@@ -55,8 +46,7 @@ static napi_value CreateRef(napi_env env, napi_callback_info info) {

55 46

NODE_API_CALL(env, napi_typeof(env, cb, &value_type));

56 47

NODE_API_ASSERT(

57 48

env, value_type == napi_function, "argument must be function");

58 -

NODE_API_CALL(env,

59 -

napi_add_finalizer(env, cb, ref, BasicFinalize, NULL, ref));

49 +

NODE_API_CALL(env, napi_add_finalizer(env, cb, ref, Finalize, NULL, ref));

60 50

return cb;

61 51

}

62 52

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4