@encharm/cws 4.4.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +1 -1
- package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
- package/dist/bindings/cws_linux_arm64_node115.node +0 -0
- package/dist/bindings/cws_linux_arm64_node127.node +0 -0
- package/dist/bindings/cws_linux_x64_node115.node +0 -0
- package/dist/bindings/cws_linux_x64_node127.node +0 -0
- package/dist/bindings/cws_linux_x64_node137.node +0 -0
- package/dist/bindings/cws_win32_x64_node108.node +0 -0
- package/dist/bindings/cws_win32_x64_node115.node +0 -0
- package/dist/bindings/cws_win32_x64_node127.node +0 -0
- package/dist/bindings/cws_win32_x64_node83.node +0 -0
- package/dist/bindings/cws_win32_x64_node93.node +0 -0
- package/package.json +1 -1
- package/src/Addon.h +13 -23
- package/src/Socket.h +0 -1
- package/src/headers/22/acorn_version.h +6 -0
- package/src/headers/22/aliased_buffer-inl.h +243 -0
- package/src/headers/22/aliased_buffer.h +206 -0
- package/src/headers/{18 → 22}/async_wrap-inl.h +8 -6
- package/src/headers/{18 → 22}/async_wrap.h +65 -59
- package/src/headers/{18 → 22}/base_object-inl.h +57 -117
- package/src/headers/{18 → 22}/base_object.h +58 -30
- package/src/headers/22/base_object_types.h +74 -0
- package/src/headers/22/blob_serializer_deserializer-inl.h +385 -0
- package/src/headers/22/blob_serializer_deserializer.h +132 -0
- package/src/headers/{16 → 22}/callback_queue.h +1 -0
- package/src/headers/{16 → 22}/cares_wrap.h +27 -20
- package/src/headers/22/cjs_module_lexer_version.h +6 -0
- package/src/headers/22/cleanup_queue-inl.h +62 -0
- package/src/headers/22/cleanup_queue.h +85 -0
- package/src/headers/22/compile_cache.h +104 -0
- package/src/headers/{18 → 22}/crypto/crypto_clienthello.h +1 -1
- package/src/headers/{18 → 22}/crypto/crypto_context.h +31 -7
- package/src/headers/{18 → 22}/crypto/crypto_keys.h +118 -148
- package/src/headers/{18 → 22}/crypto/crypto_tls.h +20 -5
- package/src/headers/{18 → 22}/crypto/crypto_util.h +219 -263
- package/src/headers/22/crypto/ncrypto.h +752 -0
- package/src/headers/{16 → 22}/debug_utils-inl.h +15 -7
- package/src/headers/{18 → 22}/debug_utils.h +25 -19
- package/src/headers/22/encoding_binding.h +59 -0
- package/src/headers/{14 → 22}/env-inl.h +276 -409
- package/src/headers/22/env.h +1266 -0
- package/src/headers/22/env_properties.h +497 -0
- package/src/headers/{18 → 22}/handle_wrap.h +2 -0
- package/src/headers/{18 → 22}/histogram.h +88 -48
- package/src/headers/{16 → 22}/inspector_agent.h +17 -1
- package/src/headers/{16 → 22}/inspector_profiler.h +15 -13
- package/src/headers/22/js_native_api.h +619 -0
- package/src/headers/{18 → 22}/js_native_api_types.h +46 -1
- package/src/headers/22/js_native_api_v8.h +485 -0
- package/src/headers/{18 → 22}/js_native_api_v8_internals.h +6 -0
- package/src/headers/22/json_parser.h +40 -0
- package/src/headers/{16 → 22}/json_utils.h +19 -8
- package/src/headers/{18 → 22}/memory_tracker-inl.h +16 -13
- package/src/headers/{14 → 22}/memory_tracker.h +13 -8
- package/src/headers/{16 → 22}/module_wrap.h +49 -19
- package/src/headers/22/ncrypto/ncrypto.h +752 -0
- package/src/headers/{18 → 22}/node.h +465 -68
- package/src/headers/{18 → 22}/node_api.h +66 -81
- package/src/headers/{18 → 22}/node_api_internals.h +8 -4
- package/src/headers/{18 → 22}/node_api_types.h +5 -0
- package/src/headers/22/node_binding.h +154 -0
- package/src/headers/{18 → 22}/node_blob.h +46 -78
- package/src/headers/{18 → 22}/node_bob-inl.h +1 -2
- package/src/headers/{18 → 22}/node_bob.h +2 -6
- package/src/headers/{18 → 22}/node_buffer.h +1 -1
- package/src/headers/22/node_builtins.h +220 -0
- package/src/headers/{18 → 22}/node_constants.h +3 -5
- package/src/headers/22/node_context_data.h +168 -0
- package/src/headers/22/node_contextify.h +199 -0
- package/src/headers/{16 → 22}/node_crypto.h +1 -2
- package/src/headers/22/node_dotenv.h +45 -0
- package/src/headers/{18 → 22}/node_errors.h +86 -27
- package/src/headers/22/node_exit_code.h +54 -0
- package/src/headers/22/node_external_reference.h +249 -0
- package/src/headers/{18 → 22}/node_file-inl.h +127 -30
- package/src/headers/{16 → 22}/node_file.h +122 -11
- package/src/headers/{18 → 22}/node_http2.h +28 -11
- package/src/headers/{16 → 22}/node_http2_state.h +34 -25
- package/src/headers/{18 → 22}/node_http_common-inl.h +2 -1
- package/src/headers/{18 → 22}/node_http_common.h +56 -55
- package/src/headers/{16 → 22}/node_i18n.h +5 -18
- package/src/headers/{18 → 22}/node_internals.h +121 -59
- package/src/headers/{18 → 22}/node_main_instance.h +4 -31
- package/src/headers/{18 → 22}/node_messaging.h +27 -10
- package/src/headers/{18 → 22}/node_metadata.h +23 -1
- package/src/headers/{18 → 22}/node_options-inl.h +24 -11
- package/src/headers/{18 → 22}/node_options.h +124 -39
- package/src/headers/{18 → 22}/node_perf.h +0 -2
- package/src/headers/{18 → 22}/node_perf_common.h +20 -9
- package/src/headers/{18 → 22}/node_platform.h +11 -5
- package/src/headers/{18 → 22}/node_process.h +26 -14
- package/src/headers/22/node_realm-inl.h +145 -0
- package/src/headers/22/node_realm.h +184 -0
- package/src/headers/{16 → 22}/node_report.h +13 -17
- package/src/headers/{16 → 22}/node_revert.h +3 -3
- package/src/headers/{16 → 22}/node_root_certs.h +902 -461
- package/src/headers/22/node_sea.h +64 -0
- package/src/headers/22/node_shadow_realm.h +46 -0
- package/src/headers/22/node_snapshot_builder.h +57 -0
- package/src/headers/22/node_snapshotable.h +174 -0
- package/src/headers/{18 → 22}/node_sockaddr.h +2 -2
- package/src/headers/{16 → 22}/node_stat_watcher.h +2 -1
- package/src/headers/22/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/22/node_threadsafe_cow.h +105 -0
- package/src/headers/22/node_union_bytes.h +81 -0
- package/src/headers/22/node_url.h +96 -0
- package/src/headers/22/node_v8.h +77 -0
- package/src/headers/{14 → 22}/node_v8_platform-inl.h +17 -6
- package/src/headers/{16 → 22}/node_version.h +21 -9
- package/src/headers/22/node_wasi.h +185 -0
- package/src/headers/{14 → 22}/node_watchdog.h +2 -0
- package/src/headers/{18 → 22}/node_worker.h +7 -2
- package/src/headers/22/permission/child_process_permission.h +31 -0
- package/src/headers/22/permission/fs_permission.h +167 -0
- package/src/headers/22/permission/inspector_permission.h +31 -0
- package/src/headers/22/permission/permission.h +99 -0
- package/src/headers/22/permission/permission_base.h +60 -0
- package/src/headers/22/permission/wasi_permission.h +31 -0
- package/src/headers/22/permission/worker_permission.h +31 -0
- package/src/headers/{16 → 22}/req_wrap-inl.h +7 -6
- package/src/headers/{14 → 22}/spawn_sync.h +3 -3
- package/src/headers/{18 → 22}/stream_base-inl.h +0 -135
- package/src/headers/{18 → 22}/stream_base.h +35 -16
- package/src/headers/{18 → 22}/stream_pipe.h +3 -4
- package/src/headers/{16 → 22}/stream_wrap.h +2 -1
- package/src/headers/{18 → 22}/string_bytes.h +5 -14
- package/src/headers/{14 → 22}/string_decoder-inl.h +0 -6
- package/src/headers/{16 → 22}/string_decoder.h +0 -1
- package/src/headers/{18 → 22}/tcp_wrap.h +1 -1
- package/src/headers/{18 → 22}/threadpoolwork-inl.h +14 -1
- package/src/headers/22/timers.h +76 -0
- package/src/headers/{18 → 22}/tracing/trace_event.h +7 -5
- package/src/headers/{16 → 22}/udp_wrap.h +8 -5
- package/src/headers/22/undici_version.h +6 -0
- package/src/headers/{18 → 22}/util-inl.h +97 -127
- package/src/headers/{18 → 22}/util.h +293 -106
- package/src/headers/{18 → 22}/v8-fast-api-calls.h +103 -58
- package/src/headers/24/acorn_version.h +6 -0
- package/src/headers/24/addon_permission.h +31 -0
- package/src/headers/{16/tracing → 24}/agent.h +1 -1
- package/src/headers/24/aliased_buffer-inl.h +244 -0
- package/src/headers/24/aliased_buffer.h +206 -0
- package/src/headers/24/amaro_version.h +6 -0
- package/src/headers/24/application.h +165 -0
- package/src/headers/24/async_context_frame.h +33 -0
- package/src/headers/{14 → 24}/async_wrap-inl.h +8 -6
- package/src/headers/{16 → 24}/async_wrap.h +86 -88
- package/src/headers/{16 → 24}/base_object-inl.h +75 -119
- package/src/headers/{16 → 24}/base_object.h +84 -40
- package/src/headers/24/base_object_types.h +74 -0
- package/src/headers/24/bindingdata.h +272 -0
- package/src/headers/24/blob_serializer_deserializer-inl.h +385 -0
- package/src/headers/24/blob_serializer_deserializer.h +132 -0
- package/src/headers/{18 → 24}/callback_queue.h +1 -0
- package/src/headers/{18 → 24}/cares_wrap.h +68 -144
- package/src/headers/24/child_process_permission.h +31 -0
- package/src/headers/24/cid.h +127 -0
- package/src/headers/24/cjs_module_lexer_version.h +6 -0
- package/src/headers/24/cleanup_queue-inl.h +36 -0
- package/src/headers/24/cleanup_queue.h +79 -0
- package/src/headers/24/compile_cache.h +113 -0
- package/src/headers/24/cppgc_helpers-inl.h +65 -0
- package/src/headers/24/cppgc_helpers.h +162 -0
- package/src/headers/24/crypto/crypto_aes.h +97 -0
- package/src/headers/24/crypto/crypto_argon2.h +86 -0
- package/src/headers/{16 → 24}/crypto/crypto_bio.h +8 -9
- package/src/headers/24/crypto/crypto_chacha20_poly1305.h +64 -0
- package/src/headers/{18 → 24}/crypto/crypto_cipher.h +48 -58
- package/src/headers/{16 → 24}/crypto/crypto_clienthello-inl.h +2 -2
- package/src/headers/{16 → 24}/crypto/crypto_clienthello.h +1 -1
- package/src/headers/24/crypto/crypto_common.h +48 -0
- package/src/headers/{16 → 24}/crypto/crypto_context.h +46 -22
- package/src/headers/{18 → 24}/crypto/crypto_dh.h +27 -57
- package/src/headers/{18 → 24}/crypto/crypto_dsa.h +7 -34
- package/src/headers/{18 → 24}/crypto/crypto_ec.h +42 -49
- package/src/headers/{18 → 24}/crypto/crypto_hash.h +11 -11
- package/src/headers/{18 → 24}/crypto/crypto_hkdf.h +10 -14
- package/src/headers/{18 → 24}/crypto/crypto_hmac.h +11 -13
- package/src/headers/24/crypto/crypto_kem.h +113 -0
- package/src/headers/{18 → 24}/crypto/crypto_keygen.h +59 -74
- package/src/headers/{16 → 24}/crypto/crypto_keys.h +134 -154
- package/src/headers/24/crypto/crypto_ml_dsa.h +21 -0
- package/src/headers/{18 → 24}/crypto/crypto_pbkdf2.h +9 -11
- package/src/headers/{18 → 24}/crypto/crypto_random.h +28 -34
- package/src/headers/{18 → 24}/crypto/crypto_rsa.h +30 -35
- package/src/headers/{18 → 24}/crypto/crypto_scrypt.h +8 -10
- package/src/headers/{18 → 24}/crypto/crypto_sig.h +36 -48
- package/src/headers/{16 → 24}/crypto/crypto_tls.h +35 -18
- package/src/headers/{16 → 24}/crypto/crypto_util.h +183 -321
- package/src/headers/24/crypto/crypto_x509.h +140 -0
- package/src/headers/24/data.h +148 -0
- package/src/headers/{14 → 24}/debug_utils-inl.h +17 -8
- package/src/headers/{16 → 24}/debug_utils.h +31 -22
- package/src/headers/24/defs.h +254 -0
- package/src/headers/24/embedded_data.h +17 -0
- package/src/headers/24/encoding_binding.h +60 -0
- package/src/headers/24/endpoint.h +421 -0
- package/src/headers/{16 → 24}/env-inl.h +198 -540
- package/src/headers/24/env.h +1257 -0
- package/src/headers/24/env_properties.h +561 -0
- package/src/headers/24/fs_permission.h +167 -0
- package/src/headers/{16 → 24}/handle_wrap.h +4 -2
- package/src/headers/{16 → 24}/histogram-inl.h +34 -15
- package/src/headers/24/histogram.h +279 -0
- package/src/headers/24/http3.h +44 -0
- package/src/headers/{18 → 24}/inspector_agent.h +23 -2
- package/src/headers/24/inspector_permission.h +31 -0
- package/src/headers/{18 → 24}/inspector_profiler.h +15 -15
- package/src/headers/24/io_agent.h +30 -0
- package/src/headers/{18 → 24}/js_native_api.h +74 -30
- package/src/headers/{16 → 24}/js_native_api_types.h +61 -10
- package/src/headers/{18 → 24}/js_native_api_v8.h +205 -160
- package/src/headers/{16 → 24}/js_native_api_v8_internals.h +12 -6
- package/src/headers/24/json_parser.h +40 -0
- package/src/headers/{18 → 24}/json_utils.h +19 -8
- package/src/headers/24/logstream.h +81 -0
- package/src/headers/24/main_thread_interface.h +116 -0
- package/src/headers/{16 → 24}/memory_tracker-inl.h +115 -17
- package/src/headers/{16 → 24}/memory_tracker.h +58 -9
- package/src/headers/24/module_wrap.h +229 -0
- package/src/headers/24/ncrypto.h +1625 -0
- package/src/headers/24/network_agent.h +118 -0
- package/src/headers/24/network_inspector.h +45 -0
- package/src/headers/24/network_resource_manager.h +29 -0
- package/src/headers/{16 → 24}/node.h +560 -72
- package/src/headers/24/node_api.h +269 -0
- package/src/headers/24/node_api_internals.h +46 -0
- package/src/headers/{16 → 24}/node_api_types.h +13 -11
- package/src/headers/24/node_binding.h +163 -0
- package/src/headers/{16 → 24}/node_blob.h +46 -78
- package/src/headers/{16 → 24}/node_bob-inl.h +1 -2
- package/src/headers/{16 → 24}/node_bob.h +2 -6
- package/src/headers/{14 → 24}/node_buffer.h +1 -1
- package/src/headers/24/node_builtins.h +223 -0
- package/src/headers/24/node_config_file.h +65 -0
- package/src/headers/{14 → 24}/node_constants.h +3 -5
- package/src/headers/24/node_context_data.h +168 -0
- package/src/headers/24/node_contextify.h +261 -0
- package/src/headers/{18 → 24}/node_crypto.h +7 -2
- package/src/headers/24/node_debug.h +25 -0
- package/src/headers/24/node_dotenv.h +45 -0
- package/src/headers/{16 → 24}/node_errors.h +146 -32
- package/src/headers/24/node_exit_code.h +54 -0
- package/src/headers/{18 → 24}/node_external_reference.h +44 -22
- package/src/headers/{16 → 24}/node_file-inl.h +156 -50
- package/src/headers/{18 → 24}/node_file.h +129 -15
- package/src/headers/{16 → 24}/node_http2.h +53 -18
- package/src/headers/{14 → 24}/node_http2_state.h +35 -25
- package/src/headers/{16 → 24}/node_http_common-inl.h +8 -10
- package/src/headers/{16 → 24}/node_http_common.h +63 -59
- package/src/headers/{18 → 24}/node_i18n.h +5 -18
- package/src/headers/{16 → 24}/node_internals.h +131 -76
- package/src/headers/24/node_json.h +24 -0
- package/src/headers/24/node_large_page.h +34 -0
- package/src/headers/24/node_locks.h +180 -0
- package/src/headers/{14 → 24}/node_main_instance.h +15 -44
- package/src/headers/{16 → 24}/node_mem-inl.h +7 -7
- package/src/headers/{16 → 24}/node_messaging.h +27 -11
- package/src/headers/{16 → 24}/node_metadata.h +44 -2
- package/src/headers/24/node_modules.h +93 -0
- package/src/headers/{16 → 24}/node_options-inl.h +93 -46
- package/src/headers/{16 → 24}/node_options.h +251 -63
- package/src/headers/{16 → 24}/node_perf.h +6 -25
- package/src/headers/{16 → 24}/node_perf_common.h +23 -10
- package/src/headers/24/node_platform.h +286 -0
- package/src/headers/24/node_process.h +111 -0
- package/src/headers/24/node_realm-inl.h +153 -0
- package/src/headers/24/node_realm.h +236 -0
- package/src/headers/{18 → 24}/node_report.h +13 -17
- package/src/headers/{18 → 24}/node_revert.h +3 -3
- package/src/headers/{18 → 24}/node_root_certs.h +1010 -710
- package/src/headers/24/node_sea.h +74 -0
- package/src/headers/24/node_shadow_realm.h +46 -0
- package/src/headers/24/node_snapshot_builder.h +57 -0
- package/src/headers/24/node_snapshotable.h +174 -0
- package/src/headers/{16 → 24}/node_sockaddr-inl.h +11 -20
- package/src/headers/{16 → 24}/node_sockaddr.h +9 -20
- package/src/headers/24/node_sqlite.h +270 -0
- package/src/headers/{18 → 24}/node_stat_watcher.h +2 -1
- package/src/headers/24/node_string.h +101 -0
- package/src/headers/24/node_task_runner.h +92 -0
- package/src/headers/24/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/24/node_threadsafe_cow.h +105 -0
- package/src/headers/24/node_union_bytes.h +81 -0
- package/src/headers/24/node_url.h +101 -0
- package/src/headers/24/node_url_pattern.h +118 -0
- package/src/headers/24/node_v8.h +77 -0
- package/src/headers/{18 → 24}/node_v8_platform-inl.h +22 -31
- package/src/headers/{18 → 24}/node_version.h +18 -6
- package/src/headers/24/node_wasi.h +185 -0
- package/src/headers/24/node_wasm_web_api.h +55 -0
- package/src/headers/{18 → 24}/node_watchdog.h +2 -0
- package/src/headers/24/node_webstorage.h +60 -0
- package/src/headers/{16 → 24}/node_worker.h +24 -10
- package/src/headers/24/packet.h +155 -0
- package/src/headers/24/path.h +33 -0
- package/src/headers/24/permission/addon_permission.h +31 -0
- package/src/headers/24/permission/child_process_permission.h +31 -0
- package/src/headers/24/permission/fs_permission.h +167 -0
- package/src/headers/24/permission/inspector_permission.h +31 -0
- package/src/headers/24/permission/permission.h +100 -0
- package/src/headers/24/permission/permission_base.h +65 -0
- package/src/headers/24/permission/wasi_permission.h +31 -0
- package/src/headers/24/permission/worker_permission.h +31 -0
- package/src/headers/24/permission.h +100 -0
- package/src/headers/24/permission_base.h +65 -0
- package/src/headers/24/preferredaddress.h +72 -0
- package/src/headers/24/protocol_helper.h +27 -0
- package/src/headers/24/queue.h +306 -0
- package/src/headers/{18 → 24}/req_wrap-inl.h +12 -6
- package/src/headers/{16 → 24}/req_wrap.h +3 -1
- package/src/headers/24/runtime_agent.h +41 -0
- package/src/headers/24/session.h +528 -0
- package/src/headers/24/sessionticket.h +108 -0
- package/src/headers/{18 → 24}/spawn_sync.h +9 -8
- package/src/headers/{16 → 24}/stream_base-inl.h +3 -133
- package/src/headers/{16 → 24}/stream_base.h +43 -19
- package/src/headers/{16 → 24}/stream_pipe.h +7 -4
- package/src/headers/{18 → 24}/stream_wrap.h +2 -3
- package/src/headers/24/streams.h +370 -0
- package/src/headers/{16 → 24}/string_bytes.h +8 -21
- package/src/headers/{18 → 24}/string_decoder-inl.h +0 -6
- package/src/headers/{18 → 24}/string_decoder.h +0 -1
- package/src/headers/24/target_agent.h +75 -0
- package/src/headers/{16 → 24}/tcp_wrap.h +3 -1
- package/src/headers/{14 → 24}/threadpoolwork-inl.h +14 -1
- package/src/headers/24/timer_wrap-inl.h +32 -0
- package/src/headers/{16 → 24}/timer_wrap.h +7 -4
- package/src/headers/24/timers.h +75 -0
- package/src/headers/24/tlscontext.h +228 -0
- package/src/headers/24/tokens.h +256 -0
- package/src/headers/{14/tracing → 24}/trace_event.h +7 -5
- package/src/headers/24/traced_value.h +129 -0
- package/src/headers/24/tracing_agent.h +43 -0
- package/src/headers/24/transportparams.h +166 -0
- package/src/headers/{16 → 24}/tty_wrap.h +0 -1
- package/src/headers/{18 → 24}/udp_wrap.h +8 -5
- package/src/headers/24/undici_version.h +6 -0
- package/src/headers/{16 → 24}/util-inl.h +267 -131
- package/src/headers/{16 → 24}/util.h +338 -146
- package/src/headers/24/v8-external-memory-accounter.h +60 -0
- package/src/headers/24/v8-fast-api-calls.h +819 -0
- package/src/headers/24/v8-inspector.h +426 -0
- package/src/headers/24/wasi_permission.h +31 -0
- package/src/headers/24/worker_agent.h +40 -0
- package/src/headers/24/worker_inspector.h +124 -0
- package/src/headers/24/worker_permission.h +31 -0
- package/src/headers/24/zlib_version.h +6 -0
- package/dist/bindings/cws_darwin_arm64_node83.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node93.node +0 -0
- package/dist/bindings/cws_darwin_x64_node83.node +0 -0
- package/dist/bindings/cws_darwin_x64_node93.node +0 -0
- package/dist/bindings/cws_linux_arm64_node83.node +0 -0
- package/dist/bindings/cws_linux_arm64_node93.node +0 -0
- package/dist/bindings/cws_linux_x64_node83.node +0 -0
- package/dist/bindings/cws_linux_x64_node93.node +0 -0
- package/src/headers/14/aliased_buffer.h +0 -263
- package/src/headers/14/allocated_buffer-inl.h +0 -110
- package/src/headers/14/allocated_buffer.h +0 -73
- package/src/headers/14/async_wrap.h +0 -230
- package/src/headers/14/base64.h +0 -183
- package/src/headers/14/base_object-inl.h +0 -371
- package/src/headers/14/base_object.h +0 -281
- package/src/headers/14/callback_queue-inl.h +0 -97
- package/src/headers/14/callback_queue.h +0 -78
- package/src/headers/14/debug_utils.h +0 -181
- package/src/headers/14/env.h +0 -1388
- package/src/headers/14/handle_wrap.h +0 -117
- package/src/headers/14/histogram-inl.h +0 -83
- package/src/headers/14/histogram.h +0 -98
- package/src/headers/14/inspector_agent.h +0 -149
- package/src/headers/14/inspector_profiler.h +0 -137
- package/src/headers/14/js_native_api.h +0 -544
- package/src/headers/14/js_native_api_types.h +0 -143
- package/src/headers/14/js_native_api_v8.h +0 -301
- package/src/headers/14/js_native_api_v8_internals.h +0 -38
- package/src/headers/14/json_utils.h +0 -161
- package/src/headers/14/memory_tracker-inl.h +0 -355
- package/src/headers/14/module_wrap.h +0 -99
- package/src/headers/14/node.h +0 -1032
- package/src/headers/14/node_api.h +0 -255
- package/src/headers/14/node_api_types.h +0 -44
- package/src/headers/14/node_binding.h +0 -99
- package/src/headers/14/node_context_data.h +0 -44
- package/src/headers/14/node_contextify.h +0 -161
- package/src/headers/14/node_crypto.h +0 -865
- package/src/headers/14/node_crypto_bio.h +0 -195
- package/src/headers/14/node_crypto_clienthello-inl.h +0 -91
- package/src/headers/14/node_crypto_clienthello.h +0 -132
- package/src/headers/14/node_crypto_common.h +0 -138
- package/src/headers/14/node_crypto_groups.h +0 -415
- package/src/headers/14/node_dtrace.h +0 -86
- package/src/headers/14/node_errors.h +0 -214
- package/src/headers/14/node_file-inl.h +0 -306
- package/src/headers/14/node_file.h +0 -417
- package/src/headers/14/node_http2.h +0 -1191
- package/src/headers/14/node_http_common-inl.h +0 -194
- package/src/headers/14/node_http_common.h +0 -529
- package/src/headers/14/node_i18n.h +0 -144
- package/src/headers/14/node_internals.h +0 -405
- package/src/headers/14/node_mem.h +0 -45
- package/src/headers/14/node_messaging.h +0 -303
- package/src/headers/14/node_metadata.h +0 -109
- package/src/headers/14/node_mutex.h +0 -247
- package/src/headers/14/node_native_module.h +0 -101
- package/src/headers/14/node_native_module_env.h +0 -66
- package/src/headers/14/node_options-inl.h +0 -451
- package/src/headers/14/node_options.h +0 -481
- package/src/headers/14/node_perf.h +0 -181
- package/src/headers/14/node_perf_common.h +0 -97
- package/src/headers/14/node_platform.h +0 -189
- package/src/headers/14/node_process.h +0 -40
- package/src/headers/14/node_report.h +0 -47
- package/src/headers/14/node_revert.h +0 -72
- package/src/headers/14/node_root_certs.h +0 -3458
- package/src/headers/14/node_sockaddr-inl.h +0 -170
- package/src/headers/14/node_sockaddr.h +0 -123
- package/src/headers/14/node_stat_watcher.h +0 -70
- package/src/headers/14/node_union_bytes.h +0 -103
- package/src/headers/14/node_url.h +0 -188
- package/src/headers/14/node_version.h +0 -98
- package/src/headers/14/node_wasi.h +0 -108
- package/src/headers/14/node_win32_etw_provider-inl.h +0 -287
- package/src/headers/14/node_win32_etw_provider.h +0 -99
- package/src/headers/14/node_worker.h +0 -141
- package/src/headers/14/pipe_wrap.h +0 -78
- package/src/headers/14/req_wrap-inl.h +0 -170
- package/src/headers/14/req_wrap.h +0 -77
- package/src/headers/14/stream_base-inl.h +0 -275
- package/src/headers/14/stream_base.h +0 -434
- package/src/headers/14/stream_pipe.h +0 -73
- package/src/headers/14/stream_wrap.h +0 -130
- package/src/headers/14/string_bytes.h +0 -129
- package/src/headers/14/string_decoder.h +0 -50
- package/src/headers/14/string_search.h +0 -638
- package/src/headers/14/tcp_wrap.h +0 -101
- package/src/headers/14/tls_wrap.h +0 -222
- package/src/headers/14/tracing/agent.h +0 -195
- package/src/headers/14/tracing/traced_value.h +0 -70
- package/src/headers/14/tty_wrap.h +0 -64
- package/src/headers/14/udp_wrap.h +0 -227
- package/src/headers/14/util-inl.h +0 -566
- package/src/headers/14/util.h +0 -804
- package/src/headers/14/v8abbr.h +0 -124
- package/src/headers/16/aliased_buffer.h +0 -315
- package/src/headers/16/allocated_buffer-inl.h +0 -110
- package/src/headers/16/allocated_buffer.h +0 -73
- package/src/headers/16/async_wrap-inl.h +0 -94
- package/src/headers/16/base64-inl.h +0 -189
- package/src/headers/16/base64.h +0 -69
- package/src/headers/16/crypto/crypto_aes.h +0 -89
- package/src/headers/16/crypto/crypto_cipher.h +0 -286
- package/src/headers/16/crypto/crypto_common.h +0 -187
- package/src/headers/16/crypto/crypto_dh.h +0 -157
- package/src/headers/16/crypto/crypto_dsa.h +0 -76
- package/src/headers/16/crypto/crypto_ec.h +0 -169
- package/src/headers/16/crypto/crypto_groups.h +0 -415
- package/src/headers/16/crypto/crypto_hash.h +0 -89
- package/src/headers/16/crypto/crypto_hkdf.h +0 -66
- package/src/headers/16/crypto/crypto_hmac.h +0 -94
- package/src/headers/16/crypto/crypto_keygen.h +0 -301
- package/src/headers/16/crypto/crypto_pbkdf2.h +0 -76
- package/src/headers/16/crypto/crypto_random.h +0 -130
- package/src/headers/16/crypto/crypto_rsa.h +0 -141
- package/src/headers/16/crypto/crypto_scrypt.h +0 -87
- package/src/headers/16/crypto/crypto_sig.h +0 -167
- package/src/headers/16/crypto/crypto_spkac.h +0 -20
- package/src/headers/16/crypto/crypto_timing.h +0 -20
- package/src/headers/16/crypto/crypto_x509.h +0 -141
- package/src/headers/16/env.h +0 -1629
- package/src/headers/16/histogram.h +0 -216
- package/src/headers/16/js_native_api.h +0 -561
- package/src/headers/16/js_native_api_v8.h +0 -451
- package/src/headers/16/node.d +0 -315
- package/src/headers/16/node.stp +0 -146
- package/src/headers/16/node_api.h +0 -275
- package/src/headers/16/node_api_internals.h +0 -30
- package/src/headers/16/node_binding.h +0 -99
- package/src/headers/16/node_buffer.h +0 -92
- package/src/headers/16/node_constants.h +0 -84
- package/src/headers/16/node_context_data.h +0 -44
- package/src/headers/16/node_contextify.h +0 -196
- package/src/headers/16/node_dtrace.h +0 -86
- package/src/headers/16/node_external_reference.h +0 -129
- package/src/headers/16/node_main_instance.h +0 -103
- package/src/headers/16/node_native_module.h +0 -101
- package/src/headers/16/node_native_module_env.h +0 -68
- package/src/headers/16/node_platform.h +0 -192
- package/src/headers/16/node_process.h +0 -43
- package/src/headers/16/node_provider.d +0 -80
- package/src/headers/16/node_snapshotable.h +0 -137
- package/src/headers/16/node_union_bytes.h +0 -103
- package/src/headers/16/node_url.h +0 -205
- package/src/headers/16/node_v8.h +0 -41
- package/src/headers/16/node_v8_platform-inl.h +0 -194
- package/src/headers/16/node_wasi.h +0 -108
- package/src/headers/16/node_watchdog.h +0 -152
- package/src/headers/16/node_win32_etw_provider-inl.h +0 -288
- package/src/headers/16/node_win32_etw_provider.h +0 -99
- package/src/headers/16/spawn_sync.h +0 -242
- package/src/headers/16/string_decoder-inl.h +0 -37
- package/src/headers/16/string_search.h +0 -638
- package/src/headers/16/threadpoolwork-inl.h +0 -57
- package/src/headers/16/tracing/node_trace_buffer.h +0 -83
- package/src/headers/16/tracing/node_trace_writer.h +0 -75
- package/src/headers/16/tracing/trace_event.h +0 -720
- package/src/headers/16/tracing/traced_value.h +0 -70
- package/src/headers/16/v8abbr.h +0 -123
- package/src/headers/16/v8ustack.d +0 -695
- package/src/headers/18/aliased_buffer.h +0 -315
- package/src/headers/18/aliased_struct-inl.h +0 -54
- package/src/headers/18/aliased_struct.h +0 -63
- package/src/headers/18/base64-inl.h +0 -189
- package/src/headers/18/base64.h +0 -69
- package/src/headers/18/connect_wrap.h +0 -26
- package/src/headers/18/connection_wrap.h +0 -30
- package/src/headers/18/crypto/crypto_aes.h +0 -89
- package/src/headers/18/crypto/crypto_bio.h +0 -194
- package/src/headers/18/crypto/crypto_clienthello-inl.h +0 -90
- package/src/headers/18/crypto/crypto_common.h +0 -151
- package/src/headers/18/crypto/crypto_groups.h +0 -415
- package/src/headers/18/crypto/crypto_x509.h +0 -143
- package/src/headers/18/debug_utils-inl.h +0 -223
- package/src/headers/18/diagnosticfilename-inl.h +0 -33
- package/src/headers/18/env-inl.h +0 -1308
- package/src/headers/18/env.h +0 -1667
- package/src/headers/18/inspector_io.h +0 -78
- package/src/headers/18/inspector_socket.h +0 -60
- package/src/headers/18/inspector_socket_server.h +0 -110
- package/src/headers/18/js_stream.h +0 -52
- package/src/headers/18/memory_tracker.h +0 -284
- package/src/headers/18/module_wrap.h +0 -116
- package/src/headers/18/node_binding.h +0 -99
- package/src/headers/18/node_context_data.h +0 -44
- package/src/headers/18/node_contextify.h +0 -196
- package/src/headers/18/node_dir.h +0 -52
- package/src/headers/18/node_dtrace.h +0 -86
- package/src/headers/18/node_http2_state.h +0 -149
- package/src/headers/18/node_mem-inl.h +0 -112
- package/src/headers/18/node_native_module.h +0 -109
- package/src/headers/18/node_native_module_env.h +0 -71
- package/src/headers/18/node_object_wrap.h +0 -132
- package/src/headers/18/node_snapshot_builder.h +0 -43
- package/src/headers/18/node_snapshotable.h +0 -130
- package/src/headers/18/node_union_bytes.h +0 -103
- package/src/headers/18/node_url.h +0 -205
- package/src/headers/18/node_v8.h +0 -41
- package/src/headers/18/node_wasi.h +0 -108
- package/src/headers/18/node_win32_etw_provider-inl.h +0 -288
- package/src/headers/18/node_win32_etw_provider.h +0 -99
- package/src/headers/18/string_search.h +0 -638
- package/src/headers/18/tracing/node_trace_buffer.h +0 -83
- package/src/headers/18/tracing/node_trace_writer.h +0 -75
- package/src/headers/18/tracing/trace_event_common.h +0 -1109
- package/src/headers/18/tracing/traced_value.h +0 -70
- package/src/headers/18/v8abbr.h +0 -123
- /package/src/headers/{14 → 22}/aliased_struct-inl.h +0 -0
- /package/src/headers/{14 → 22}/aliased_struct.h +0 -0
- /package/src/headers/{16 → 22}/callback_queue-inl.h +0 -0
- /package/src/headers/{14 → 22}/connect_wrap.h +0 -0
- /package/src/headers/{14 → 22}/connection_wrap.h +0 -0
- /package/src/headers/{14 → 22}/diagnosticfilename-inl.h +0 -0
- /package/src/headers/{18 → 22}/histogram-inl.h +0 -0
- /package/src/headers/{14 → 22}/inspector_io.h +0 -0
- /package/src/headers/{14 → 22}/inspector_socket.h +0 -0
- /package/src/headers/{14 → 22}/inspector_socket_server.h +0 -0
- /package/src/headers/{14 → 22}/js_stream.h +0 -0
- /package/src/headers/{14 → 22}/node_dir.h +0 -0
- /package/src/headers/{14 → 22}/node_mem-inl.h +0 -0
- /package/src/headers/{16 → 22}/node_mem.h +0 -0
- /package/src/headers/{16 → 22}/node_mutex.h +0 -0
- /package/src/headers/{14 → 22}/node_object_wrap.h +0 -0
- /package/src/headers/{16 → 22}/node_process-inl.h +0 -0
- /package/src/headers/{18 → 22}/node_sockaddr-inl.h +0 -0
- /package/src/headers/{18 → 22}/node_wasm_web_api.h +0 -0
- /package/src/headers/{16 → 22}/pipe_wrap.h +0 -0
- /package/src/headers/{18 → 22}/req_wrap.h +0 -0
- /package/src/headers/{18 → 22}/timer_wrap-inl.h +0 -0
- /package/src/headers/{18 → 22}/timer_wrap.h +0 -0
- /package/src/headers/{18 → 22}/tracing/agent.h +0 -0
- /package/src/headers/{14 → 22}/tracing/trace_event_common.h +0 -0
- /package/src/headers/{18 → 22}/tty_wrap.h +0 -0
- /package/src/headers/{16 → 24}/aliased_struct-inl.h +0 -0
- /package/src/headers/{16 → 24}/aliased_struct.h +0 -0
- /package/src/headers/{18 → 24}/callback_queue-inl.h +0 -0
- /package/src/headers/{16 → 24}/connect_wrap.h +0 -0
- /package/src/headers/{16 → 24}/connection_wrap.h +0 -0
- /package/src/headers/{18 → 24}/crypto/crypto_spkac.h +0 -0
- /package/src/headers/{18 → 24}/crypto/crypto_timing.h +0 -0
- /package/src/headers/{16 → 24}/diagnosticfilename-inl.h +0 -0
- /package/src/headers/{16 → 24}/inspector_io.h +0 -0
- /package/src/headers/{16 → 24}/inspector_socket.h +0 -0
- /package/src/headers/{16 → 24}/inspector_socket_server.h +0 -0
- /package/src/headers/{16 → 24}/js_stream.h +0 -0
- /package/src/headers/{16 → 24}/node_dir.h +0 -0
- /package/src/headers/{18 → 24}/node_mem.h +0 -0
- /package/src/headers/{18 → 24}/node_mutex.h +0 -0
- /package/src/headers/{16 → 24}/node_object_wrap.h +0 -0
- /package/src/headers/{18 → 24}/node_process-inl.h +0 -0
- /package/src/headers/{14/tracing → 24}/node_trace_buffer.h +0 -0
- /package/src/headers/{14/tracing → 24}/node_trace_writer.h +0 -0
- /package/src/headers/{18 → 24}/pipe_wrap.h +0 -0
- /package/src/headers/{16/tracing → 24}/trace_event_common.h +0 -0
|
@@ -75,8 +75,13 @@
|
|
|
75
75
|
#include "v8-platform.h" // NOLINT(build/include_order)
|
|
76
76
|
#include "node_version.h" // NODE_MODULE_VERSION
|
|
77
77
|
|
|
78
|
-
#
|
|
78
|
+
#define NAPI_EXPERIMENTAL
|
|
79
|
+
#include "node_api.h"
|
|
80
|
+
|
|
79
81
|
#include <functional>
|
|
82
|
+
#include <memory>
|
|
83
|
+
#include <optional>
|
|
84
|
+
#include <ostream>
|
|
80
85
|
|
|
81
86
|
// We cannot use __POSIX__ in this header because that's only defined when
|
|
82
87
|
// building Node.js.
|
|
@@ -120,12 +125,12 @@
|
|
|
120
125
|
// Forward-declare libuv loop
|
|
121
126
|
struct uv_loop_s;
|
|
122
127
|
|
|
123
|
-
struct napi_module;
|
|
124
|
-
|
|
125
128
|
// Forward-declare these functions now to stop MSVS from becoming
|
|
126
129
|
// terminally confused when it's done in node_internals.h
|
|
127
130
|
namespace node {
|
|
128
131
|
|
|
132
|
+
struct SnapshotData;
|
|
133
|
+
|
|
129
134
|
namespace tracing {
|
|
130
135
|
|
|
131
136
|
class TracingController;
|
|
@@ -223,11 +228,14 @@ namespace node {
|
|
|
223
228
|
|
|
224
229
|
class IsolateData;
|
|
225
230
|
class Environment;
|
|
231
|
+
class MultiIsolatePlatform;
|
|
232
|
+
class InitializationResultImpl;
|
|
226
233
|
|
|
227
|
-
namespace
|
|
228
|
-
enum Flags :
|
|
234
|
+
namespace ProcessInitializationFlags {
|
|
235
|
+
enum Flags : uint32_t {
|
|
229
236
|
kNoFlags = 0,
|
|
230
237
|
// Enable stdio inheritance, which is disabled by default.
|
|
238
|
+
// This flag is also implied by kNoStdioInitialization.
|
|
231
239
|
kEnableStdioInheritance = 1 << 0,
|
|
232
240
|
// Disable reading the NODE_OPTIONS environment variable.
|
|
233
241
|
kDisableNodeOptionsEnv = 1 << 1,
|
|
@@ -235,8 +243,81 @@ enum Flags : uint64_t {
|
|
|
235
243
|
kDisableCLIOptions = 1 << 2,
|
|
236
244
|
// Do not initialize ICU.
|
|
237
245
|
kNoICU = 1 << 3,
|
|
246
|
+
// Do not modify stdio file descriptor or TTY state.
|
|
247
|
+
kNoStdioInitialization = 1 << 4,
|
|
248
|
+
// Do not register Node.js-specific signal handlers
|
|
249
|
+
// and reset other signal handlers to default state.
|
|
250
|
+
kNoDefaultSignalHandling = 1 << 5,
|
|
251
|
+
// Do not perform V8 initialization.
|
|
252
|
+
kNoInitializeV8 = 1 << 6,
|
|
253
|
+
// Do not initialize a default Node.js-provided V8 platform instance.
|
|
254
|
+
kNoInitializeNodeV8Platform = 1 << 7,
|
|
255
|
+
// Do not initialize OpenSSL config.
|
|
256
|
+
kNoInitOpenSSL = 1 << 8,
|
|
257
|
+
// Do not initialize Node.js debugging based on environment variables.
|
|
258
|
+
kNoParseGlobalDebugVariables = 1 << 9,
|
|
259
|
+
// Do not adjust OS resource limits for this process.
|
|
260
|
+
kNoAdjustResourceLimits = 1 << 10,
|
|
261
|
+
// Do not map code segments into large pages for this process.
|
|
262
|
+
kNoUseLargePages = 1 << 11,
|
|
263
|
+
// Skip printing output for --help, --version, --v8-options.
|
|
264
|
+
kNoPrintHelpOrVersionOutput = 1 << 12,
|
|
265
|
+
// Do not perform cppgc initialization. If set, the embedder must call
|
|
266
|
+
// cppgc::InitializeProcess() before creating a Node.js environment
|
|
267
|
+
// and call cppgc::ShutdownProcess() before process shutdown.
|
|
268
|
+
kNoInitializeCppgc = 1 << 13,
|
|
269
|
+
// Initialize the process for predictable snapshot generation.
|
|
270
|
+
kGeneratePredictableSnapshot = 1 << 14,
|
|
271
|
+
|
|
272
|
+
// Emulate the behavior of InitializeNodeWithArgs() when passing
|
|
273
|
+
// a flags argument to the InitializeOncePerProcess() replacement
|
|
274
|
+
// function.
|
|
275
|
+
kLegacyInitializeNodeWithArgsBehavior =
|
|
276
|
+
kNoStdioInitialization | kNoDefaultSignalHandling | kNoInitializeV8 |
|
|
277
|
+
kNoInitializeNodeV8Platform | kNoInitOpenSSL |
|
|
278
|
+
kNoParseGlobalDebugVariables | kNoAdjustResourceLimits |
|
|
279
|
+
kNoUseLargePages | kNoPrintHelpOrVersionOutput | kNoInitializeCppgc,
|
|
280
|
+
};
|
|
281
|
+
} // namespace ProcessInitializationFlags
|
|
282
|
+
namespace ProcessFlags = ProcessInitializationFlags; // Legacy alias.
|
|
283
|
+
|
|
284
|
+
namespace StopFlags {
|
|
285
|
+
enum Flags : uint32_t {
|
|
286
|
+
kNoFlags = 0,
|
|
287
|
+
// Do not explicitly terminate the Isolate
|
|
288
|
+
// when exiting the Environment.
|
|
289
|
+
kDoNotTerminateIsolate = 1 << 0,
|
|
290
|
+
};
|
|
291
|
+
} // namespace StopFlags
|
|
292
|
+
|
|
293
|
+
class NODE_EXTERN InitializationResult {
|
|
294
|
+
public:
|
|
295
|
+
virtual ~InitializationResult() = default;
|
|
296
|
+
|
|
297
|
+
// Returns a suggested process exit code.
|
|
298
|
+
virtual int exit_code() const = 0;
|
|
299
|
+
|
|
300
|
+
// Returns 'true' if initialization was aborted early due to errors.
|
|
301
|
+
virtual bool early_return() const = 0;
|
|
302
|
+
|
|
303
|
+
// Returns the parsed list of non-Node.js arguments.
|
|
304
|
+
virtual const std::vector<std::string>& args() const = 0;
|
|
305
|
+
|
|
306
|
+
// Returns the parsed list of Node.js arguments.
|
|
307
|
+
virtual const std::vector<std::string>& exec_args() const = 0;
|
|
308
|
+
|
|
309
|
+
// Returns an array of errors. Note that these may be warnings
|
|
310
|
+
// whose existence does not imply a non-zero exit code.
|
|
311
|
+
virtual const std::vector<std::string>& errors() const = 0;
|
|
312
|
+
|
|
313
|
+
// If kNoInitializeNodeV8Platform was not specified, the global Node.js
|
|
314
|
+
// platform instance.
|
|
315
|
+
virtual MultiIsolatePlatform* platform() const = 0;
|
|
316
|
+
|
|
317
|
+
private:
|
|
318
|
+
InitializationResult() = default;
|
|
319
|
+
friend class InitializationResultImpl;
|
|
238
320
|
};
|
|
239
|
-
} // namespace ProcessFlags
|
|
240
321
|
|
|
241
322
|
// TODO(addaleax): Officially deprecate this and replace it with something
|
|
242
323
|
// better suited for a public embedder API.
|
|
@@ -244,28 +325,68 @@ NODE_EXTERN int Start(int argc, char* argv[]);
|
|
|
244
325
|
|
|
245
326
|
// Tear down Node.js while it is running (there are active handles
|
|
246
327
|
// in the loop and / or actively executing JavaScript code).
|
|
247
|
-
NODE_EXTERN int Stop(Environment* env
|
|
328
|
+
NODE_EXTERN int Stop(Environment* env,
|
|
329
|
+
StopFlags::Flags flags = StopFlags::kNoFlags);
|
|
248
330
|
|
|
249
331
|
// Set up per-process state needed to run Node.js. This will consume arguments
|
|
250
332
|
// from argv, fill exec_argv, and possibly add errors resulting from parsing
|
|
251
333
|
// the arguments to `errors`. The return value is a suggested exit code for the
|
|
252
334
|
// program; If it is 0, then initializing Node.js succeeded.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
NODE_EXTERN int InitializeNodeWithArgs(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
335
|
+
// This runs a subset of the initialization performed by
|
|
336
|
+
// InitializeOncePerProcess(), which supersedes this function.
|
|
337
|
+
// The subset is roughly equivalent to the one given by
|
|
338
|
+
// `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
|
|
339
|
+
NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
|
|
340
|
+
NODE_EXTERN int InitializeNodeWithArgs(
|
|
341
|
+
std::vector<std::string>* argv,
|
|
342
|
+
std::vector<std::string>* exec_argv,
|
|
343
|
+
std::vector<std::string>* errors,
|
|
344
|
+
ProcessInitializationFlags::Flags flags =
|
|
345
|
+
ProcessInitializationFlags::kNoFlags));
|
|
346
|
+
|
|
347
|
+
// Set up per-process state needed to run Node.js. This will consume arguments
|
|
348
|
+
// from args, and return information about the initialization success,
|
|
349
|
+
// including the arguments split into argv/exec_argv, a list of potential
|
|
350
|
+
// errors encountered during initialization, and a potential suggested
|
|
351
|
+
// exit code.
|
|
352
|
+
NODE_EXTERN std::shared_ptr<InitializationResult> InitializeOncePerProcess(
|
|
353
|
+
const std::vector<std::string>& args,
|
|
354
|
+
ProcessInitializationFlags::Flags flags =
|
|
355
|
+
ProcessInitializationFlags::kNoFlags);
|
|
356
|
+
// Undoes the initialization performed by InitializeOncePerProcess(),
|
|
357
|
+
// where cleanup is necessary.
|
|
358
|
+
NODE_EXTERN void TearDownOncePerProcess();
|
|
359
|
+
// Convenience overload for specifying multiple flags without having
|
|
360
|
+
// to worry about casts.
|
|
361
|
+
inline std::shared_ptr<InitializationResult> InitializeOncePerProcess(
|
|
362
|
+
const std::vector<std::string>& args,
|
|
363
|
+
std::initializer_list<ProcessInitializationFlags::Flags> list) {
|
|
364
|
+
uint64_t flags_accum = ProcessInitializationFlags::kNoFlags;
|
|
365
|
+
for (const auto flag : list) flags_accum |= static_cast<uint64_t>(flag);
|
|
366
|
+
return InitializeOncePerProcess(
|
|
367
|
+
args, static_cast<ProcessInitializationFlags::Flags>(flags_accum));
|
|
368
|
+
}
|
|
263
369
|
|
|
264
370
|
enum OptionEnvvarSettings {
|
|
265
|
-
|
|
266
|
-
|
|
371
|
+
// Allow the options to be set via the environment variable, like
|
|
372
|
+
// `NODE_OPTIONS`.
|
|
373
|
+
kAllowedInEnvvar = 0,
|
|
374
|
+
// Disallow the options to be set via the environment variable, like
|
|
375
|
+
// `NODE_OPTIONS`.
|
|
376
|
+
kDisallowedInEnvvar = 1,
|
|
377
|
+
// Deprecated, use kAllowedInEnvvar instead.
|
|
378
|
+
kAllowedInEnvironment = kAllowedInEnvvar,
|
|
379
|
+
// Deprecated, use kDisallowedInEnvvar instead.
|
|
380
|
+
kDisallowedInEnvironment = kDisallowedInEnvvar,
|
|
267
381
|
};
|
|
268
382
|
|
|
383
|
+
// Process the arguments and set up the per-process options.
|
|
384
|
+
// If the `settings` is set as OptionEnvvarSettings::kAllowedInEnvvar, the
|
|
385
|
+
// options that are allowed in the environment variable are processed. Options
|
|
386
|
+
// that are disallowed to be set via environment variable are processed as
|
|
387
|
+
// errors.
|
|
388
|
+
// Otherwise all the options that are disallowed (and those are allowed) to be
|
|
389
|
+
// set via environment variable are processed.
|
|
269
390
|
NODE_EXTERN int ProcessGlobalArgs(std::vector<std::string>* args,
|
|
270
391
|
std::vector<std::string>* exec_args,
|
|
271
392
|
std::vector<std::string>* errors,
|
|
@@ -349,7 +470,8 @@ enum IsolateSettingsFlags {
|
|
|
349
470
|
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
|
|
350
471
|
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
|
|
351
472
|
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
|
|
352
|
-
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3
|
|
473
|
+
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
|
|
474
|
+
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 0, /* legacy no-op */
|
|
353
475
|
};
|
|
354
476
|
|
|
355
477
|
struct IsolateSettings {
|
|
@@ -367,6 +489,79 @@ struct IsolateSettings {
|
|
|
367
489
|
v8::PromiseRejectCallback promise_reject_callback = nullptr;
|
|
368
490
|
v8::AllowWasmCodeGenerationCallback
|
|
369
491
|
allow_wasm_code_generation_callback = nullptr;
|
|
492
|
+
v8::ModifyCodeGenerationFromStringsCallback2
|
|
493
|
+
modify_code_generation_from_strings_callback = nullptr;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// Represents a startup snapshot blob, e.g. created by passing
|
|
497
|
+
// --node-snapshot-main=entry.js to the configure script at build time,
|
|
498
|
+
// or by running Node.js with the --build-snapshot option.
|
|
499
|
+
//
|
|
500
|
+
// If used, the snapshot *must* have been built with the same Node.js
|
|
501
|
+
// version and V8 flags as the version that is currently running, and will
|
|
502
|
+
// be rejected otherwise.
|
|
503
|
+
// The same EmbedderSnapshotData instance *must* be passed to both
|
|
504
|
+
// `NewIsolate()` and `CreateIsolateData()`. The first `Environment` instance
|
|
505
|
+
// should be created with an empty `context` argument and will then
|
|
506
|
+
// use the main context included in the snapshot blob. It can be retrieved
|
|
507
|
+
// using `GetMainContext()`. `LoadEnvironment` can receive an empty
|
|
508
|
+
// `StartExecutionCallback` in this case.
|
|
509
|
+
// If V8 was configured with the shared-readonly-heap option, it requires
|
|
510
|
+
// all snapshots used to create `Isolate` instances to be identical.
|
|
511
|
+
// This option *must* be unset by embedders who wish to use the startup
|
|
512
|
+
// feature during the build step by passing the --disable-shared-readonly-heap
|
|
513
|
+
// flag to the configure script.
|
|
514
|
+
//
|
|
515
|
+
// The snapshot *must* be kept alive during the execution of the Isolate
|
|
516
|
+
// that was created using it.
|
|
517
|
+
//
|
|
518
|
+
// Snapshots are an *experimental* feature. In particular, the embedder API
|
|
519
|
+
// exposed through this class is subject to change or removal between Node.js
|
|
520
|
+
// versions, including possible API and ABI breakage.
|
|
521
|
+
class EmbedderSnapshotData {
|
|
522
|
+
public:
|
|
523
|
+
struct DeleteSnapshotData {
|
|
524
|
+
void operator()(const EmbedderSnapshotData*) const;
|
|
525
|
+
};
|
|
526
|
+
using Pointer =
|
|
527
|
+
std::unique_ptr<const EmbedderSnapshotData, DeleteSnapshotData>;
|
|
528
|
+
|
|
529
|
+
// Return an EmbedderSnapshotData object that refers to the built-in
|
|
530
|
+
// snapshot of Node.js. This can have been configured through e.g.
|
|
531
|
+
// --node-snapshot-main=entry.js.
|
|
532
|
+
static Pointer BuiltinSnapshotData();
|
|
533
|
+
|
|
534
|
+
// Return an EmbedderSnapshotData object that is based on an input file.
|
|
535
|
+
// Calling this method will consume but not close the FILE* handle.
|
|
536
|
+
// The FILE* handle can be closed immediately following this call.
|
|
537
|
+
// If the snapshot is invalid, this returns an empty pointer.
|
|
538
|
+
static Pointer FromFile(FILE* in);
|
|
539
|
+
static Pointer FromBlob(const std::vector<char>& in);
|
|
540
|
+
static Pointer FromBlob(std::string_view in);
|
|
541
|
+
|
|
542
|
+
// Write this EmbedderSnapshotData object to an output file.
|
|
543
|
+
// Calling this method will not close the FILE* handle.
|
|
544
|
+
// The FILE* handle can be closed immediately following this call.
|
|
545
|
+
void ToFile(FILE* out) const;
|
|
546
|
+
std::vector<char> ToBlob() const;
|
|
547
|
+
|
|
548
|
+
// Returns whether custom snapshots can be used. Currently, this means
|
|
549
|
+
// that V8 was configured without the shared-readonly-heap feature.
|
|
550
|
+
static bool CanUseCustomSnapshotPerIsolate();
|
|
551
|
+
|
|
552
|
+
EmbedderSnapshotData(const EmbedderSnapshotData&) = delete;
|
|
553
|
+
EmbedderSnapshotData& operator=(const EmbedderSnapshotData&) = delete;
|
|
554
|
+
EmbedderSnapshotData(EmbedderSnapshotData&&) = delete;
|
|
555
|
+
EmbedderSnapshotData& operator=(EmbedderSnapshotData&&) = delete;
|
|
556
|
+
|
|
557
|
+
protected:
|
|
558
|
+
EmbedderSnapshotData(const SnapshotData* impl, bool owns_impl);
|
|
559
|
+
|
|
560
|
+
private:
|
|
561
|
+
const SnapshotData* impl_;
|
|
562
|
+
bool owns_impl_;
|
|
563
|
+
friend struct SnapshotData;
|
|
564
|
+
friend class CommonEnvironmentSetup;
|
|
370
565
|
};
|
|
371
566
|
|
|
372
567
|
// Overriding IsolateSettings may produce unexpected behavior
|
|
@@ -382,13 +577,18 @@ NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate);
|
|
|
382
577
|
// This is a convenience method equivalent to using SetIsolateCreateParams(),
|
|
383
578
|
// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(),
|
|
384
579
|
// Isolate::Initialize(), and SetIsolateUpForNode().
|
|
385
|
-
NODE_EXTERN v8::Isolate* NewIsolate(
|
|
386
|
-
|
|
387
|
-
|
|
580
|
+
NODE_EXTERN v8::Isolate* NewIsolate(
|
|
581
|
+
ArrayBufferAllocator* allocator,
|
|
582
|
+
struct uv_loop_s* event_loop,
|
|
583
|
+
MultiIsolatePlatform* platform,
|
|
584
|
+
const EmbedderSnapshotData* snapshot_data = nullptr,
|
|
585
|
+
const IsolateSettings& settings = {});
|
|
388
586
|
NODE_EXTERN v8::Isolate* NewIsolate(
|
|
389
587
|
std::shared_ptr<ArrayBufferAllocator> allocator,
|
|
390
588
|
struct uv_loop_s* event_loop,
|
|
391
|
-
MultiIsolatePlatform* platform
|
|
589
|
+
MultiIsolatePlatform* platform,
|
|
590
|
+
const EmbedderSnapshotData* snapshot_data = nullptr,
|
|
591
|
+
const IsolateSettings& settings = {});
|
|
392
592
|
|
|
393
593
|
// Creates a new context with Node.js-specific tweaks.
|
|
394
594
|
NODE_EXTERN v8::Local<v8::Context> NewContext(
|
|
@@ -407,7 +607,8 @@ NODE_EXTERN IsolateData* CreateIsolateData(
|
|
|
407
607
|
v8::Isolate* isolate,
|
|
408
608
|
struct uv_loop_s* loop,
|
|
409
609
|
MultiIsolatePlatform* platform = nullptr,
|
|
410
|
-
ArrayBufferAllocator* allocator = nullptr
|
|
610
|
+
ArrayBufferAllocator* allocator = nullptr,
|
|
611
|
+
const EmbedderSnapshotData* snapshot_data = nullptr);
|
|
411
612
|
NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data);
|
|
412
613
|
|
|
413
614
|
struct ThreadId {
|
|
@@ -456,17 +657,54 @@ enum Flags : uint64_t {
|
|
|
456
657
|
// This control is needed by embedders who may not want to initialize the V8
|
|
457
658
|
// inspector in situations where one has already been created,
|
|
458
659
|
// e.g. Blink's in Chromium.
|
|
459
|
-
kNoCreateInspector = 1 << 9
|
|
660
|
+
kNoCreateInspector = 1 << 9,
|
|
661
|
+
// Controls whether or not the InspectorAgent for this Environment should
|
|
662
|
+
// call StartDebugSignalHandler. This control is needed by embedders who may
|
|
663
|
+
// not want to allow other processes to start the V8 inspector.
|
|
664
|
+
kNoStartDebugSignalHandler = 1 << 10,
|
|
665
|
+
// Controls whether the InspectorAgent created for this Environment waits for
|
|
666
|
+
// Inspector frontend events during the Environment creation. It's used to
|
|
667
|
+
// call node::Stop(env) on a Worker thread that is waiting for the events.
|
|
668
|
+
kNoWaitForInspectorFrontend = 1 << 11
|
|
460
669
|
};
|
|
461
670
|
} // namespace EnvironmentFlags
|
|
462
671
|
|
|
672
|
+
enum class SnapshotFlags : uint32_t {
|
|
673
|
+
kDefault = 0,
|
|
674
|
+
// Whether code cache should be generated as part of the snapshot.
|
|
675
|
+
// Code cache reduces the time spent on compiling functions included
|
|
676
|
+
// in the snapshot at the expense of a bigger snapshot size and
|
|
677
|
+
// potentially breaking portability of the snapshot.
|
|
678
|
+
kWithoutCodeCache = 1 << 0,
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
struct SnapshotConfig {
|
|
682
|
+
SnapshotFlags flags = SnapshotFlags::kDefault;
|
|
683
|
+
|
|
684
|
+
// When builder_script_path is std::nullopt, the snapshot is generated as a
|
|
685
|
+
// built-in snapshot instead of a custom one, and it's expected that the
|
|
686
|
+
// built-in snapshot only contains states that reproduce in every run of the
|
|
687
|
+
// application. The event loop won't be run when generating a built-in
|
|
688
|
+
// snapshot, so asynchronous operations should be avoided.
|
|
689
|
+
//
|
|
690
|
+
// When builder_script_path is an std::string, it should match args[1]
|
|
691
|
+
// passed to CreateForSnapshotting(). The embedder is also expected to use
|
|
692
|
+
// LoadEnvironment() to run a script matching this path. In that case the
|
|
693
|
+
// snapshot is generated as a custom snapshot and the event loop is run, so
|
|
694
|
+
// the snapshot builder can execute asynchronous operations as long as they
|
|
695
|
+
// are run to completion when the snapshot is taken.
|
|
696
|
+
std::optional<std::string> builder_script_path;
|
|
697
|
+
};
|
|
698
|
+
|
|
463
699
|
struct InspectorParentHandle {
|
|
464
|
-
virtual ~InspectorParentHandle();
|
|
700
|
+
virtual ~InspectorParentHandle() = default;
|
|
465
701
|
};
|
|
466
702
|
|
|
467
703
|
// TODO(addaleax): Maybe move per-Environment options parsing here.
|
|
468
704
|
// Returns nullptr when the Environment cannot be created e.g. there are
|
|
469
705
|
// pending JavaScript exceptions.
|
|
706
|
+
// `context` may be empty if an `EmbedderSnapshotData` instance was provided
|
|
707
|
+
// to `NewIsolate()` and `CreateIsolateData()`.
|
|
470
708
|
NODE_EXTERN Environment* CreateEnvironment(
|
|
471
709
|
IsolateData* isolate_data,
|
|
472
710
|
v8::Local<v8::Context> context,
|
|
@@ -488,20 +726,47 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
|
|
|
488
726
|
ThreadId child_thread_id,
|
|
489
727
|
const char* child_url);
|
|
490
728
|
|
|
729
|
+
NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
|
|
730
|
+
Environment* parent_env,
|
|
731
|
+
ThreadId child_thread_id,
|
|
732
|
+
const char* child_url,
|
|
733
|
+
const char* name);
|
|
734
|
+
|
|
491
735
|
struct StartExecutionCallbackInfo {
|
|
492
736
|
v8::Local<v8::Object> process_object;
|
|
493
737
|
v8::Local<v8::Function> native_require;
|
|
738
|
+
v8::Local<v8::Function> run_cjs;
|
|
494
739
|
};
|
|
495
740
|
|
|
496
741
|
using StartExecutionCallback =
|
|
497
742
|
std::function<v8::MaybeLocal<v8::Value>(const StartExecutionCallbackInfo&)>;
|
|
743
|
+
using EmbedderPreloadCallback =
|
|
744
|
+
std::function<void(Environment* env,
|
|
745
|
+
v8::Local<v8::Value> process,
|
|
746
|
+
v8::Local<v8::Value> require)>;
|
|
498
747
|
|
|
748
|
+
// Run initialization for the environment.
|
|
749
|
+
//
|
|
750
|
+
// The |preload| function, usually used by embedders to inject scripts,
|
|
751
|
+
// will be run by Node.js before Node.js executes the entry point.
|
|
752
|
+
// The function is guaranteed to run before the user land module loader running
|
|
753
|
+
// any user code, so it is safe to assume that at this point, no user code has
|
|
754
|
+
// been run yet.
|
|
755
|
+
// The function will be executed with preload(process, require), and the passed
|
|
756
|
+
// require function has access to internal Node.js modules. There is no
|
|
757
|
+
// stability guarantee about the internals exposed to the internal require
|
|
758
|
+
// function. Expect breakages when updating Node.js versions if the embedder
|
|
759
|
+
// imports internal modules with the internal require function.
|
|
760
|
+
// Worker threads created in the environment will also respect The |preload|
|
|
761
|
+
// function, so make sure the function is thread-safe.
|
|
499
762
|
NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
|
|
500
763
|
Environment* env,
|
|
501
|
-
StartExecutionCallback cb
|
|
764
|
+
StartExecutionCallback cb,
|
|
765
|
+
EmbedderPreloadCallback preload = nullptr);
|
|
502
766
|
NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
|
|
503
767
|
Environment* env,
|
|
504
|
-
|
|
768
|
+
std::string_view main_script_source_utf8,
|
|
769
|
+
EmbedderPreloadCallback preload = nullptr);
|
|
505
770
|
NODE_EXTERN void FreeEnvironment(Environment* env);
|
|
506
771
|
|
|
507
772
|
// Set a callback that is called when process.exit() is called from JS,
|
|
@@ -520,8 +785,12 @@ NODE_EXTERN void DefaultProcessExitHandler(Environment* env, int exit_code);
|
|
|
520
785
|
NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local<v8::Context> context);
|
|
521
786
|
NODE_EXTERN IsolateData* GetEnvironmentIsolateData(Environment* env);
|
|
522
787
|
NODE_EXTERN ArrayBufferAllocator* GetArrayBufferAllocator(IsolateData* data);
|
|
788
|
+
// This is mostly useful for Environment* instances that were created through
|
|
789
|
+
// a snapshot and have a main context that was read from that snapshot.
|
|
790
|
+
NODE_EXTERN v8::Local<v8::Context> GetMainContext(Environment* env);
|
|
523
791
|
|
|
524
|
-
NODE_EXTERN void OnFatalError(const char* location,
|
|
792
|
+
[[noreturn]] NODE_EXTERN void OnFatalError(const char* location,
|
|
793
|
+
const char* message);
|
|
525
794
|
NODE_EXTERN void PromiseRejectCallback(v8::PromiseRejectMessage message);
|
|
526
795
|
NODE_EXTERN bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
|
|
527
796
|
v8::Local<v8::String>);
|
|
@@ -531,6 +800,33 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> PrepareStackTraceCallback(
|
|
|
531
800
|
v8::Local<v8::Value> exception,
|
|
532
801
|
v8::Local<v8::Array> trace);
|
|
533
802
|
|
|
803
|
+
// Writes a diagnostic report to a file. If filename is not provided, the
|
|
804
|
+
// default filename includes the date, time, PID, and a sequence number.
|
|
805
|
+
// The report's JavaScript stack trace is taken from err, if present.
|
|
806
|
+
// If isolate is nullptr, no information about the JavaScript environment
|
|
807
|
+
// is included in the report.
|
|
808
|
+
// Returns the filename of the written report.
|
|
809
|
+
NODE_EXTERN std::string TriggerNodeReport(v8::Isolate* isolate,
|
|
810
|
+
const char* message,
|
|
811
|
+
const char* trigger,
|
|
812
|
+
const std::string& filename,
|
|
813
|
+
v8::Local<v8::Value> error);
|
|
814
|
+
NODE_EXTERN std::string TriggerNodeReport(Environment* env,
|
|
815
|
+
const char* message,
|
|
816
|
+
const char* trigger,
|
|
817
|
+
const std::string& filename,
|
|
818
|
+
v8::Local<v8::Value> error);
|
|
819
|
+
NODE_EXTERN void GetNodeReport(v8::Isolate* isolate,
|
|
820
|
+
const char* message,
|
|
821
|
+
const char* trigger,
|
|
822
|
+
v8::Local<v8::Value> error,
|
|
823
|
+
std::ostream& out);
|
|
824
|
+
NODE_EXTERN void GetNodeReport(Environment* env,
|
|
825
|
+
const char* message,
|
|
826
|
+
const char* trigger,
|
|
827
|
+
v8::Local<v8::Value> error,
|
|
828
|
+
std::ostream& out);
|
|
829
|
+
|
|
534
830
|
// This returns the MultiIsolatePlatform used for an Environment or IsolateData
|
|
535
831
|
// instance, if one exists.
|
|
536
832
|
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
|
|
@@ -584,6 +880,8 @@ NODE_EXTERN struct uv_loop_s* GetCurrentEventLoop(v8::Isolate* isolate);
|
|
|
584
880
|
// This function only works if `env` has an associated `MultiIsolatePlatform`.
|
|
585
881
|
NODE_EXTERN v8::Maybe<int> SpinEventLoop(Environment* env);
|
|
586
882
|
|
|
883
|
+
NODE_EXTERN std::string GetAnonymousMainPath();
|
|
884
|
+
|
|
587
885
|
class NODE_EXTERN CommonEnvironmentSetup {
|
|
588
886
|
public:
|
|
589
887
|
~CommonEnvironmentSetup();
|
|
@@ -599,8 +897,44 @@ class NODE_EXTERN CommonEnvironmentSetup {
|
|
|
599
897
|
MultiIsolatePlatform* platform,
|
|
600
898
|
std::vector<std::string>* errors,
|
|
601
899
|
EnvironmentArgs&&... env_args);
|
|
900
|
+
template <typename... EnvironmentArgs>
|
|
901
|
+
static std::unique_ptr<CommonEnvironmentSetup> CreateFromSnapshot(
|
|
902
|
+
MultiIsolatePlatform* platform,
|
|
903
|
+
std::vector<std::string>* errors,
|
|
904
|
+
const EmbedderSnapshotData* snapshot_data,
|
|
905
|
+
EnvironmentArgs&&... env_args);
|
|
906
|
+
|
|
907
|
+
// Create an embedding setup which will be used for creating a snapshot
|
|
908
|
+
// using CreateSnapshot().
|
|
909
|
+
//
|
|
910
|
+
// This will create and attach a v8::SnapshotCreator to this instance,
|
|
911
|
+
// and the same restrictions apply to this instance that also apply to
|
|
912
|
+
// other V8 snapshotting environments.
|
|
913
|
+
// Not all Node.js APIs are supported in this case. Currently, there is
|
|
914
|
+
// no support for native/host objects other than Node.js builtins
|
|
915
|
+
// in the snapshot.
|
|
916
|
+
//
|
|
917
|
+
// If the embedder wants to use LoadEnvironment() later to run a snapshot
|
|
918
|
+
// builder script they should make sure args[1] contains the path of the
|
|
919
|
+
// snapshot script, which will be used to create __filename and __dirname
|
|
920
|
+
// in the context where the builder script is run. If they do not want to
|
|
921
|
+
// include the build-time paths into the snapshot, use the string returned
|
|
922
|
+
// by GetAnonymousMainPath() as args[1] to anonymize the script.
|
|
923
|
+
//
|
|
924
|
+
// Snapshots are an *experimental* feature. In particular, the embedder API
|
|
925
|
+
// exposed through this class is subject to change or removal between Node.js
|
|
926
|
+
// versions, including possible API and ABI breakage.
|
|
927
|
+
static std::unique_ptr<CommonEnvironmentSetup> CreateForSnapshotting(
|
|
928
|
+
MultiIsolatePlatform* platform,
|
|
929
|
+
std::vector<std::string>* errors,
|
|
930
|
+
const std::vector<std::string>& args = {},
|
|
931
|
+
const std::vector<std::string>& exec_args = {},
|
|
932
|
+
const SnapshotConfig& snapshot_config = {});
|
|
933
|
+
EmbedderSnapshotData::Pointer CreateSnapshot();
|
|
602
934
|
|
|
603
935
|
struct uv_loop_s* event_loop() const;
|
|
936
|
+
v8::SnapshotCreator* snapshot_creator();
|
|
937
|
+
// Empty for snapshotting environments.
|
|
604
938
|
std::shared_ptr<ArrayBufferAllocator> array_buffer_allocator() const;
|
|
605
939
|
v8::Isolate* isolate() const;
|
|
606
940
|
IsolateData* isolate_data() const;
|
|
@@ -613,12 +947,25 @@ class NODE_EXTERN CommonEnvironmentSetup {
|
|
|
613
947
|
CommonEnvironmentSetup& operator=(CommonEnvironmentSetup&&) = delete;
|
|
614
948
|
|
|
615
949
|
private:
|
|
950
|
+
enum Flags : uint32_t {
|
|
951
|
+
kNoFlags = 0,
|
|
952
|
+
kIsForSnapshotting = 1,
|
|
953
|
+
};
|
|
954
|
+
|
|
616
955
|
struct Impl;
|
|
617
956
|
Impl* impl_;
|
|
957
|
+
|
|
618
958
|
CommonEnvironmentSetup(
|
|
619
959
|
MultiIsolatePlatform*,
|
|
620
960
|
std::vector<std::string>*,
|
|
621
961
|
std::function<Environment*(const CommonEnvironmentSetup*)>);
|
|
962
|
+
CommonEnvironmentSetup(
|
|
963
|
+
MultiIsolatePlatform*,
|
|
964
|
+
std::vector<std::string>*,
|
|
965
|
+
const EmbedderSnapshotData*,
|
|
966
|
+
uint32_t flags,
|
|
967
|
+
std::function<Environment*(const CommonEnvironmentSetup*)>,
|
|
968
|
+
const SnapshotConfig* config = nullptr);
|
|
622
969
|
};
|
|
623
970
|
|
|
624
971
|
// Implementation for CommonEnvironmentSetup::Create
|
|
@@ -638,6 +985,29 @@ std::unique_ptr<CommonEnvironmentSetup> CommonEnvironmentSetup::Create(
|
|
|
638
985
|
return ret;
|
|
639
986
|
}
|
|
640
987
|
|
|
988
|
+
// Implementation for ::CreateFromSnapshot -- the ::Create() method
|
|
989
|
+
// could call this with a nullptr snapshot_data in a major version.
|
|
990
|
+
template <typename... EnvironmentArgs>
|
|
991
|
+
std::unique_ptr<CommonEnvironmentSetup>
|
|
992
|
+
CommonEnvironmentSetup::CreateFromSnapshot(
|
|
993
|
+
MultiIsolatePlatform* platform,
|
|
994
|
+
std::vector<std::string>* errors,
|
|
995
|
+
const EmbedderSnapshotData* snapshot_data,
|
|
996
|
+
EnvironmentArgs&&... env_args) {
|
|
997
|
+
auto ret = std::unique_ptr<CommonEnvironmentSetup>(new CommonEnvironmentSetup(
|
|
998
|
+
platform,
|
|
999
|
+
errors,
|
|
1000
|
+
snapshot_data,
|
|
1001
|
+
Flags::kNoFlags,
|
|
1002
|
+
[&](const CommonEnvironmentSetup* setup) -> Environment* {
|
|
1003
|
+
return CreateEnvironment(setup->isolate_data(),
|
|
1004
|
+
setup->context(),
|
|
1005
|
+
std::forward<EnvironmentArgs>(env_args)...);
|
|
1006
|
+
}));
|
|
1007
|
+
if (!errors->empty()) ret.reset();
|
|
1008
|
+
return ret;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
641
1011
|
/* Converts a unixtime to V8 Date */
|
|
642
1012
|
NODE_DEPRECATED("Use v8::Date::New() directly",
|
|
643
1013
|
inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) {
|
|
@@ -653,44 +1023,38 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
|
|
653
1023
|
})
|
|
654
1024
|
#define NODE_V8_UNIXTIME node::NODE_V8_UNIXTIME
|
|
655
1025
|
|
|
656
|
-
#define NODE_DEFINE_CONSTANT(target, constant)
|
|
657
|
-
do {
|
|
658
|
-
v8::Isolate* isolate = target->GetIsolate();
|
|
659
|
-
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
|
660
|
-
v8::Local<v8::String> constant_name =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
v8::
|
|
677
|
-
|
|
678
|
-
v8::Local<v8::
|
|
679
|
-
v8::
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
(target)->DefineOwnProperty(context, \
|
|
689
|
-
constant_name, \
|
|
690
|
-
constant_value, \
|
|
691
|
-
constant_attributes).Check(); \
|
|
692
|
-
} \
|
|
693
|
-
while (0)
|
|
1026
|
+
#define NODE_DEFINE_CONSTANT(target, constant) \
|
|
1027
|
+
do { \
|
|
1028
|
+
v8::Isolate* isolate = target->GetIsolate(); \
|
|
1029
|
+
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
1030
|
+
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
1031
|
+
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
1032
|
+
v8::Local<v8::Number> constant_value = \
|
|
1033
|
+
v8::Number::New(isolate, static_cast<double>(constant)); \
|
|
1034
|
+
v8::PropertyAttribute constant_attributes = \
|
|
1035
|
+
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
|
1036
|
+
(target) \
|
|
1037
|
+
->DefineOwnProperty( \
|
|
1038
|
+
context, constant_name, constant_value, constant_attributes) \
|
|
1039
|
+
.Check(); \
|
|
1040
|
+
} while (0)
|
|
1041
|
+
|
|
1042
|
+
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
|
1043
|
+
do { \
|
|
1044
|
+
v8::Isolate* isolate = target->GetIsolate(); \
|
|
1045
|
+
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
|
1046
|
+
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
|
1047
|
+
isolate, #constant, v8::NewStringType::kInternalized); \
|
|
1048
|
+
v8::Local<v8::Number> constant_value = \
|
|
1049
|
+
v8::Number::New(isolate, static_cast<double>(constant)); \
|
|
1050
|
+
v8::PropertyAttribute constant_attributes = \
|
|
1051
|
+
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete | \
|
|
1052
|
+
v8::DontEnum); \
|
|
1053
|
+
(target) \
|
|
1054
|
+
->DefineOwnProperty( \
|
|
1055
|
+
context, constant_name, constant_value, constant_attributes) \
|
|
1056
|
+
.Check(); \
|
|
1057
|
+
} while (0)
|
|
694
1058
|
|
|
695
1059
|
// Used to be a macro, hence the uppercase name.
|
|
696
1060
|
inline void NODE_SET_METHOD(v8::Local<v8::Template> recv,
|
|
@@ -946,6 +1310,11 @@ NODE_EXTERN void AddLinkedBinding(Environment* env,
|
|
|
946
1310
|
const char* name,
|
|
947
1311
|
addon_context_register_func fn,
|
|
948
1312
|
void* priv);
|
|
1313
|
+
NODE_EXTERN void AddLinkedBinding(
|
|
1314
|
+
Environment* env,
|
|
1315
|
+
const char* name,
|
|
1316
|
+
napi_addon_register_func fn,
|
|
1317
|
+
int32_t module_api_version = NODE_API_DEFAULT_MODULE_API_VERSION);
|
|
949
1318
|
|
|
950
1319
|
/* Registers a callback with the passed-in Environment instance. The callback
|
|
951
1320
|
* is called after the event loop exits, but before the VM is disposed.
|
|
@@ -1002,6 +1371,15 @@ inline void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder) {
|
|
|
1002
1371
|
RemoveEnvironmentCleanupHookInternal(holder.get());
|
|
1003
1372
|
}
|
|
1004
1373
|
|
|
1374
|
+
// This behaves like V8's Isolate::RequestInterrupt(), but also wakes up
|
|
1375
|
+
// the event loop if it is currently idle. Interrupt requests are drained
|
|
1376
|
+
// in `FreeEnvironment()`. The passed callback can not call back into
|
|
1377
|
+
// JavaScript.
|
|
1378
|
+
// This function can be called from any thread.
|
|
1379
|
+
NODE_EXTERN void RequestInterrupt(Environment* env,
|
|
1380
|
+
void (*fun)(void* arg),
|
|
1381
|
+
void* arg);
|
|
1382
|
+
|
|
1005
1383
|
/* Returns the id of the current execution context. If the return value is
|
|
1006
1384
|
* zero then no execution has been set. This will happen if the user handles
|
|
1007
1385
|
* I/O from native code. */
|
|
@@ -1168,6 +1546,25 @@ void RegisterSignalHandler(int signal,
|
|
|
1168
1546
|
bool reset_handler = false);
|
|
1169
1547
|
#endif // _WIN32
|
|
1170
1548
|
|
|
1549
|
+
// Configure the layout of the JavaScript object with a cppgc::GarbageCollected
|
|
1550
|
+
// instance so that when the JavaScript object is reachable, the garbage
|
|
1551
|
+
// collected instance would have its Trace() method invoked per the cppgc
|
|
1552
|
+
// contract. To make it work, the process must have called
|
|
1553
|
+
// cppgc::InitializeProcess() before, which is usually the case for addons
|
|
1554
|
+
// loaded by the stand-alone Node.js executable. Embedders of Node.js can use
|
|
1555
|
+
// either need to call it themselves or make sure that
|
|
1556
|
+
// ProcessInitializationFlags::kNoInitializeCppgc is *not* set for cppgc to
|
|
1557
|
+
// work.
|
|
1558
|
+
// If the CppHeap is owned by Node.js, which is usually the case for addon,
|
|
1559
|
+
// the object must be created with at least two internal fields available,
|
|
1560
|
+
// and the first two internal fields would be configured by Node.js.
|
|
1561
|
+
// This may be superseded by a V8 API in the future, see
|
|
1562
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=13960. Until then this
|
|
1563
|
+
// serves as a helper for Node.js isolates.
|
|
1564
|
+
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
|
1565
|
+
v8::Local<v8::Object> object,
|
|
1566
|
+
void* wrappable);
|
|
1567
|
+
|
|
1171
1568
|
} // namespace node
|
|
1172
1569
|
|
|
1173
1570
|
#endif // SRC_NODE_H_
|