@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.
Files changed (343) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/dist/node/include/acorn_version.h +6 -0
  4. package/dist/node/include/aliased_buffer-inl.h +244 -0
  5. package/dist/node/include/aliased_buffer.h +206 -0
  6. package/dist/node/include/aliased_struct-inl.h +54 -0
  7. package/dist/node/include/aliased_struct.h +63 -0
  8. package/dist/node/include/amaro_version.h +6 -0
  9. package/dist/node/include/async_context_frame.h +33 -0
  10. package/dist/node/include/async_wrap-inl.h +96 -0
  11. package/dist/node/include/async_wrap.h +243 -0
  12. package/dist/node/include/base_object-inl.h +335 -0
  13. package/dist/node/include/base_object.h +342 -0
  14. package/dist/node/include/base_object_types.h +74 -0
  15. package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
  16. package/dist/node/include/blob_serializer_deserializer.h +132 -0
  17. package/dist/node/include/callback_queue-inl.h +97 -0
  18. package/dist/node/include/callback_queue.h +79 -0
  19. package/dist/node/include/cares_wrap.h +447 -0
  20. package/dist/node/include/cjs_module_lexer_version.h +6 -0
  21. package/dist/node/include/cleanup_queue-inl.h +36 -0
  22. package/dist/node/include/cleanup_queue.h +79 -0
  23. package/dist/node/include/compile_cache.h +104 -0
  24. package/dist/node/include/connect_wrap.h +26 -0
  25. package/dist/node/include/connection_wrap.h +30 -0
  26. package/dist/node/include/cppgc/allocation.h +310 -0
  27. package/dist/node/include/cppgc/common.h +28 -0
  28. package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
  29. package/dist/node/include/cppgc/custom-space.h +97 -0
  30. package/dist/node/include/cppgc/default-platform.h +67 -0
  31. package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
  32. package/dist/node/include/cppgc/explicit-management.h +100 -0
  33. package/dist/node/include/cppgc/garbage-collected.h +106 -0
  34. package/dist/node/include/cppgc/heap-consistency.h +309 -0
  35. package/dist/node/include/cppgc/heap-handle.h +48 -0
  36. package/dist/node/include/cppgc/heap-state.h +82 -0
  37. package/dist/node/include/cppgc/heap-statistics.h +120 -0
  38. package/dist/node/include/cppgc/heap.h +202 -0
  39. package/dist/node/include/cppgc/internal/api-constants.h +87 -0
  40. package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
  41. package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
  42. package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
  43. package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
  44. package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
  45. package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
  46. package/dist/node/include/cppgc/internal/gc-info.h +148 -0
  47. package/dist/node/include/cppgc/internal/logging.h +50 -0
  48. package/dist/node/include/cppgc/internal/member-storage.h +256 -0
  49. package/dist/node/include/cppgc/internal/name-trait.h +137 -0
  50. package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
  51. package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
  52. package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
  53. package/dist/node/include/cppgc/liveness-broker.h +78 -0
  54. package/dist/node/include/cppgc/macros.h +35 -0
  55. package/dist/node/include/cppgc/member.h +629 -0
  56. package/dist/node/include/cppgc/name-provider.h +65 -0
  57. package/dist/node/include/cppgc/object-size-trait.h +58 -0
  58. package/dist/node/include/cppgc/persistent.h +377 -0
  59. package/dist/node/include/cppgc/platform.h +163 -0
  60. package/dist/node/include/cppgc/prefinalizer.h +75 -0
  61. package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
  62. package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
  63. package/dist/node/include/cppgc/source-location.h +16 -0
  64. package/dist/node/include/cppgc/testing.h +106 -0
  65. package/dist/node/include/cppgc/trace-trait.h +128 -0
  66. package/dist/node/include/cppgc/type-traits.h +271 -0
  67. package/dist/node/include/cppgc/visitor.h +504 -0
  68. package/dist/node/include/crypto/crypto_aes.h +88 -0
  69. package/dist/node/include/crypto/crypto_bio.h +193 -0
  70. package/dist/node/include/crypto/crypto_cipher.h +293 -0
  71. package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
  72. package/dist/node/include/crypto/crypto_clienthello.h +131 -0
  73. package/dist/node/include/crypto/crypto_common.h +64 -0
  74. package/dist/node/include/crypto/crypto_context.h +171 -0
  75. package/dist/node/include/crypto/crypto_dh.h +126 -0
  76. package/dist/node/include/crypto/crypto_dsa.h +52 -0
  77. package/dist/node/include/crypto/crypto_ec.h +164 -0
  78. package/dist/node/include/crypto/crypto_hash.h +91 -0
  79. package/dist/node/include/crypto/crypto_hkdf.h +61 -0
  80. package/dist/node/include/crypto/crypto_hmac.h +92 -0
  81. package/dist/node/include/crypto/crypto_keygen.h +299 -0
  82. package/dist/node/include/crypto/crypto_keys.h +392 -0
  83. package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
  84. package/dist/node/include/crypto/crypto_random.h +124 -0
  85. package/dist/node/include/crypto/crypto_rsa.h +136 -0
  86. package/dist/node/include/crypto/crypto_scrypt.h +85 -0
  87. package/dist/node/include/crypto/crypto_sig.h +165 -0
  88. package/dist/node/include/crypto/crypto_spkac.h +21 -0
  89. package/dist/node/include/crypto/crypto_timing.h +20 -0
  90. package/dist/node/include/crypto/crypto_tls.h +305 -0
  91. package/dist/node/include/crypto/crypto_util.h +725 -0
  92. package/dist/node/include/crypto/crypto_x509.h +140 -0
  93. package/dist/node/include/dataqueue/queue.h +306 -0
  94. package/dist/node/include/debug_utils-inl.h +278 -0
  95. package/dist/node/include/debug_utils.h +196 -0
  96. package/dist/node/include/diagnosticfilename-inl.h +33 -0
  97. package/dist/node/include/embedded_data.h +17 -0
  98. package/dist/node/include/encoding_binding.h +61 -0
  99. package/dist/node/include/env-inl.h +984 -0
  100. package/dist/node/include/env.h +1287 -0
  101. package/dist/node/include/env_properties.h +540 -0
  102. package/dist/node/include/handle_wrap.h +123 -0
  103. package/dist/node/include/histogram-inl.h +107 -0
  104. package/dist/node/include/histogram.h +279 -0
  105. package/dist/node/include/inspector/io_agent.h +30 -0
  106. package/dist/node/include/inspector/main_thread_interface.h +116 -0
  107. package/dist/node/include/inspector/network_agent.h +94 -0
  108. package/dist/node/include/inspector/network_inspector.h +45 -0
  109. package/dist/node/include/inspector/network_requests_buffer.h +195 -0
  110. package/dist/node/include/inspector/network_resource_manager.h +29 -0
  111. package/dist/node/include/inspector/node_json.h +24 -0
  112. package/dist/node/include/inspector/node_string.h +101 -0
  113. package/dist/node/include/inspector/protocol_helper.h +27 -0
  114. package/dist/node/include/inspector/runtime_agent.h +41 -0
  115. package/dist/node/include/inspector/target_agent.h +75 -0
  116. package/dist/node/include/inspector/tracing_agent.h +43 -0
  117. package/dist/node/include/inspector/worker_agent.h +40 -0
  118. package/dist/node/include/inspector/worker_inspector.h +124 -0
  119. package/dist/node/include/inspector_agent.h +165 -0
  120. package/dist/node/include/inspector_io.h +78 -0
  121. package/dist/node/include/inspector_profiler.h +149 -0
  122. package/dist/node/include/inspector_socket.h +60 -0
  123. package/dist/node/include/inspector_socket_server.h +110 -0
  124. package/dist/node/include/js_native_api.h +607 -0
  125. package/dist/node/include/js_native_api_types.h +226 -0
  126. package/dist/node/include/js_native_api_v8.h +485 -0
  127. package/dist/node/include/js_native_api_v8_internals.h +45 -0
  128. package/dist/node/include/js_stream.h +52 -0
  129. package/dist/node/include/json_utils.h +172 -0
  130. package/dist/node/include/large_pages/node_large_page.h +34 -0
  131. package/dist/node/include/libplatform/libplatform-export.h +29 -0
  132. package/dist/node/include/libplatform/libplatform.h +112 -0
  133. package/dist/node/include/libplatform/v8-tracing.h +333 -0
  134. package/dist/node/include/memory_tracker-inl.h +359 -0
  135. package/dist/node/include/memory_tracker.h +289 -0
  136. package/dist/node/include/module_wrap.h +216 -0
  137. package/dist/node/include/node.h +1593 -0
  138. package/dist/node/include/node_api.h +265 -0
  139. package/dist/node/include/node_api_internals.h +48 -0
  140. package/dist/node/include/node_api_types.h +56 -0
  141. package/dist/node/include/node_binding.h +161 -0
  142. package/dist/node/include/node_blob.h +159 -0
  143. package/dist/node/include/node_bob-inl.h +36 -0
  144. package/dist/node/include/node_bob.h +107 -0
  145. package/dist/node/include/node_buffer.h +92 -0
  146. package/dist/node/include/node_builtins.h +220 -0
  147. package/dist/node/include/node_config_file.h +46 -0
  148. package/dist/node/include/node_constants.h +82 -0
  149. package/dist/node/include/node_context_data.h +168 -0
  150. package/dist/node/include/node_contextify.h +204 -0
  151. package/dist/node/include/node_crypto.h +56 -0
  152. package/dist/node/include/node_debug.h +30 -0
  153. package/dist/node/include/node_dir.h +52 -0
  154. package/dist/node/include/node_dotenv.h +45 -0
  155. package/dist/node/include/node_errors.h +380 -0
  156. package/dist/node/include/node_exit_code.h +54 -0
  157. package/dist/node/include/node_external_reference.h +165 -0
  158. package/dist/node/include/node_file-inl.h +406 -0
  159. package/dist/node/include/node_file.h +537 -0
  160. package/dist/node/include/node_http2.h +1177 -0
  161. package/dist/node/include/node_http2_state.h +159 -0
  162. package/dist/node/include/node_http_common-inl.h +202 -0
  163. package/dist/node/include/node_http_common.h +535 -0
  164. package/dist/node/include/node_i18n.h +132 -0
  165. package/dist/node/include/node_internals.h +483 -0
  166. package/dist/node/include/node_main_instance.h +67 -0
  167. package/dist/node/include/node_mem-inl.h +113 -0
  168. package/dist/node/include/node_mem.h +45 -0
  169. package/dist/node/include/node_messaging.h +389 -0
  170. package/dist/node/include/node_metadata.h +164 -0
  171. package/dist/node/include/node_modules.h +91 -0
  172. package/dist/node/include/node_mutex.h +323 -0
  173. package/dist/node/include/node_object_wrap.h +132 -0
  174. package/dist/node/include/node_options-inl.h +490 -0
  175. package/dist/node/include/node_options.h +615 -0
  176. package/dist/node/include/node_perf.h +166 -0
  177. package/dist/node/include/node_perf_common.h +102 -0
  178. package/dist/node/include/node_platform.h +238 -0
  179. package/dist/node/include/node_process-inl.h +26 -0
  180. package/dist/node/include/node_process.h +112 -0
  181. package/dist/node/include/node_realm-inl.h +151 -0
  182. package/dist/node/include/node_realm.h +183 -0
  183. package/dist/node/include/node_report.h +43 -0
  184. package/dist/node/include/node_revert.h +82 -0
  185. package/dist/node/include/node_root_certs.h +3520 -0
  186. package/dist/node/include/node_sea.h +74 -0
  187. package/dist/node/include/node_shadow_realm.h +46 -0
  188. package/dist/node/include/node_snapshot_builder.h +57 -0
  189. package/dist/node/include/node_snapshotable.h +174 -0
  190. package/dist/node/include/node_sockaddr-inl.h +257 -0
  191. package/dist/node/include/node_sockaddr.h +394 -0
  192. package/dist/node/include/node_sqlite.h +270 -0
  193. package/dist/node/include/node_stat_watcher.h +73 -0
  194. package/dist/node/include/node_task_runner.h +92 -0
  195. package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
  196. package/dist/node/include/node_threadsafe_cow.h +105 -0
  197. package/dist/node/include/node_union_bytes.h +81 -0
  198. package/dist/node/include/node_url.h +96 -0
  199. package/dist/node/include/node_v8.h +77 -0
  200. package/dist/node/include/node_v8_platform-inl.h +185 -0
  201. package/dist/node/include/node_version.h +110 -0
  202. package/dist/node/include/node_wasi.h +184 -0
  203. package/dist/node/include/node_wasm_web_api.h +55 -0
  204. package/dist/node/include/node_watchdog.h +154 -0
  205. package/dist/node/include/node_webstorage.h +60 -0
  206. package/dist/node/include/node_worker.h +158 -0
  207. package/dist/node/include/path.h +33 -0
  208. package/dist/node/include/permission/addon_permission.h +31 -0
  209. package/dist/node/include/permission/child_process_permission.h +31 -0
  210. package/dist/node/include/permission/fs_permission.h +167 -0
  211. package/dist/node/include/permission/inspector_permission.h +31 -0
  212. package/dist/node/include/permission/permission.h +138 -0
  213. package/dist/node/include/permission/permission_base.h +65 -0
  214. package/dist/node/include/permission/wasi_permission.h +31 -0
  215. package/dist/node/include/permission/worker_permission.h +31 -0
  216. package/dist/node/include/pipe_wrap.h +80 -0
  217. package/dist/node/include/quic/application.h +159 -0
  218. package/dist/node/include/quic/bindingdata.h +272 -0
  219. package/dist/node/include/quic/cid.h +127 -0
  220. package/dist/node/include/quic/data.h +148 -0
  221. package/dist/node/include/quic/defs.h +245 -0
  222. package/dist/node/include/quic/endpoint.h +458 -0
  223. package/dist/node/include/quic/http3.h +15 -0
  224. package/dist/node/include/quic/logstream.h +81 -0
  225. package/dist/node/include/quic/packet.h +152 -0
  226. package/dist/node/include/quic/preferredaddress.h +72 -0
  227. package/dist/node/include/quic/session.h +443 -0
  228. package/dist/node/include/quic/sessionticket.h +108 -0
  229. package/dist/node/include/quic/streams.h +232 -0
  230. package/dist/node/include/quic/tlscontext.h +227 -0
  231. package/dist/node/include/quic/tokens.h +256 -0
  232. package/dist/node/include/quic/transportparams.h +165 -0
  233. package/dist/node/include/req_wrap-inl.h +171 -0
  234. package/dist/node/include/req_wrap.h +77 -0
  235. package/dist/node/include/spawn_sync.h +243 -0
  236. package/dist/node/include/stream_base-inl.h +173 -0
  237. package/dist/node/include/stream_base.h +478 -0
  238. package/dist/node/include/stream_pipe.h +76 -0
  239. package/dist/node/include/stream_wrap.h +132 -0
  240. package/dist/node/include/string_bytes.h +113 -0
  241. package/dist/node/include/string_decoder-inl.h +31 -0
  242. package/dist/node/include/string_decoder.h +49 -0
  243. package/dist/node/include/tcp_wrap.h +105 -0
  244. package/dist/node/include/threadpoolwork-inl.h +70 -0
  245. package/dist/node/include/timer_wrap-inl.h +32 -0
  246. package/dist/node/include/timer_wrap.h +85 -0
  247. package/dist/node/include/timers.h +70 -0
  248. package/dist/node/include/tracing/agent.h +195 -0
  249. package/dist/node/include/tracing/node_trace_buffer.h +83 -0
  250. package/dist/node/include/tracing/node_trace_writer.h +75 -0
  251. package/dist/node/include/tracing/trace_event.h +722 -0
  252. package/dist/node/include/tracing/trace_event_common.h +1109 -0
  253. package/dist/node/include/tracing/traced_value.h +129 -0
  254. package/dist/node/include/tty_wrap.h +65 -0
  255. package/dist/node/include/udp_wrap.h +230 -0
  256. package/dist/node/include/undici_version.h +6 -0
  257. package/dist/node/include/util-inl.h +700 -0
  258. package/dist/node/include/util.h +1021 -0
  259. package/dist/node/include/uv/aix.h +32 -0
  260. package/dist/node/include/uv/bsd.h +34 -0
  261. package/dist/node/include/uv/darwin.h +61 -0
  262. package/dist/node/include/uv/errno.h +483 -0
  263. package/dist/node/include/uv/linux.h +34 -0
  264. package/dist/node/include/uv/os390.h +33 -0
  265. package/dist/node/include/uv/posix.h +31 -0
  266. package/dist/node/include/uv/sunos.h +44 -0
  267. package/dist/node/include/uv/threadpool.h +37 -0
  268. package/dist/node/include/uv/tree.h +521 -0
  269. package/dist/node/include/uv/unix.h +512 -0
  270. package/dist/node/include/uv/version.h +43 -0
  271. package/dist/node/include/uv/win.h +698 -0
  272. package/dist/node/include/uv.h +1990 -0
  273. package/dist/node/include/v8-array-buffer.h +525 -0
  274. package/dist/node/include/v8-callbacks.h +462 -0
  275. package/dist/node/include/v8-container.h +183 -0
  276. package/dist/node/include/v8-context.h +485 -0
  277. package/dist/node/include/v8-cppgc.h +245 -0
  278. package/dist/node/include/v8-data.h +80 -0
  279. package/dist/node/include/v8-date.h +48 -0
  280. package/dist/node/include/v8-debug.h +168 -0
  281. package/dist/node/include/v8-embedder-heap.h +82 -0
  282. package/dist/node/include/v8-embedder-state-scope.h +52 -0
  283. package/dist/node/include/v8-exception.h +223 -0
  284. package/dist/node/include/v8-extension.h +62 -0
  285. package/dist/node/include/v8-external.h +37 -0
  286. package/dist/node/include/v8-fast-api-calls.h +984 -0
  287. package/dist/node/include/v8-forward.h +82 -0
  288. package/dist/node/include/v8-function-callback.h +607 -0
  289. package/dist/node/include/v8-function.h +140 -0
  290. package/dist/node/include/v8-handle-base.h +137 -0
  291. package/dist/node/include/v8-initialization.h +289 -0
  292. package/dist/node/include/v8-inspector-protocol.h +13 -0
  293. package/dist/node/include/v8-inspector.h +419 -0
  294. package/dist/node/include/v8-internal.h +1397 -0
  295. package/dist/node/include/v8-isolate.h +1767 -0
  296. package/dist/node/include/v8-json.h +47 -0
  297. package/dist/node/include/v8-local-handle.h +758 -0
  298. package/dist/node/include/v8-locker.h +138 -0
  299. package/dist/node/include/v8-maybe.h +160 -0
  300. package/dist/node/include/v8-memory-span.h +198 -0
  301. package/dist/node/include/v8-message.h +233 -0
  302. package/dist/node/include/v8-metrics.h +264 -0
  303. package/dist/node/include/v8-microtask-queue.h +157 -0
  304. package/dist/node/include/v8-microtask.h +28 -0
  305. package/dist/node/include/v8-object.h +824 -0
  306. package/dist/node/include/v8-persistent-handle.h +582 -0
  307. package/dist/node/include/v8-platform.h +1358 -0
  308. package/dist/node/include/v8-primitive-object.h +118 -0
  309. package/dist/node/include/v8-primitive.h +877 -0
  310. package/dist/node/include/v8-profiler.h +1302 -0
  311. package/dist/node/include/v8-promise.h +174 -0
  312. package/dist/node/include/v8-proxy.h +50 -0
  313. package/dist/node/include/v8-regexp.h +106 -0
  314. package/dist/node/include/v8-script.h +904 -0
  315. package/dist/node/include/v8-snapshot.h +266 -0
  316. package/dist/node/include/v8-source-location.h +92 -0
  317. package/dist/node/include/v8-statistics.h +238 -0
  318. package/dist/node/include/v8-template.h +1297 -0
  319. package/dist/node/include/v8-traced-handle.h +432 -0
  320. package/dist/node/include/v8-typed-array.h +390 -0
  321. package/dist/node/include/v8-unwinder-state.h +31 -0
  322. package/dist/node/include/v8-unwinder.h +132 -0
  323. package/dist/node/include/v8-util.h +665 -0
  324. package/dist/node/include/v8-value-serializer-version.h +24 -0
  325. package/dist/node/include/v8-value-serializer.h +316 -0
  326. package/dist/node/include/v8-value.h +655 -0
  327. package/dist/node/include/v8-version-string.h +38 -0
  328. package/dist/node/include/v8-version.h +20 -0
  329. package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
  330. package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
  331. package/dist/node/include/v8-wasm.h +201 -0
  332. package/dist/node/include/v8-weak-callback-info.h +80 -0
  333. package/dist/node/include/v8.h +88 -0
  334. package/dist/node/include/v8config.h +981 -0
  335. package/dist/node/include/zlib_version.h +6 -0
  336. package/dist/node/libnode.dll +0 -0
  337. package/dist/node/libnode.lib +0 -0
  338. package/dist/node/libnodebuildinfo.json +10 -0
  339. package/dist/node/link_node.lib +0 -0
  340. package/dist/node/link_node.node +0 -0
  341. package/index.js +5 -0
  342. package/libnode.release.json +8 -0
  343. package/package.json +29 -1
