Since Electron 14, all native add-ons must be context-aware. Therefore, in order to make node-tree-sitter run with Electron >= 14, it has to be context-aware. Ref: https://github.com/electron/electron/issues/18397
In this PR, NAN_MODULE_WORKER_ENABLED is used to make the native addon context-aware. It will allow context as the third param but will ignore context. Although context param will be accepted, this change doesn't mean that the addon will be safe to be initialised multiple times and can be run safely on worker threads. Perhaps, someone with a better understanding of the library helps to implement AddEnvironmentCleanupHook to clean up global static resources. Ref: https://nodejs.org/api/addons.html#context-aware-addons
Another minor change: xcode_settings settings are consolidated into a single place.
Since Electron 14, all native add-ons must be context-aware. Therefore, in order to make
node-tree-sitter
run with Electron >= 14, it has to be context-aware. Ref: https://github.com/electron/electron/issues/18397In this PR,
NAN_MODULE_WORKER_ENABLED
is used to make the native addon context-aware. It will allow context as the third param but will ignore context. Although context param will be accepted, this change doesn't mean that the addon will be safe to be initialised multiple times and can be run safely on worker threads. Perhaps, someone with a better understanding of the library helps to implement AddEnvironmentCleanupHook to clean up global static resources. Ref: https://nodejs.org/api/addons.html#context-aware-addonsAnother minor change:
xcode_settings
settings are consolidated into a single place.