@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.0 → 22.22.3-kf.1
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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/index.js +5 -0
- package/libnode.release.json +8 -0
- package/package.json +29 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#ifndef SRC_NODE_CONTEXT_DATA_H_
|
|
2
|
+
#define SRC_NODE_CONTEXT_DATA_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "util.h"
|
|
7
|
+
#include "v8.h"
|
|
8
|
+
|
|
9
|
+
namespace node {
|
|
10
|
+
|
|
11
|
+
// Pick an index that's hopefully out of the way when we're embedded inside
|
|
12
|
+
// another application. Performance-wise or memory-wise it doesn't matter:
|
|
13
|
+
// Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray,
|
|
14
|
+
// worst case we pay a one-time penalty for resizing the array.
|
|
15
|
+
#ifndef NODE_CONTEXT_EMBEDDER_DATA_INDEX
|
|
16
|
+
#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#ifndef NODE_CONTEXT_SANDBOX_OBJECT_INDEX
|
|
20
|
+
#define NODE_CONTEXT_SANDBOX_OBJECT_INDEX 33
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#ifndef NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX
|
|
24
|
+
#define NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX 34
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#ifndef NODE_BINDING_DATA_STORE_INDEX
|
|
28
|
+
#define NODE_BINDING_DATA_STORE_INDEX 35
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#ifndef NODE_CONTEXT_ALLOW_CODE_GENERATION_FROM_STRINGS_INDEX
|
|
32
|
+
#define NODE_CONTEXT_ALLOW_CODE_GENERATION_FROM_STRINGS_INDEX 36
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#ifndef NODE_CONTEXT_CONTEXTIFY_CONTEXT_INDEX
|
|
36
|
+
#define NODE_CONTEXT_CONTEXTIFY_CONTEXT_INDEX 37
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef NODE_CONTEXT_REALM_INDEX
|
|
40
|
+
#define NODE_CONTEXT_REALM_INDEX 38
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
// NODE_CONTEXT_TAG must be greater than any embedder indexes so that a single
|
|
44
|
+
// check on the number of embedder data fields can assure the presence of all
|
|
45
|
+
// embedder indexes.
|
|
46
|
+
#ifndef NODE_CONTEXT_TAG
|
|
47
|
+
#define NODE_CONTEXT_TAG 39
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* These are indexes used to set Node.js-specific data in the V8 contexts
|
|
52
|
+
* via v8::Context::SetAlignedPointerInEmbedderData() (for pointers) and
|
|
53
|
+
* v8::Context::SetEmbedderData() (for v8::Values).
|
|
54
|
+
*
|
|
55
|
+
* There are five types of contexts in Node.js:
|
|
56
|
+
* 1. Default V8 context, with nothing Node.js-specific. This is normally only
|
|
57
|
+
* created by the embedders that uses v8::Context APIs directly and is not
|
|
58
|
+
* available through the Node.js JS APIs. Its context snapshot in the
|
|
59
|
+
* built-in v8 startup snapshot is stored using
|
|
60
|
+
* v8::SnapshotCreator::SetDefaultContext() - effectively at index 0.
|
|
61
|
+
* 2. Default Node.js main context. When Node.js is launched typically there is
|
|
62
|
+
* a main thread on which a main node::Environment is created. The
|
|
63
|
+
* Environment is associated with its own v8::Isolate (env->isolate()) and a
|
|
64
|
+
* main v8::Context (env->context()). The corresponding data structure is
|
|
65
|
+
* node::NodeMainInstance and the Environment is created in
|
|
66
|
+
* node::NodeMainInstance::Run(). Its context snapshot in the built-in V8
|
|
67
|
+
* startup snapshot is stored at node::SnapshotData::kNodeMainContextIndex.
|
|
68
|
+
* 3. Node.js worker context. When a Worker instance is created via
|
|
69
|
+
* new worker_threads.Worker(), it gets its own OS thread, its
|
|
70
|
+
* own node::Environment, its own v8::Isolate and its own v8::Context.
|
|
71
|
+
* The corresponding data structure is node::Worker and the Environment
|
|
72
|
+
* is created in node::Worker::Run().
|
|
73
|
+
* Its context snapshot in the built-in V8 startup snapshot is stored at
|
|
74
|
+
* node::SnapshotData::kNodeBaseContextIndex.
|
|
75
|
+
* 4. Contextified vm context: When a contextified context is created via
|
|
76
|
+
* vm.createContext() or other related vm APIs, the vm.Context instance
|
|
77
|
+
* gets its own v8::Context. It shares the thread, the v8::Isolate and
|
|
78
|
+
* the node::Environment with the context where the vm APIs are called.
|
|
79
|
+
* The corresponding data structure is node::ContextifyContext and
|
|
80
|
+
* the initialization code is in node::ContextifyContext::New().
|
|
81
|
+
* Its context snapshot in the built-in V8 startup snapshot is stored at
|
|
82
|
+
* node::SnapshotData::kNodeVMContextIndex.
|
|
83
|
+
* 5. ShadowRealm context: When a JS ShadowRealm is created via new ShadowRealm,
|
|
84
|
+
* it gets its own v8::Context. It also shares the thread, the v8::Isolate
|
|
85
|
+
* and the node::Environment with the context where the ShadowRealm
|
|
86
|
+
* constructor is called. The corresponding data structure is
|
|
87
|
+
* node::ShadowRealm and the initialization code is in
|
|
88
|
+
* node::ShadowRealm::New().
|
|
89
|
+
*/
|
|
90
|
+
enum ContextEmbedderIndex {
|
|
91
|
+
// Pointer to the node::Environment associated with the context. Only set for
|
|
92
|
+
// context type 2-5. Used by Environment::GetCurrent(context) to retrieve
|
|
93
|
+
// the node::Environment associated with any Node.js context in the
|
|
94
|
+
// V8 callbacks.
|
|
95
|
+
kEnvironment = NODE_CONTEXT_EMBEDDER_DATA_INDEX,
|
|
96
|
+
// A v8::Value which is the sandbox object used to create the contextified vm
|
|
97
|
+
// context. For example the first argument of vm.createContext().
|
|
98
|
+
// Only set for context type 4 and used in ContextifyContext methods.
|
|
99
|
+
kSandboxObject = NODE_CONTEXT_SANDBOX_OBJECT_INDEX,
|
|
100
|
+
// A v8::Value indicating whether the context allows WebAssembly code
|
|
101
|
+
// generation.
|
|
102
|
+
// Only set for context type 2-5, and for them the default is v8::True.
|
|
103
|
+
// For context type 4 it's configurable via options.codeGeneration.wasm in the
|
|
104
|
+
// vm APIs. Used in the default v8::AllowWasmCodeGenerationCallback.
|
|
105
|
+
kAllowWasmCodeGeneration = NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX,
|
|
106
|
+
// A v8::Value indicating whether the context allows code generation via
|
|
107
|
+
// eval() or new Function().
|
|
108
|
+
// Only set for context type 2-5, and for them the default is v8::True.
|
|
109
|
+
// For context type 4 it's configurable via options.codeGeneration.strings in
|
|
110
|
+
// the
|
|
111
|
+
// vm APIs. Used in the default v8::AllowCodeGenerationFromStringsCallback.
|
|
112
|
+
kAllowCodeGenerationFromStrings =
|
|
113
|
+
NODE_CONTEXT_ALLOW_CODE_GENERATION_FROM_STRINGS_INDEX,
|
|
114
|
+
// Pointer to the node::ContextifyContext associated with vm.Contexts.
|
|
115
|
+
// Only set for context type 4. Used by ContextifyContext::Get() to get
|
|
116
|
+
// to the ContextifyContext from the property interceptors.
|
|
117
|
+
kContextifyContext = NODE_CONTEXT_CONTEXTIFY_CONTEXT_INDEX,
|
|
118
|
+
// Pointer to the node::Realm associated with the context.
|
|
119
|
+
// Only set for context type 2-3 and 5. For context type 2-3, it points to a
|
|
120
|
+
// node::PrincipalRealm. For context type 5 it points to a node::ShadowRealm.
|
|
121
|
+
// Used by Realm::GetCurrent(context) to retrieve the associated node::Realm
|
|
122
|
+
// with any Node.js context in the V8 callbacks.
|
|
123
|
+
kRealm = NODE_CONTEXT_REALM_INDEX,
|
|
124
|
+
// Pointer to a constant address which is
|
|
125
|
+
// node::ContextEmbedderTag::kNodeContextTagPtr.
|
|
126
|
+
// Only set for context type 2-5. Used by ContextEmbedderTag::IsNodeContext()
|
|
127
|
+
// to check whether a context is a Node.js context.
|
|
128
|
+
kContextTag = NODE_CONTEXT_TAG,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
class ContextEmbedderTag {
|
|
132
|
+
public:
|
|
133
|
+
static inline void TagNodeContext(v8::Local<v8::Context> context) {
|
|
134
|
+
// Used by ContextEmbedderTag::IsNodeContext to know that we are on a node
|
|
135
|
+
// context.
|
|
136
|
+
context->SetAlignedPointerInEmbedderData(
|
|
137
|
+
ContextEmbedderIndex::kContextTag,
|
|
138
|
+
ContextEmbedderTag::kNodeContextTagPtr);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static inline bool IsNodeContext(v8::Local<v8::Context> context) {
|
|
142
|
+
if (context.IsEmpty()) [[unlikely]] {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (context->GetNumberOfEmbedderDataFields() <=
|
|
146
|
+
ContextEmbedderIndex::kContextTag) [[unlikely]] {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
if (context->GetAlignedPointerFromEmbedderData(
|
|
150
|
+
ContextEmbedderIndex::kContextTag) !=
|
|
151
|
+
ContextEmbedderTag::kNodeContextTagPtr) [[unlikely]] {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private:
|
|
158
|
+
static void* const kNodeContextTagPtr;
|
|
159
|
+
static int const kNodeContextTag;
|
|
160
|
+
|
|
161
|
+
ContextEmbedderTag() = delete;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
} // namespace node
|
|
165
|
+
|
|
166
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
167
|
+
|
|
168
|
+
#endif // SRC_NODE_CONTEXT_DATA_H_
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#ifndef SRC_NODE_CONTEXTIFY_H_
|
|
2
|
+
#define SRC_NODE_CONTEXTIFY_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "base_object-inl.h"
|
|
7
|
+
#include "node_context_data.h"
|
|
8
|
+
#include "node_errors.h"
|
|
9
|
+
|
|
10
|
+
namespace node {
|
|
11
|
+
class ExternalReferenceRegistry;
|
|
12
|
+
|
|
13
|
+
namespace contextify {
|
|
14
|
+
|
|
15
|
+
struct ContextOptions {
|
|
16
|
+
v8::Local<v8::String> name;
|
|
17
|
+
v8::Local<v8::String> origin;
|
|
18
|
+
v8::Local<v8::Boolean> allow_code_gen_strings;
|
|
19
|
+
v8::Local<v8::Boolean> allow_code_gen_wasm;
|
|
20
|
+
std::unique_ptr<v8::MicrotaskQueue> own_microtask_queue;
|
|
21
|
+
v8::Local<v8::Symbol> host_defined_options_id;
|
|
22
|
+
bool vanilla = false;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
class ContextifyContext : public BaseObject {
|
|
26
|
+
public:
|
|
27
|
+
ContextifyContext(Environment* env,
|
|
28
|
+
v8::Local<v8::Object> wrapper,
|
|
29
|
+
v8::Local<v8::Context> v8_context,
|
|
30
|
+
ContextOptions* options);
|
|
31
|
+
~ContextifyContext();
|
|
32
|
+
|
|
33
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
34
|
+
SET_MEMORY_INFO_NAME(ContextifyContext)
|
|
35
|
+
SET_SELF_SIZE(ContextifyContext)
|
|
36
|
+
|
|
37
|
+
static v8::MaybeLocal<v8::Context> CreateV8Context(
|
|
38
|
+
v8::Isolate* isolate,
|
|
39
|
+
v8::Local<v8::ObjectTemplate> object_template,
|
|
40
|
+
const SnapshotData* snapshot_data,
|
|
41
|
+
v8::MicrotaskQueue* queue);
|
|
42
|
+
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
43
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
44
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
45
|
+
|
|
46
|
+
static ContextifyContext* ContextFromContextifiedSandbox(
|
|
47
|
+
Environment* env, const v8::Local<v8::Object>& wrapper_holder);
|
|
48
|
+
|
|
49
|
+
inline v8::Local<v8::Context> context() const {
|
|
50
|
+
return PersistentToLocal::Default(env()->isolate(), context_);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
inline v8::Local<v8::Object> global_proxy() const {
|
|
54
|
+
return context()->Global();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
inline v8::Local<v8::Object> sandbox() const {
|
|
58
|
+
// Only vanilla contexts have undefined sandboxes. sandbox() is only used by
|
|
59
|
+
// interceptors who are not supposed to be called on vanilla contexts.
|
|
60
|
+
v8::Local<v8::Value> result =
|
|
61
|
+
context()->GetEmbedderData(ContextEmbedderIndex::kSandboxObject);
|
|
62
|
+
CHECK(!result->IsUndefined());
|
|
63
|
+
return result.As<v8::Object>();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
inline v8::MicrotaskQueue* microtask_queue() const {
|
|
67
|
+
return microtask_queue_.get();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
template <typename T>
|
|
71
|
+
static ContextifyContext* Get(const v8::PropertyCallbackInfo<T>& args);
|
|
72
|
+
static ContextifyContext* Get(v8::Local<v8::Object> object);
|
|
73
|
+
|
|
74
|
+
static void InitializeGlobalTemplates(IsolateData* isolate_data);
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
static BaseObjectPtr<ContextifyContext> New(Environment* env,
|
|
78
|
+
v8::Local<v8::Object> sandbox_obj,
|
|
79
|
+
ContextOptions* options);
|
|
80
|
+
// Initialize a context created from CreateV8Context()
|
|
81
|
+
static BaseObjectPtr<ContextifyContext> New(v8::Local<v8::Context> ctx,
|
|
82
|
+
Environment* env,
|
|
83
|
+
v8::Local<v8::Object> sandbox_obj,
|
|
84
|
+
ContextOptions* options);
|
|
85
|
+
|
|
86
|
+
static bool IsStillInitializing(const ContextifyContext* ctx);
|
|
87
|
+
static void MakeContext(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
88
|
+
static void IsContext(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
89
|
+
static v8::Intercepted PropertyQueryCallback(
|
|
90
|
+
v8::Local<v8::Name> property,
|
|
91
|
+
const v8::PropertyCallbackInfo<v8::Integer>& args);
|
|
92
|
+
static v8::Intercepted PropertyGetterCallback(
|
|
93
|
+
v8::Local<v8::Name> property,
|
|
94
|
+
const v8::PropertyCallbackInfo<v8::Value>& args);
|
|
95
|
+
static v8::Intercepted PropertySetterCallback(
|
|
96
|
+
v8::Local<v8::Name> property,
|
|
97
|
+
v8::Local<v8::Value> value,
|
|
98
|
+
const v8::PropertyCallbackInfo<void>& args);
|
|
99
|
+
static v8::Intercepted PropertyDescriptorCallback(
|
|
100
|
+
v8::Local<v8::Name> property,
|
|
101
|
+
const v8::PropertyCallbackInfo<v8::Value>& args);
|
|
102
|
+
static v8::Intercepted PropertyDefinerCallback(
|
|
103
|
+
v8::Local<v8::Name> property,
|
|
104
|
+
const v8::PropertyDescriptor& desc,
|
|
105
|
+
const v8::PropertyCallbackInfo<void>& args);
|
|
106
|
+
static v8::Intercepted PropertyDeleterCallback(
|
|
107
|
+
v8::Local<v8::Name> property,
|
|
108
|
+
const v8::PropertyCallbackInfo<v8::Boolean>& args);
|
|
109
|
+
static void PropertyEnumeratorCallback(
|
|
110
|
+
const v8::PropertyCallbackInfo<v8::Array>& args);
|
|
111
|
+
static v8::Intercepted IndexedPropertyQueryCallback(
|
|
112
|
+
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& args);
|
|
113
|
+
static v8::Intercepted IndexedPropertyGetterCallback(
|
|
114
|
+
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
|
|
115
|
+
static v8::Intercepted IndexedPropertySetterCallback(
|
|
116
|
+
uint32_t index,
|
|
117
|
+
v8::Local<v8::Value> value,
|
|
118
|
+
const v8::PropertyCallbackInfo<void>& args);
|
|
119
|
+
static v8::Intercepted IndexedPropertyDescriptorCallback(
|
|
120
|
+
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
|
|
121
|
+
static v8::Intercepted IndexedPropertyDefinerCallback(
|
|
122
|
+
uint32_t index,
|
|
123
|
+
const v8::PropertyDescriptor& desc,
|
|
124
|
+
const v8::PropertyCallbackInfo<void>& args);
|
|
125
|
+
static v8::Intercepted IndexedPropertyDeleterCallback(
|
|
126
|
+
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& args);
|
|
127
|
+
static void IndexedPropertyEnumeratorCallback(
|
|
128
|
+
const v8::PropertyCallbackInfo<v8::Array>& args);
|
|
129
|
+
|
|
130
|
+
v8::Global<v8::Context> context_;
|
|
131
|
+
std::unique_ptr<v8::MicrotaskQueue> microtask_queue_;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
class ContextifyScript : public BaseObject {
|
|
135
|
+
public:
|
|
136
|
+
enum InternalFields {
|
|
137
|
+
kUnboundScriptSlot = BaseObject::kInternalFieldCount,
|
|
138
|
+
kInternalFieldCount
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
SET_NO_MEMORY_INFO()
|
|
142
|
+
SET_MEMORY_INFO_NAME(ContextifyScript)
|
|
143
|
+
SET_SELF_SIZE(ContextifyScript)
|
|
144
|
+
|
|
145
|
+
ContextifyScript(Environment* env, v8::Local<v8::Object> object);
|
|
146
|
+
~ContextifyScript() override;
|
|
147
|
+
|
|
148
|
+
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
149
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
150
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
151
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
152
|
+
static bool InstanceOf(Environment* env, const v8::Local<v8::Value>& args);
|
|
153
|
+
static void CreateCachedData(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
154
|
+
static void RunInContext(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
155
|
+
static bool EvalMachine(v8::Local<v8::Context> context,
|
|
156
|
+
Environment* env,
|
|
157
|
+
const int64_t timeout,
|
|
158
|
+
const bool display_errors,
|
|
159
|
+
const bool break_on_sigint,
|
|
160
|
+
const bool break_on_first_line,
|
|
161
|
+
v8::MicrotaskQueue* microtask_queue,
|
|
162
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
163
|
+
|
|
164
|
+
private:
|
|
165
|
+
v8::Global<v8::UnboundScript> script_;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
class ContextifyFunction final {
|
|
169
|
+
public:
|
|
170
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
171
|
+
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
172
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
173
|
+
|
|
174
|
+
static void CompileFunction(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
175
|
+
static v8::MaybeLocal<v8::Object> CompileFunctionAndCacheResult(
|
|
176
|
+
Environment* env,
|
|
177
|
+
v8::Local<v8::Context> parsing_context,
|
|
178
|
+
v8::ScriptCompiler::Source* source,
|
|
179
|
+
v8::LocalVector<v8::String> params,
|
|
180
|
+
v8::LocalVector<v8::Object> context_extensions,
|
|
181
|
+
v8::ScriptCompiler::CompileOptions options,
|
|
182
|
+
bool produce_cached_data,
|
|
183
|
+
v8::Local<v8::Symbol> id_symbol,
|
|
184
|
+
const errors::TryCatchScope& try_catch);
|
|
185
|
+
|
|
186
|
+
private:
|
|
187
|
+
ContextifyFunction() = delete;
|
|
188
|
+
~ContextifyFunction() = delete;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
v8::Maybe<void> StoreCodeCacheResult(
|
|
192
|
+
Environment* env,
|
|
193
|
+
v8::Local<v8::Object> target,
|
|
194
|
+
v8::ScriptCompiler::CompileOptions compile_options,
|
|
195
|
+
const v8::ScriptCompiler::Source& source,
|
|
196
|
+
bool produce_cached_data,
|
|
197
|
+
std::unique_ptr<v8::ScriptCompiler::CachedData> new_cached_data);
|
|
198
|
+
|
|
199
|
+
} // namespace contextify
|
|
200
|
+
} // namespace node
|
|
201
|
+
|
|
202
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
203
|
+
|
|
204
|
+
#endif // SRC_NODE_CONTEXTIFY_H_
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
#ifndef SRC_NODE_CRYPTO_H_
|
|
23
|
+
#define SRC_NODE_CRYPTO_H_
|
|
24
|
+
|
|
25
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
+
|
|
27
|
+
// All of the crypto definitions previously contained in this header
|
|
28
|
+
// have been split across multiple headers in src/crypto. This header
|
|
29
|
+
// remains for convenience for any code that still imports it. New
|
|
30
|
+
// code should include the relevant src/crypto headers directly.
|
|
31
|
+
#include "crypto/crypto_aes.h"
|
|
32
|
+
#include "crypto/crypto_bio.h"
|
|
33
|
+
#include "crypto/crypto_cipher.h"
|
|
34
|
+
#include "crypto/crypto_context.h"
|
|
35
|
+
#include "crypto/crypto_dh.h"
|
|
36
|
+
#include "crypto/crypto_dsa.h"
|
|
37
|
+
#include "crypto/crypto_ec.h"
|
|
38
|
+
#include "crypto/crypto_hash.h"
|
|
39
|
+
#include "crypto/crypto_hkdf.h"
|
|
40
|
+
#include "crypto/crypto_hmac.h"
|
|
41
|
+
#include "crypto/crypto_keygen.h"
|
|
42
|
+
#include "crypto/crypto_keys.h"
|
|
43
|
+
#include "crypto/crypto_pbkdf2.h"
|
|
44
|
+
#include "crypto/crypto_random.h"
|
|
45
|
+
#include "crypto/crypto_rsa.h"
|
|
46
|
+
#include "crypto/crypto_scrypt.h"
|
|
47
|
+
#include "crypto/crypto_sig.h"
|
|
48
|
+
#include "crypto/crypto_spkac.h"
|
|
49
|
+
#include "crypto/crypto_timing.h"
|
|
50
|
+
#include "crypto/crypto_tls.h"
|
|
51
|
+
#include "crypto/crypto_util.h"
|
|
52
|
+
#include "crypto/crypto_x509.h"
|
|
53
|
+
|
|
54
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
55
|
+
|
|
56
|
+
#endif // SRC_NODE_CRYPTO_H_
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
4
|
+
|
|
5
|
+
#ifdef DEBUG
|
|
6
|
+
#include "util.h"
|
|
7
|
+
#endif // DEBUG
|
|
8
|
+
|
|
9
|
+
namespace node {
|
|
10
|
+
namespace debug {
|
|
11
|
+
|
|
12
|
+
#ifdef DEBUG
|
|
13
|
+
void TrackV8FastApiCall(FastStringKey key);
|
|
14
|
+
int GetV8FastApiCallCount(FastStringKey key);
|
|
15
|
+
|
|
16
|
+
void CountGenericUsage(FastStringKey counter_name);
|
|
17
|
+
#define COUNT_GENERIC_USAGE(name) \
|
|
18
|
+
node::debug::CountGenericUsage(FastStringKey(name))
|
|
19
|
+
|
|
20
|
+
#define TRACK_V8_FAST_API_CALL(key) \
|
|
21
|
+
node::debug::TrackV8FastApiCall(FastStringKey(key))
|
|
22
|
+
#else // !DEBUG
|
|
23
|
+
#define TRACK_V8_FAST_API_CALL(key)
|
|
24
|
+
#define COUNT_GENERIC_USAGE(name)
|
|
25
|
+
#endif // DEBUG
|
|
26
|
+
|
|
27
|
+
} // namespace debug
|
|
28
|
+
} // namespace node
|
|
29
|
+
|
|
30
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#ifndef SRC_NODE_DIR_H_
|
|
2
|
+
#define SRC_NODE_DIR_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "node_file.h"
|
|
7
|
+
|
|
8
|
+
namespace node {
|
|
9
|
+
|
|
10
|
+
namespace fs_dir {
|
|
11
|
+
|
|
12
|
+
// Needed to propagate `uv_dir_t`.
|
|
13
|
+
class DirHandle : public AsyncWrap {
|
|
14
|
+
public:
|
|
15
|
+
static DirHandle* New(Environment* env, uv_dir_t* dir);
|
|
16
|
+
~DirHandle() override;
|
|
17
|
+
|
|
18
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
19
|
+
static void Read(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
20
|
+
static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
21
|
+
|
|
22
|
+
inline uv_dir_t* dir() { return dir_; }
|
|
23
|
+
|
|
24
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
25
|
+
SET_MEMORY_INFO_NAME(DirHandle)
|
|
26
|
+
SET_SELF_SIZE(DirHandle)
|
|
27
|
+
|
|
28
|
+
DirHandle(const DirHandle&) = delete;
|
|
29
|
+
DirHandle& operator=(const DirHandle&) = delete;
|
|
30
|
+
DirHandle(const DirHandle&&) = delete;
|
|
31
|
+
DirHandle& operator=(const DirHandle&&) = delete;
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
DirHandle(Environment* env, v8::Local<v8::Object> obj, uv_dir_t* dir);
|
|
35
|
+
|
|
36
|
+
// Synchronous close that emits a warning
|
|
37
|
+
void GCClose();
|
|
38
|
+
|
|
39
|
+
uv_dir_t* dir_;
|
|
40
|
+
// Multiple entries are read through a single libuv call.
|
|
41
|
+
std::vector<uv_dirent_t> dirents_;
|
|
42
|
+
bool closing_ = false;
|
|
43
|
+
bool closed_ = false;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace fs_dir
|
|
47
|
+
|
|
48
|
+
} // namespace node
|
|
49
|
+
|
|
50
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
51
|
+
|
|
52
|
+
#endif // SRC_NODE_DIR_H_
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#ifndef SRC_NODE_DOTENV_H_
|
|
2
|
+
#define SRC_NODE_DOTENV_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include "util-inl.h"
|
|
7
|
+
#include "v8.h"
|
|
8
|
+
|
|
9
|
+
#include <map>
|
|
10
|
+
|
|
11
|
+
namespace node {
|
|
12
|
+
|
|
13
|
+
class Dotenv {
|
|
14
|
+
public:
|
|
15
|
+
enum ParseResult { Valid, FileError, InvalidContent };
|
|
16
|
+
struct env_file_data {
|
|
17
|
+
std::string path;
|
|
18
|
+
bool is_optional;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Dotenv() = default;
|
|
22
|
+
Dotenv(const Dotenv& d) = delete;
|
|
23
|
+
Dotenv(Dotenv&& d) noexcept = default;
|
|
24
|
+
Dotenv& operator=(Dotenv&& d) noexcept = default;
|
|
25
|
+
Dotenv& operator=(const Dotenv& d) = delete;
|
|
26
|
+
~Dotenv() = default;
|
|
27
|
+
|
|
28
|
+
void ParseContent(const std::string_view content);
|
|
29
|
+
ParseResult ParsePath(const std::string_view path);
|
|
30
|
+
void AssignNodeOptionsIfAvailable(std::string* node_options) const;
|
|
31
|
+
v8::Maybe<void> SetEnvironment(Environment* env);
|
|
32
|
+
v8::MaybeLocal<v8::Object> ToObject(Environment* env) const;
|
|
33
|
+
|
|
34
|
+
static std::vector<env_file_data> GetDataFromArgs(
|
|
35
|
+
const std::vector<std::string>& args);
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
std::map<std::string, std::string> store_;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace node
|
|
42
|
+
|
|
43
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
44
|
+
|
|
45
|
+
#endif // SRC_NODE_DOTENV_H_
|