@@ -0,0 +1,278 @@
1
+ #ifndef SRC_DEBUG_UTILS_INL_H_
2
+ #define SRC_DEBUG_UTILS_INL_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "debug_utils.h"
7
+ #include "env.h"
8
+ #include "util-inl.h"
9
+
10
+ #include <type_traits>
11
+
12
+ namespace node {
13
+
14
+ template <typename T>
15
+ concept StringViewConvertible = requires(T a) {
16
+ {
17
+ a.ToStringView()
18
+ } -> std::convertible_to<std::string_view>;
19
+ };
20
+ template <typename T>
21
+ concept StringConvertible = requires(T a) {
22
+ {
23
+ a.ToString()
24
+ } -> std::convertible_to<std::string>;
25
+ };
26
+ // For std::filesystem::path and similar types
27
+ template <typename T>
28
+ concept StringConvertibleFSPathLike = requires(T a) {
29
+ {
30
+ a.string()
31
+ } -> std::convertible_to<std::string>;
32
+ };
33
+
34
+ struct ToStringHelper {
35
+ template <typename T>
36
+ requires(StringConvertible<T>) && (!StringViewConvertible<T>)
37
+ static std::string Convert(const T& value) {
38
+ return value.ToString();
39
+ }
40
+ template <typename T>
41
+ requires(StringConvertibleFSPathLike<T>) && (!StringViewConvertible<T>) &&
42
+ (!StringConvertible<T>)
43
+ static std::string Convert(const T& value) {
44
+ return value.string();
45
+ }
46
+ template <typename T>
47
+ requires StringViewConvertible<T>
48
+ static std::string_view Convert(const T& value) {
49
+ return value.ToStringView();
50
+ }
51
+
52
+ template <typename T,
53
+ typename test_for_number = typename std::
54
+ enable_if_t<std::is_arithmetic_v<T> || std::is_enum_v<T>, bool>,
55
+ typename dummy = bool>
56
+ static std::string Convert(const T& value) {
57
+ return std::to_string(value);
58
+ }
59
+ static std::string_view Convert(const char* value) {
60
+ return value != nullptr ? value : "(null)";
61
+ }
62
+ static std::string Convert(const std::string& value) { return value; }
63
+ static std::string_view Convert(std::string_view value) { return value; }
64
+ static std::string Convert(bool value) { return value ? "true" : "false"; }
65
+ template <unsigned BASE_BITS,
66
+ typename T,
67
+ typename = std::enable_if_t<std::is_integral_v<T>>>
68
+ static std::string BaseConvert(const T& value) {
69
+ auto v = static_cast<uint64_t>(value);
70
+ char ret[3 * sizeof(T)];
71
+ char* ptr = ret + 3 * sizeof(T) - 1;
72
+ *ptr = '\0';
73
+ const char* digits = "0123456789abcdef";
74
+ do {
75
+ unsigned digit = v & ((1 << BASE_BITS) - 1);
76
+ *--ptr = (BASE_BITS < 4 ? static_cast<char>('0' + digit) : digits[digit]);
77
+ } while ((v >>= BASE_BITS) != 0);
78
+ return ptr;
79
+ }
80
+ template <unsigned BASE_BITS,
81
+ typename T,
82
+ typename = std::enable_if_t<!std::is_integral_v<T>>>
83
+ static auto BaseConvert(T&& value) {
84
+ return Convert(std::forward<T>(value));
85
+ }
86
+ };
87
+
88
+ template <typename T>
89
+ auto ToStringOrStringView(const T& value) {
90
+ return ToStringHelper::Convert(value);
91
+ }
92
+
93
+ template <typename T>
94
+ std::string ToString(const T& value) {
95
+ return std::string(ToStringOrStringView(value));
96
+ }
97
+
98
+ template <unsigned BASE_BITS, typename T>
99
+ auto ToBaseString(const T& value) {
100
+ return ToStringHelper::BaseConvert<BASE_BITS>(value);
101
+ }
102
+
103
+ inline std::string SPrintFImpl(std::string_view format) {
104
+ auto offset = format.find('%');
105
+ if (offset == std::string_view::npos) return std::string(format);
106
+ CHECK_LT(offset + 1, format.size());
107
+ CHECK_EQ(format[offset + 1],
108
+ '%'); // Only '%%' allowed when there are no arguments.
109
+
110
+ return std::string(format.substr(0, offset + 1)) +
111
+ SPrintFImpl(format.substr(offset + 2));
112
+ }
113
+
114
+ template <typename Arg, typename... Args>
115
+ std::string COLD_NOINLINE SPrintFImpl( // NOLINT(runtime/string)
116
+ std::string_view format,
117
+ Arg&& arg,
118
+ Args&&... args) {
119
+ auto offset = format.find('%');
120
+ CHECK_NE(offset, std::string_view::npos); // If you hit this, you passed in
121
+ // too many arguments.
122
+ std::string ret(format.substr(0, offset));
123
+ // Ignore long / size_t modifiers
124
+ while (++offset < format.size() &&
125
+ (format[offset] == 'l' || format[offset] == 'z')) {
126
+ }
127
+ switch (offset == format.size() ? '\0' : format[offset]) {
128
+ case '%': {
129
+ return ret + '%' +
130
+ SPrintFImpl(format.substr(offset + 1),
131
+ std::forward<Arg>(arg),
132
+ std::forward<Args>(args)...);
133
+ }
134
+ default: {
135
+ return ret + '%' +
136
+ SPrintFImpl(format.substr(offset),
137
+ std::forward<Arg>(arg),
138
+ std::forward<Args>(args)...);
139
+ }
140
+ case 'd':
141
+ case 'i':
142
+ case 'u':
143
+ case 's':
144
+ ret += ToStringOrStringView(arg);
145
+ break;
146
+ case 'o':
147
+ ret += ToBaseString<3>(arg);
148
+ break;
149
+ case 'x':
150
+ ret += ToBaseString<4>(arg);
151
+ break;
152
+ case 'X':
153
+ ret += node::ToUpper(ToBaseString<4>(arg));
154
+ break;
155
+ case 'p': {
156
+ CHECK(std::is_pointer_v<typename std::remove_reference_t<Arg>>);
157
+ char out[20];
158
+ int n = snprintf(
159
+ out, sizeof(out), "%p", *reinterpret_cast<const void* const*>(&arg));
160
+ CHECK_GE(n, 0);
161
+ ret += out;
162
+ break;
163
+ }
164
+ }
165
+ return ret +
166
+ SPrintFImpl(format.substr(offset + 1), std::forward<Args>(args)...);
167
+ }
168
+
169
+ template <typename... Args>
170
+ std::string COLD_NOINLINE SPrintF( // NOLINT(runtime/string)
171
+ std::string_view format,
172
+ Args&&... args) {
173
+ return SPrintFImpl(format, std::forward<Args>(args)...);
174
+ }
175
+
176
+ template <typename... Args>
177
+ void COLD_NOINLINE FPrintF(FILE* file,
178
+ std::string_view format,
179
+ Args&&... args) {
180
+ FWrite(file, SPrintF(format, std::forward<Args>(args)...));
181
+ }
182
+
183
+ template <typename... Args>
184
+ inline void FORCE_INLINE Debug(EnabledDebugList* list,
185
+ DebugCategory cat,
186
+ const char* format,
187
+ Args&&... args) {
188
+ if (!list->enabled(cat)) [[unlikely]]
189
+ return;
190
+ FPrintF(stderr, format, std::forward<Args>(args)...);
191
+ }
192
+
193
+ inline void FORCE_INLINE Debug(EnabledDebugList* list,
194
+ DebugCategory cat,
195
+ const char* message) {
196
+ if (!list->enabled(cat)) [[unlikely]]
197
+ return;
198
+ FPrintF(stderr, "%s", message);
199
+ }
200
+
201
+ template <typename... Args>
202
+ inline void FORCE_INLINE
203
+ Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args) {
204
+ Debug(env->enabled_debug_list(), cat, format, std::forward<Args>(args)...);
205
+ }
206
+
207
+ inline void FORCE_INLINE Debug(Environment* env,
208
+ DebugCategory cat,
209
+ const char* message) {
210
+ Debug(env->enabled_debug_list(), cat, message);
211
+ }
212
+
213
+ template <typename... Args>
214
+ inline void Debug(Environment* env,
215
+ DebugCategory cat,
216
+ const std::string& format,
217
+ Args&&... args) {
218
+ Debug(env->enabled_debug_list(),
219
+ cat,
220
+ format.c_str(),
221
+ std::forward<Args>(args)...);
222
+ }
223
+
224
+ // Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that
225
+ // the FORCE_INLINE flag on them doesn't apply to the contents of this function
226
+ // as well.
227
+ // We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing
228
+ // this function for speed and it should rather focus on keeping it out of
229
+ // hot code paths. In particular, we want to keep the string concatenating code
230
+ // out of the function containing the original `Debug()` call.
231
+ template <typename... Args>
232
+ void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap,
233
+ const char* format,
234
+ Args&&... args) {
235
+ Debug(async_wrap->env(),
236
+ static_cast<DebugCategory>(async_wrap->provider_type()),
237
+ async_wrap->diagnostic_name() + " " + format + "\n",
238
+ std::forward<Args>(args)...);
239
+ }
240
+
241
+ template <typename... Args>
242
+ inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
243
+ const char* format,
244
+ Args&&... args) {
245
+ DCHECK_NOT_NULL(async_wrap);
246
+ if (auto cat = static_cast<DebugCategory>(async_wrap->provider_type());
247
+ !async_wrap->env()->enabled_debug_list()->enabled(cat)) [[unlikely]] {
248
+ return;
249
+ }
250
+ UnconditionalAsyncWrapDebug(async_wrap, format, std::forward<Args>(args)...);
251
+ }
252
+
253
+ template <typename... Args>
254
+ inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
255
+ const std::string& format,
256
+ Args&&... args) {
257
+ Debug(async_wrap, format.c_str(), std::forward<Args>(args)...);
258
+ }
259
+
260
+ namespace per_process {
261
+
262
+ template <typename... Args>
263
+ inline void FORCE_INLINE Debug(DebugCategory cat,
264
+ const char* format,
265
+ Args&&... args) {
266
+ Debug(&enabled_debug_list, cat, format, std::forward<Args>(args)...);
267
+ }
268
+
269
+ inline void FORCE_INLINE Debug(DebugCategory cat, const char* message) {
270
+ Debug(&enabled_debug_list, cat, message);
271
+ }
272
+
273
+ } // namespace per_process
274
+ } // namespace node
275
+
276
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
277
+
278
+ #endif // SRC_DEBUG_UTILS_INL_H_
@@ -0,0 +1,196 @@
1
+ #ifndef SRC_DEBUG_UTILS_H_
2
+ #define SRC_DEBUG_UTILS_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "async_wrap.h"
7
+ #include "util.h"
8
+
9
+ #include <algorithm>
10
+ #include <sstream>
11
+ #include <string>
12
+
13
+ // Use FORCE_INLINE on functions that have a debug-category-enabled check first
14
+ // and then ideally only a single function call following it, to maintain
15
+ // performance for the common case (no debugging used).
16
+ #ifdef __GNUC__
17
+ #define FORCE_INLINE __attribute__((always_inline))
18
+ #define COLD_NOINLINE __attribute__((cold, noinline))
19
+ #else
20
+ #define FORCE_INLINE
21
+ #define COLD_NOINLINE
22
+ #endif
23
+
24
+ namespace node {
25
+ class Environment;
26
+
27
+ template <typename T>
28
+ inline std::string ToString(const T& value);
29
+ template <typename T>
30
+ inline auto ToStringOrStringView(const T& value);
31
+
32
+ // C++-style variant of sprintf()/fprintf() that:
33
+ // - Returns an std::string
34
+ // - Handles \0 bytes correctly
35
+ // - Supports %p and %s. %d, %i and %u are aliases for %s.
36
+ // - Accepts any class that has a ToString() method for stringification.
37
+ template <typename... Args>
38
+ inline std::string SPrintF(std::string_view format, Args&&... args);
39
+ template <typename... Args>
40
+ inline void FPrintF(FILE* file, std::string_view format, Args&&... args);
41
+ void NODE_EXTERN_PRIVATE FWrite(FILE* file, const std::string& str);
42
+
43
+ // Listing the AsyncWrap provider types first enables us to cast directly
44
+ // from a provider type to a debug category.
45
+ #define DEBUG_CATEGORY_NAMES(V) \
46
+ NODE_ASYNC_PROVIDER_TYPES(V) \
47
+ V(CRYPTO) \
48
+ V(COMPILE_CACHE) \
49
+ V(DIAGNOSTICS) \
50
+ V(HUGEPAGES) \
51
+ V(INSPECTOR_SERVER) \
52
+ V(INSPECTOR_CLIENT) \
53
+ V(INSPECTOR_PROFILER) \
54
+ V(CODE_CACHE) \
55
+ V(NGTCP2_DEBUG) \
56
+ V(SEA) \
57
+ V(WASI) \
58
+ V(MODULE) \
59
+ V(MKSNAPSHOT) \
60
+ V(SNAPSHOT_SERDES) \
61
+ V(PERMISSION_MODEL) \
62
+ V(PLATFORM_MINIMAL) \
63
+ V(PLATFORM_VERBOSE) \
64
+ V(QUIC)
65
+
66
+ enum class DebugCategory : unsigned int {
67
+ #define V(name) name,
68
+ DEBUG_CATEGORY_NAMES(V)
69
+ #undef V
70
+ };
71
+
72
+ #define V(name) +1
73
+ constexpr unsigned int kDebugCategoryCount = DEBUG_CATEGORY_NAMES(V);
74
+ #undef V
75
+
76
+ class NODE_EXTERN_PRIVATE EnabledDebugList {
77
+ public:
78
+ bool FORCE_INLINE enabled(DebugCategory category) const {
79
+ DCHECK_LT(static_cast<unsigned int>(category), kDebugCategoryCount);
80
+ return enabled_[static_cast<unsigned int>(category)];
81
+ }
82
+
83
+ // Uses NODE_DEBUG_NATIVE to initialize the categories. env->env_vars()
84
+ // is parsed if it is not a nullptr, otherwise the system environment
85
+ // variables are parsed.
86
+ void Parse(Environment* env);
87
+
88
+ private:
89
+ // Enable all categories matching cats.
90
+ void Parse(const std::string& cats);
91
+ void set_enabled(DebugCategory category) {
92
+ DCHECK_LT(static_cast<unsigned int>(category), kDebugCategoryCount);
93
+ enabled_[static_cast<int>(category)] = true;
94
+ }
95
+
96
+ bool enabled_[kDebugCategoryCount] = {false};
97
+ };
98
+
99
+ template <typename... Args>
100
+ inline void FORCE_INLINE Debug(EnabledDebugList* list,
101
+ DebugCategory cat,
102
+ const char* format,
103
+ Args&&... args);
104
+
105
+ inline void FORCE_INLINE Debug(EnabledDebugList* list,
106
+ DebugCategory cat,
107
+ const char* message);
108
+
109
+ template <typename... Args>
110
+ inline void FORCE_INLINE
111
+ Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args);
112
+
113
+ inline void FORCE_INLINE Debug(Environment* env,
114
+ DebugCategory cat,
115
+ const char* message);
116
+
117
+ template <typename... Args>
118
+ inline void Debug(Environment* env,
119
+ DebugCategory cat,
120
+ const std::string& format,
121
+ Args&&... args);
122
+
123
+ // Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that
124
+ // the FORCE_INLINE flag on them doesn't apply to the contents of this function
125
+ // as well.
126
+ // We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing
127
+ // this function for speed and it should rather focus on keeping it out of
128
+ // hot code paths. In particular, we want to keep the string concatenating code
129
+ // out of the function containing the original `Debug()` call.
130
+ template <typename... Args>
131
+ void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap,
132
+ const char* format,
133
+ Args&&... args);
134
+
135
+ template <typename... Args>
136
+ inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
137
+ const char* format,
138
+ Args&&... args);
139
+
140
+ template <typename... Args>
141
+ inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
142
+ const std::string& format,
143
+ Args&&... args);
144
+
145
+ // Debug helper for inspecting the currently running `node` executable.
146
+ class NativeSymbolDebuggingContext {
147
+ public:
148
+ static std::unique_ptr<NativeSymbolDebuggingContext> New();
149
+
150
+ class SymbolInfo {
151
+ public:
152
+ std::string name;
153
+ std::string filename;
154
+ size_t line = 0;
155
+ size_t dis = 0;
156
+
157
+ std::string Display() const;
158
+ };
159
+
160
+ NativeSymbolDebuggingContext() = default;
161
+ virtual ~NativeSymbolDebuggingContext() = default;
162
+
163
+ virtual SymbolInfo LookupSymbol(void* address) { return {}; }
164
+ virtual bool IsMapped(void* address) { return false; }
165
+ virtual int GetStackTrace(void** frames, int count) { return 0; }
166
+
167
+ NativeSymbolDebuggingContext(const NativeSymbolDebuggingContext&) = delete;
168
+ NativeSymbolDebuggingContext(NativeSymbolDebuggingContext&&) = delete;
169
+ NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&)
170
+ = delete;
171
+ NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&&)
172
+ = delete;
173
+ static std::vector<std::string> GetLoadedLibraries();
174
+ };
175
+
176
+ // Variant of `uv_loop_close` that tries to be as helpful as possible
177
+ // about giving information on currently existing handles, if there are any,
178
+ // but still aborts the process.
179
+ void CheckedUvLoopClose(uv_loop_t* loop);
180
+ void PrintLibuvHandleInformation(uv_loop_t* loop, FILE* stream);
181
+
182
+ namespace per_process {
183
+ extern NODE_EXTERN_PRIVATE EnabledDebugList enabled_debug_list;
184
+
185
+ template <typename... Args>
186
+ inline void FORCE_INLINE Debug(DebugCategory cat,
187
+ const char* format,
188
+ Args&&... args);
189
+
190
+ inline void FORCE_INLINE Debug(DebugCategory cat, const char* message);
191
+ } // namespace per_process
192
+ } // namespace node
193
+
194
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
195
+
196
+ #endif // SRC_DEBUG_UTILS_H_
@@ -0,0 +1,33 @@
1
+ #ifndef SRC_DIAGNOSTICFILENAME_INL_H_
2
+ #define SRC_DIAGNOSTICFILENAME_INL_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "node_internals.h"
7
+ namespace node {
8
+
9
+ class Environment;
10
+
11
+ inline DiagnosticFilename::DiagnosticFilename(
12
+ Environment* env,
13
+ const char* prefix,
14
+ const char* ext) :
15
+ filename_(MakeFilename(env->thread_id(), prefix, ext)) {
16
+ }
17
+
18
+ inline DiagnosticFilename::DiagnosticFilename(
19
+ uint64_t thread_id,
20
+ const char* prefix,
21
+ const char* ext) :
22
+ filename_(MakeFilename(thread_id, prefix, ext)) {
23
+ }
24
+
25
+ inline const char* DiagnosticFilename::operator*() const {
26
+ return filename_.c_str();
27
+ }
28
+
29
+ } // namespace node
30
+
31
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
32
+
33
+ #endif // SRC_DIAGNOSTICFILENAME_INL_H_
@@ -0,0 +1,17 @@
1
+ #ifndef SRC_EMBEDDED_DATA_H_
2
+ #define SRC_EMBEDDED_DATA_H_
3
+
4
+ #include <cinttypes>
5
+ #include <string>
6
+
7
+ // This file must not depend on node.h or other code that depends on
8
+ // the full Node.js implementation because it is used during the
9
+ // compilation of the Node.js implementation itself (especially js2c).
10
+
11
+ namespace node {
12
+
13
+ const std::string& GetOctalCode(uint8_t index);
14
+
15
+ } // namespace node
16
+
17
+ #endif // SRC_EMBEDDED_DATA_H_
@@ -0,0 +1,61 @@
1
+ #ifndef SRC_ENCODING_BINDING_H_
2
+ #define SRC_ENCODING_BINDING_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include <cinttypes>
7
+ #include "aliased_buffer.h"
8
+ #include "node_snapshotable.h"
9
+ #include "v8-fast-api-calls.h"
10
+
11
+ namespace node {
12
+ class ExternalReferenceRegistry;
13
+
14
+ namespace encoding_binding {
15
+ class BindingData : public SnapshotableObject {
16
+ public:
17
+ struct InternalFieldInfo : public node::InternalFieldInfoBase {
18
+ AliasedBufferIndex encode_into_results_buffer;
19
+ };
20
+
21
+ BindingData(Realm* realm,
22
+ v8::Local<v8::Object> obj,
23
+ InternalFieldInfo* info = nullptr);
24
+ SERIALIZABLE_OBJECT_METHODS()
25
+ SET_BINDING_ID(encoding_binding_data)
26
+
27
+ void MemoryInfo(MemoryTracker* tracker) const override;
28
+ SET_SELF_SIZE(BindingData)
29
+ SET_MEMORY_INFO_NAME(BindingData)
30
+
31
+ static void EncodeInto(const v8::FunctionCallbackInfo<v8::Value>& args);
32
+ static void EncodeUtf8String(const v8::FunctionCallbackInfo<v8::Value>& args);
33
+ static void DecodeUTF8(const v8::FunctionCallbackInfo<v8::Value>& args);
34
+ static void DecodeWindows1252(
35
+ const v8::FunctionCallbackInfo<v8::Value>& args);
36
+
37
+ static void ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
38
+ static void ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
39
+
40
+ static void CreatePerIsolateProperties(IsolateData* isolate_data,
41
+ v8::Local<v8::ObjectTemplate> target);
42
+ static void CreatePerContextProperties(v8::Local<v8::Object> target,
43
+ v8::Local<v8::Value> unused,
44
+ v8::Local<v8::Context> context,
45
+ void* priv);
46
+ static void RegisterTimerExternalReferences(
47
+ ExternalReferenceRegistry* registry);
48
+
49
+ private:
50
+ static constexpr size_t kEncodeIntoResultsLength = 2;
51
+ AliasedUint32Array encode_into_results_buffer_;
52
+ InternalFieldInfo* internal_field_info_ = nullptr;
53
+ };
54
+
55
+ } // namespace encoding_binding
56
+
57
+ } // namespace node
58
+
59
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
60
+
61
+ #endif // SRC_ENCODING_BINDING_H_