@@ -121,6 +121,27 @@ must use Node-API exclusively by restricting itself to using
121121and by checking, for all external libraries that it uses, that the external
122122library makes ABI stability guarantees similar to Node-API.
123123
124+ ### Enum values in ABI stability
125+
126+ All enum data types defined in Node-API should be considered as a fixed size
127+ `int32_t` value. Bit flag enum types should be explicitly documented, and they
128+ work with bit operators like bit-OR (`|`) as a bit value. Unless otherwise
129+ documented, an enum type should be considered to be extensible.
130+
131+ An enum value will not be removed or renamed.
132+
133+ For an enum type returned from a Node-API function, or provided as an out
134+ parameter of a Node-API function, the value is an integer value and an addon
135+ should handle unknown values. For example, when checking `napi_status` in
136+ switch statements, an addon should include a default branch, as new status
137+ codes may be introduced in newer Node.js versions
138+
139+ For an enum type used in an in-parameter, extended values are version-guarded
140+ based on the Node-API version in which they were introduced. The result of
141+ passing an unknown integer value to Node-API functions is undefined unless
142+ otherwise documented. For example, `napi_get_all_property_names` can be
143+ extended with new enum value of `napi_key_filter`.
144+
124145## Building
125146
126147Unlike modules written in JavaScript, developing and deploying Node.js
@@ -2203,7 +2224,7 @@ typedef enum {
22032224} napi_key_filter;
22042225```
22052226
2206- Property filter bits. They can be or'ed to build a composite filter.
2227+ Property filter bit flag. This works with bit operators to build a composite filter.
22072228
22082229#### `napi_key_conversion`
22092230
@@ -4417,11 +4438,11 @@ typedef enum {
44174438} napi_property_attributes;
44184439```
44194440
4420- `napi_property_attributes` are flags used to control the behavior of properties
4421- set on a JavaScript object. Other than `napi_static` they correspond to the
4422- attributes listed in [Section property attributes][]
4441+ `napi_property_attributes` are bit flags used to control the behavior of
4442+ properties set on a JavaScript object. Other than `napi_static` they
4443+ correspond to the attributes listed in [Section property attributes][]
44234444of the [ECMAScript Language Specification][].
4424- They can be one or more of the following bitflags :
4445+ They can be one or more of the following bit flags :
44254446
44264447* `napi_default`: No explicit attributes are set on the property. By default, a
44274448 property is read only, not enumerable and not configurable.
0 commit comments