build_add_gn_build_files.patch 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Jeremy Apthorp <[email protected]>
  3. Date: Tue, 26 Feb 2019 17:07:45 -0800
  4. Subject: build: add GN build files
  5. This adds GN build files for Node, so we don't have to build with GYP.
  6. diff --git a/BUILD.gn b/BUILD.gn
  7. new file mode 100644
  8. index 0000000000000000000000000000000000000000..24c122008e0fc009833cf9189ebf43883207c754
  9. --- /dev/null
  10. +++ b/BUILD.gn
  11. @@ -0,0 +1,402 @@
  12. +import("//v8/gni/v8.gni")
  13. +import("//electron/js2c_toolchain.gni")
  14. +import("node.gni")
  15. +
  16. +declare_args() {
  17. + # Enable the V8 inspector protocol for use with node.
  18. + node_enable_inspector = true
  19. +
  20. + # Build node with SSL support.
  21. + # The variable is called "openssl" for parity with node's GYP build.
  22. + node_use_openssl = true
  23. +
  24. + # Use the specified path to system CA (PEM format) in addition to
  25. + # the BoringSSL supplied CA store or compiled-in Mozilla CA copy.
  26. + node_openssl_system_ca_path = ""
  27. +
  28. + # Initialize v8 platform during node.js startup.
  29. + # NB. this must be turned off in Electron, because Electron initializes the
  30. + # v8 platform itself.
  31. + node_use_v8_platform = false
  32. +
  33. + # Build with DTrace support.
  34. + node_use_dtrace = false
  35. +
  36. + # Build with ETW support.
  37. + node_use_etw = false
  38. +
  39. + # Build JavaScript in lib/ with DCHECK macros.
  40. + node_debug_lib = false
  41. +
  42. + # Custom build tag.
  43. + node_tag = ""
  44. +
  45. + # V8 options to pass, see `node --v8-options` for examples
  46. + node_v8_options = ""
  47. +
  48. + # Provide a custom URL prefix for the `process.release` properties
  49. + # `sourceUrl` and `headersUrl`. When compiling a release build, this will
  50. + # default to https://nodejs.org/download/release/')
  51. + node_release_urlbase = ""
  52. +
  53. + # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries.
  54. + use_system_cares = false
  55. + use_system_nghttp2 = false
  56. + use_system_llhttp = false
  57. + use_system_histogram = false
  58. +}
  59. +
  60. +if (is_linux) {
  61. + import("//build/config/linux/pkg_config.gni")
  62. + if (use_system_cares) {
  63. + pkg_config("cares") {
  64. + packages = [ "libcares" ]
  65. + }
  66. + }
  67. + if (use_system_nghttp2) {
  68. + pkg_config("nghttp2") {
  69. + packages = [ "libnghttp2" ]
  70. + }
  71. + }
  72. +}
  73. +
  74. +assert(!node_use_dtrace, "node_use_dtrace not supported in GN")
  75. +assert(!node_use_etw, "node_use_etw not supported in GN")
  76. +
  77. +assert(!node_enable_inspector || node_use_openssl,
  78. + "node_enable_inspector requires node_use_openssl")
  79. +
  80. +config("node_internals") {
  81. + defines = [ "NODE_WANT_INTERNALS=1" ]
  82. +}
  83. +
  84. +node_files = read_file("filenames.json", "json")
  85. +library_files = node_files.library_files
  86. +fs_files = node_files.fs_files
  87. +original_fs_files = []
  88. +foreach(file, fs_files) {
  89. + original_fs_files += [string_replace(string_replace(file, "internal/fs/", "internal/original-fs/"), "lib/fs.js", "lib/original-fs.js")]
  90. +}
  91. +
  92. +copy("node_js2c_inputs") {
  93. + sources = library_files
  94. + outputs = [
  95. + "$target_gen_dir/js2c_inputs/{{source_target_relative}}",
  96. + ]
  97. +}
  98. +
  99. +action("node_js2c_original_fs") {
  100. + script = "tools/generate_original_fs.py"
  101. + inputs = fs_files
  102. + outputs = []
  103. + foreach(file, fs_files + original_fs_files) {
  104. + outputs += ["$target_gen_dir/js2c_inputs/$file"]
  105. + }
  106. +
  107. + args = [rebase_path("$target_gen_dir/js2c_inputs")] + fs_files
  108. +}
  109. +
  110. +action("node_js2c_exec") {
  111. + deps = [
  112. + "//electron:generate_config_gypi",
  113. + ":node_js2c_original_fs",
  114. + ":node_js2c_inputs",
  115. + ":node_js2c($electron_js2c_toolchain)"
  116. + ]
  117. + config_gypi = [ "$root_gen_dir/config.gypi" ]
  118. + inputs = library_files + get_target_outputs(":node_js2c_original_fs") + config_gypi
  119. + outputs = [
  120. + "$target_gen_dir/node_javascript.cc",
  121. + ]
  122. +
  123. + script = "//electron/build/run-in-dir.py"
  124. + out_dir = get_label_info(":anything($electron_js2c_toolchain)", "root_out_dir")
  125. + args = [ rebase_path("$target_gen_dir/js2c_inputs"), rebase_path("$out_dir/node_js2c") ] +
  126. + rebase_path(outputs) + library_files + fs_files + original_fs_files + rebase_path(config_gypi)
  127. +}
  128. +
  129. +config("node_features") {
  130. + defines = []
  131. + if (node_enable_inspector) {
  132. + defines += [ "HAVE_INSPECTOR=1" ]
  133. + } else {
  134. + defines += [ "HAVE_INSPECTOR=0" ]
  135. + }
  136. + if (node_use_openssl) {
  137. + defines += [ "HAVE_OPENSSL=1" ]
  138. + } else {
  139. + defines += [ "HAVE_OPENSSL=0" ]
  140. + }
  141. + if (v8_enable_i18n_support) {
  142. + defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
  143. + } else {
  144. + defines += [ "NODE_HAVE_I18N_SUPPORT=0" ]
  145. + }
  146. + if (node_use_v8_platform) {
  147. + defines += [ "NODE_USE_V8_PLATFORM=1" ]
  148. + } else {
  149. + defines += [ "NODE_USE_V8_PLATFORM=0" ]
  150. + }
  151. +}
  152. +
  153. +config("node_lib_config") {
  154. + include_dirs = [ "src" ]
  155. +
  156. + # FIXME(deepak1556): include paths should be corrected,
  157. + # refer https://docs.google.com/presentation/d/1oxNHaVjA9Gn_rTzX6HIpJHP7nXRua_0URXxxJ3oYRq0/edit#slide=id.g71ecd450e_2_702
  158. + cflags = [ "-Wno-microsoft-include" ]
  159. +
  160. + configs = [ ":node_features" ]
  161. +
  162. + if (is_debug) {
  163. + defines = [ "DEBUG" ]
  164. + }
  165. +}
  166. +
  167. +config("node_internal_config") {
  168. + visibility = [
  169. + ":*",
  170. + "src/inspector:*",
  171. + ]
  172. + defines = [
  173. + "NODE_WANT_INTERNALS=1",
  174. + "NODE_IMPLEMENTATION",
  175. + ]
  176. + if (node_module_version != "") {
  177. + defines += [ "NODE_EMBEDDER_MODULE_VERSION=" + node_module_version ]
  178. + }
  179. + if (is_component_build) {
  180. + defines += [
  181. + "NODE_SHARED_MODE",
  182. + ]
  183. + }
  184. +
  185. + if (target_cpu == "x86") {
  186. + node_arch = "ia32"
  187. + } else {
  188. + node_arch = target_cpu
  189. + }
  190. + defines += [ "NODE_ARCH=\"$node_arch\"" ]
  191. +
  192. + if (target_os == "win") {
  193. + node_platform = "win32"
  194. + } else if (target_os == "mac") {
  195. + node_platform = "darwin"
  196. + } else {
  197. + node_platform = target_os
  198. + }
  199. + defines += [ "NODE_PLATFORM=\"$node_platform\"" ]
  200. +
  201. + if (is_win) {
  202. + defines += [
  203. + "NOMINMAX",
  204. + "_UNICODE=1",
  205. + ]
  206. + } else {
  207. + defines += [ "__POSIX__" ]
  208. + }
  209. +
  210. + if (node_tag != "") {
  211. + defines += [ "NODE_TAG=\"$node_tag\"" ]
  212. + }
  213. + if (node_v8_options != "") {
  214. + defines += [ "NODE_V8_OPTIONS=\"$node_v8_options\"" ]
  215. + }
  216. + if (node_release_urlbase != "") {
  217. + defines += [ "NODE_RELEASE_URLBASE=\"$node_release_urlbase\"" ]
  218. + }
  219. +
  220. + if (node_use_openssl) {
  221. + defines += [
  222. + "NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"",
  223. + "EVP_CTRL_CCM_SET_TAG=EVP_CTRL_GCM_SET_TAG",
  224. + ]
  225. + }
  226. +}
  227. +
  228. +executable("overlapped-checker") {
  229. + sources = []
  230. + if (is_win) {
  231. + sources += [ "test/overlapped-checker/main_win.c" ]
  232. + } else {
  233. + sources += [ "test/overlapped-checker/main_unix.c" ]
  234. + }
  235. +}
  236. +
  237. +if (current_toolchain == electron_js2c_toolchain) {
  238. + executable("node_js2c") {
  239. + defines = []
  240. + sources = [
  241. + "tools/js2c.cc",
  242. + "tools/executable_wrapper.h"
  243. + ]
  244. + include_dirs = [ "tools" ]
  245. + deps = [
  246. + "deps/simdutf($electron_js2c_toolchain)",
  247. + "deps/uv($electron_js2c_toolchain)",
  248. + "//v8"
  249. + ]
  250. +
  251. + if (!is_win) {
  252. + defines += [ "NODE_JS2C_USE_STRING_LITERALS" ]
  253. + }
  254. + if (is_debug) {
  255. + cflags_cc = [ "-g", "-O0" ]
  256. + defines += [ "DEBUG" ]
  257. + }
  258. + }
  259. +}
  260. +
  261. +component("node_lib") {
  262. + deps = [
  263. + ":node_js2c_exec",
  264. + "deps/googletest:gtest",
  265. + "deps/ada",
  266. + "deps/base64",
  267. + "deps/simdutf",
  268. + "deps/uvwasi",
  269. + "//third_party/zlib",
  270. + "//third_party/brotli:dec",
  271. + "//third_party/brotli:enc",
  272. + "//v8:v8_libplatform",
  273. + ]
  274. + if (use_system_cares) {
  275. + configs += [ ":cares" ]
  276. + } else {
  277. + deps += [ "deps/cares" ]
  278. + }
  279. + if (use_system_nghttp2) {
  280. + configs += [ ":nghttp2" ]
  281. + } else {
  282. + deps += [ "deps/nghttp2" ]
  283. + }
  284. + public_deps = [
  285. + "deps/uv",
  286. + "//electron:electron_js2c",
  287. + "//v8",
  288. + ]
  289. + configs += [ ":node_internal_config" ]
  290. + public_configs = [ ":node_lib_config" ]
  291. + include_dirs = [
  292. + "src",
  293. + "deps/postject"
  294. + ]
  295. + libs = []
  296. + if (use_system_llhttp) {
  297. + libs += [ "llhttp" ]
  298. + } else {
  299. + deps += [ "deps/llhttp" ]
  300. + }
  301. + if (use_system_histogram) {
  302. + libs += [ "hdr_histogram" ]
  303. + include_dirs += [ "/usr/include/hdr" ]
  304. + } else {
  305. + deps += [ "deps/histogram" ]
  306. + }
  307. + frameworks = []
  308. + cflags_cc = [
  309. + "-Wno-deprecated-declarations",
  310. + "-Wno-implicit-fallthrough",
  311. + "-Wno-return-type",
  312. + "-Wno-sometimes-uninitialized",
  313. + "-Wno-string-plus-int",
  314. + "-Wno-unused-function",
  315. + "-Wno-unused-label",
  316. + "-Wno-unused-private-field",
  317. + "-Wno-unused-variable",
  318. + "-Wno-shadow",
  319. + ]
  320. +
  321. + if (v8_enable_i18n_support) {
  322. + deps += [ "//third_party/icu" ]
  323. + }
  324. +
  325. + sources = node_files.node_sources
  326. + sources += [
  327. + "$root_gen_dir/electron_natives.cc",
  328. + "$target_gen_dir/node_javascript.cc",
  329. + "src/node_snapshot_stub.cc",
  330. + ]
  331. +
  332. + if (is_win) {
  333. + libs += [ "psapi.lib" ]
  334. + }
  335. + if (is_mac) {
  336. + frameworks += [ "CoreFoundation.framework" ]
  337. + }
  338. +
  339. + if (node_enable_inspector) {
  340. + sources += [
  341. + "src/inspector_agent.cc",
  342. + "src/inspector_agent.h",
  343. + "src/inspector_io.cc",
  344. + "src/inspector_io.h",
  345. + "src/inspector_js_api.cc",
  346. + "src/inspector_profiler.cc",
  347. + "src/inspector_socket.cc",
  348. + "src/inspector_socket.h",
  349. + "src/inspector_socket_server.cc",
  350. + "src/inspector_socket_server.h",
  351. + ]
  352. + deps += [ "src/inspector" ]
  353. + }
  354. +
  355. + if (node_use_openssl) {
  356. + deps += [ "//third_party/boringssl" ]
  357. + sources += [
  358. + "src/crypto/crypto_aes.cc",
  359. + "src/crypto/crypto_aes.h",
  360. + "src/crypto/crypto_bio.cc",
  361. + "src/crypto/crypto_bio.h",
  362. + "src/crypto/crypto_cipher.cc",
  363. + "src/crypto/crypto_cipher.h",
  364. + "src/crypto/crypto_clienthello-inl.h",
  365. + "src/crypto/crypto_clienthello.cc",
  366. + "src/crypto/crypto_clienthello.h",
  367. + "src/crypto/crypto_common.cc",
  368. + "src/crypto/crypto_common.h",
  369. + "src/crypto/crypto_context.cc",
  370. + "src/crypto/crypto_context.h",
  371. + "src/crypto/crypto_dh.cc",
  372. + "src/crypto/crypto_dh.h",
  373. + "src/crypto/crypto_dsa.cc",
  374. + "src/crypto/crypto_dsa.h",
  375. + "src/crypto/crypto_ec.cc",
  376. + "src/crypto/crypto_ec.h",
  377. + "src/crypto/crypto_groups.h",
  378. + "src/crypto/crypto_hash.cc",
  379. + "src/crypto/crypto_hash.h",
  380. + "src/crypto/crypto_hkdf.cc",
  381. + "src/crypto/crypto_hkdf.h",
  382. + "src/crypto/crypto_hmac.cc",
  383. + "src/crypto/crypto_hmac.h",
  384. + "src/crypto/crypto_keygen.cc",
  385. + "src/crypto/crypto_keygen.h",
  386. + "src/crypto/crypto_keys.cc",
  387. + "src/crypto/crypto_keys.h",
  388. + "src/crypto/crypto_pbkdf2.cc",
  389. + "src/crypto/crypto_pbkdf2.h",
  390. + "src/crypto/crypto_random.cc",
  391. + "src/crypto/crypto_random.h",
  392. + "src/crypto/crypto_rsa.cc",
  393. + "src/crypto/crypto_rsa.h",
  394. + "src/crypto/crypto_scrypt.cc",
  395. + "src/crypto/crypto_scrypt.h",
  396. + "src/crypto/crypto_sig.cc",
  397. + "src/crypto/crypto_sig.h",
  398. + "src/crypto/crypto_spkac.cc",
  399. + "src/crypto/crypto_spkac.h",
  400. + "src/crypto/crypto_timing.cc",
  401. + "src/crypto/crypto_timing.h",
  402. + "src/crypto/crypto_tls.cc",
  403. + "src/crypto/crypto_tls.h",
  404. + "src/crypto/crypto_util.cc",
  405. + "src/crypto/crypto_util.h",
  406. + "src/crypto/crypto_x509.cc",
  407. + "src/crypto/crypto_x509.h",
  408. + "src/node_crypto.cc",
  409. + "src/node_crypto.h",
  410. + ]
  411. + cflags_cc += [ "-Wno-sign-compare" ]
  412. + }
  413. +}
  414. diff --git a/deps/ada/BUILD.gn b/deps/ada/BUILD.gn
  415. new file mode 100644
  416. index 0000000000000000000000000000000000000000..a564653c3f05608d59fed5aa071d63b81f4e0e42
  417. --- /dev/null
  418. +++ b/deps/ada/BUILD.gn
  419. @@ -0,0 +1,28 @@
  420. +import("//v8/gni/v8.gni")
  421. +
  422. +config("ada_config") {
  423. + include_dirs = [ "." ]
  424. +}
  425. +
  426. +static_library("ada") {
  427. + include_dirs = [ "." ]
  428. + sources = [ "ada.cpp" ]
  429. +
  430. + public_configs = [ ":ada_config" ]
  431. +
  432. + defines = []
  433. + deps = []
  434. +
  435. + if (v8_enable_i18n_support) {
  436. + deps += [
  437. + "//third_party/icu:icui18n",
  438. + "//third_party/icu:icuuc",
  439. + ]
  440. +
  441. + if (is_win) {
  442. + deps += [ "//third_party/icu:icudata" ]
  443. + }
  444. + } else {
  445. + defines += [ "ADA_HAS_ICU=0" ]
  446. + }
  447. +}
  448. diff --git a/deps/base64/BUILD.gn b/deps/base64/BUILD.gn
  449. new file mode 100644
  450. index 0000000000000000000000000000000000000000..9b97aabe865e4cf12f6c3ccda196b372769a823b
  451. --- /dev/null
  452. +++ b/deps/base64/BUILD.gn
  453. @@ -0,0 +1,135 @@
  454. +config("base64_config") {
  455. + include_dirs = [
  456. + "base64/include",
  457. + "base64/lib",
  458. + ]
  459. +
  460. + defines = [ "BASE64_STATIC_DEFINE" ]
  461. +}
  462. +
  463. +static_library("base64") {
  464. + defines = []
  465. + deps = [
  466. + ":base64_neon32",
  467. + ":base64_neon64",
  468. + ":base64_avx",
  469. + ":base64_avx2",
  470. + ":base64_sse41",
  471. + ":base64_sse42",
  472. + ":base64_ssse3",
  473. + ]
  474. +
  475. + public_configs = [ ":base64_config" ]
  476. +
  477. + cflags_c = [
  478. + "-Wno-implicit-fallthrough",
  479. + "-Wno-unused-but-set-variable",
  480. + "-Wno-shadow",
  481. + ]
  482. +
  483. + sources = [
  484. + "base64/include/libbase64.h",
  485. + "base64/lib/arch/generic/codec.c",
  486. + "base64/lib/codec_choose.c",
  487. + "base64/lib/codecs.h",
  488. + "base64/lib/lib.c",
  489. + "base64/lib/tables/tables.c",
  490. + ]
  491. +}
  492. +
  493. +source_set("base64_ssse3") {
  494. + public_configs = [ ":base64_config" ]
  495. +
  496. + if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") {
  497. + defines = [ "HAVE_SSSE3=1" ]
  498. +
  499. + cflags = [ "-mssse3" ]
  500. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  501. + }
  502. +
  503. + sources = [ "base64/lib/arch/ssse3/codec.c" ]
  504. +}
  505. +
  506. +source_set("base64_sse41") {
  507. + public_configs = [ ":base64_config" ]
  508. +
  509. + if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") {
  510. + defines = [ "HAVE_SSE41=1" ]
  511. +
  512. + cflags = [ "-msse4.1" ]
  513. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  514. + }
  515. +
  516. + sources = [ "base64/lib/arch/sse41/codec.c" ]
  517. +}
  518. +
  519. +
  520. +source_set("base64_sse42") {
  521. + public_configs = [ ":base64_config" ]
  522. +
  523. + if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") {
  524. + defines = [
  525. + "BASE64_STATIC_DEFINE",
  526. + "HAVE_SSE42=1",
  527. + ]
  528. +
  529. + cflags = [ "-msse4.2" ]
  530. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  531. + }
  532. +
  533. + sources = [ "base64/lib/arch/sse42/codec.c" ]
  534. +}
  535. +
  536. +source_set("base64_avx") {
  537. + public_configs = [ ":base64_config" ]
  538. +
  539. + if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") {
  540. + defines = [ "HAVE_AVX=1" ]
  541. +
  542. + cflags = [ "-mavx" ]
  543. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  544. + }
  545. +
  546. + sources = [ "base64/lib/arch/avx/codec.c" ]
  547. +}
  548. +
  549. +source_set("base64_avx2") {
  550. + public_configs = [ ":base64_config" ]
  551. +
  552. + if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") {
  553. + defines = [ "HAVE_AVX2=1" ]
  554. +
  555. + cflags = [ "-mavx2" ]
  556. + cflags_c = [
  557. + "-Wno-implicit-fallthrough",
  558. + "-Wno-implicit-function-declaration",
  559. + ]
  560. + }
  561. +
  562. + sources = [ "base64/lib/arch/avx2/codec.c" ]
  563. +}
  564. +
  565. +source_set("base64_neon32") {
  566. + public_configs = [ ":base64_config" ]
  567. +
  568. + if (target_cpu == "arm") {
  569. + defines = [ "HAVE_NEON32=1" ]
  570. +
  571. + cflags = [ "-mfpu=neon" ]
  572. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  573. + }
  574. +
  575. + sources = [ "base64/lib/arch/neon32/codec.c" ]
  576. +}
  577. +
  578. +source_set("base64_neon64") {
  579. + public_configs = [ ":base64_config" ]
  580. +
  581. + if (target_cpu == "arm64") {
  582. + defines = [ "HAVE_NEON64=1" ]
  583. +
  584. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  585. + }
  586. +
  587. + sources = [ "base64/lib/arch/neon64/codec.c" ]
  588. +}
  589. diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn
  590. new file mode 100644
  591. index 0000000000000000000000000000000000000000..2a902c68ca445b8451e442c314c60ee5a30719e4
  592. --- /dev/null
  593. +++ b/deps/cares/BUILD.gn
  594. @@ -0,0 +1,135 @@
  595. +config("cares_config") {
  596. + include_dirs = [ "include", "src/lib" ]
  597. +}
  598. +static_library("cares") {
  599. + defines = [ "CARES_STATICLIB" ]
  600. + include_dirs = [ "include" ]
  601. + public_configs = [ ":cares_config" ]
  602. +
  603. + libs = []
  604. + cflags_c = [
  605. + "-Wno-logical-not-parentheses",
  606. + "-Wno-implicit-fallthrough",
  607. + "-Wno-sign-compare",
  608. + ]
  609. +
  610. + sources = [
  611. + "include/ares.h",
  612. + "include/ares_dns.h",
  613. + "include/ares_nameser.h",
  614. + "include/ares_rules.h",
  615. + "include/ares_version.h",
  616. + "src/lib/ares__addrinfo2hostent.c",
  617. + "src/lib/ares__addrinfo_localhost.c",
  618. + "src/lib/ares_android.c",
  619. + "src/lib/ares_cancel.c",
  620. + "src/lib/ares__close_sockets.c",
  621. + "src/lib/ares_create_query.c",
  622. + "src/lib/ares_data.c",
  623. + "src/lib/ares_data.h",
  624. + "src/lib/ares_destroy.c",
  625. + "src/lib/ares_expand_name.c",
  626. + "src/lib/ares_expand_string.c",
  627. + "src/lib/ares_fds.c",
  628. + "src/lib/ares_free_hostent.c",
  629. + "src/lib/ares_free_string.c",
  630. + "src/lib/ares_freeaddrinfo.c",
  631. + "src/lib/ares_getenv.h",
  632. + "src/lib/ares_getaddrinfo.c",
  633. + "src/lib/ares_gethostbyaddr.c",
  634. + "src/lib/ares_gethostbyname.c",
  635. + "src/lib/ares__get_hostent.c",
  636. + "src/lib/ares_getnameinfo.c",
  637. + "src/lib/ares_getsock.c",
  638. + "src/lib/ares_init.c",
  639. + "src/lib/ares_ipv6.h",
  640. + "src/lib/ares_library_init.c",
  641. + "src/lib/ares_library_init.h",
  642. + "src/lib/ares_llist.c",
  643. + "src/lib/ares_llist.h",
  644. + "src/lib/ares_mkquery.c",
  645. + "src/lib/ares_nameser.h",
  646. + "src/lib/ares_nowarn.c",
  647. + "src/lib/ares_nowarn.h",
  648. + "src/lib/ares_options.c",
  649. + "src/lib/ares__parse_into_addrinfo.c",
  650. + "src/lib/ares_parse_aaaa_reply.c",
  651. + "src/lib/ares_parse_a_reply.c",
  652. + "src/lib/ares_parse_caa_reply.c",
  653. + "src/lib/ares_parse_mx_reply.c",
  654. + "src/lib/ares_parse_naptr_reply.c",
  655. + "src/lib/ares_parse_ns_reply.c",
  656. + "src/lib/ares_parse_ptr_reply.c",
  657. + "src/lib/ares_parse_soa_reply.c",
  658. + "src/lib/ares_parse_srv_reply.c",
  659. + "src/lib/ares_parse_txt_reply.c",
  660. + "src/lib/ares_parse_uri_reply.c",
  661. + "src/lib/ares_platform.h",
  662. + "src/lib/ares_private.h",
  663. + "src/lib/ares_process.c",
  664. + "src/lib/ares_query.c",
  665. + "src/lib/ares_rand.c",
  666. + "src/lib/ares__read_line.c",
  667. + "src/lib/ares__readaddrinfo.c",
  668. + "src/lib/ares_search.c",
  669. + "src/lib/ares_send.c",
  670. + "src/lib/ares_setup.h",
  671. + "src/lib/ares__sortaddrinfo.c",
  672. + "src/lib/ares_strcasecmp.c",
  673. + "src/lib/ares_strcasecmp.h",
  674. + "src/lib/ares_strdup.c",
  675. + "src/lib/ares_strdup.h",
  676. + "src/lib/ares_strerror.c",
  677. + "src/lib/ares_strsplit.c",
  678. + "src/lib/ares_timeout.c",
  679. + "src/lib/ares__timeval.c",
  680. + "src/lib/ares_version.c",
  681. + "src/lib/ares_writev.c",
  682. + "src/lib/ares_writev.h",
  683. + "src/lib/bitncmp.c",
  684. + "src/lib/bitncmp.h",
  685. + "src/lib/inet_net_pton.c",
  686. + "src/lib/inet_ntop.c",
  687. + "src/lib/ares_inet_net_pton.h",
  688. + "src/lib/setup_once.h",
  689. + "src/tools/ares_getopt.c",
  690. + "src/tools/ares_getopt.h",
  691. + ]
  692. +
  693. + if (!is_win) {
  694. + defines += [
  695. + "_DARWIN_USE_64_BIT_INODE=1",
  696. + "_LARGEFILE_SOURCE",
  697. + "_FILE_OFFSET_BITS=64",
  698. + "_GNU_SOURCE",
  699. + ]
  700. + }
  701. +
  702. + if (is_win) {
  703. + defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
  704. + include_dirs += [ "config/win32" ]
  705. + sources += [
  706. + "src/lib/ares_getenv.c",
  707. + "src/lib/ares_iphlpapi.h",
  708. + "src/lib/ares_platform.c",
  709. + "src/lib/config-win32.h",
  710. + "src/lib/windows_port.c",
  711. + ]
  712. + libs += [
  713. + "ws2_32.lib",
  714. + "iphlpapi.lib",
  715. + ]
  716. + } else {
  717. + defines += [ "HAVE_CONFIG_H" ]
  718. + }
  719. +
  720. + if (is_linux) {
  721. + include_dirs += [ "config/linux" ]
  722. + sources += [ "config/linux/ares_config.h" ]
  723. + }
  724. +
  725. + if (is_mac) {
  726. + include_dirs += [ "config/darwin" ]
  727. + sources += [ "config/darwin/ares_config.h" ]
  728. + }
  729. +}
  730. diff --git a/deps/googletest/BUILD.gn b/deps/googletest/BUILD.gn
  731. new file mode 100644
  732. index 0000000000000000000000000000000000000000..0daf8c006cef89e76d7eccec3e924bd2718021c9
  733. --- /dev/null
  734. +++ b/deps/googletest/BUILD.gn
  735. @@ -0,0 +1,64 @@
  736. +config("gtest_config") {
  737. + include_dirs = [ "include" ]
  738. + defines = [ "UNIT_TEST" ]
  739. +}
  740. +
  741. +static_library("gtest") {
  742. + include_dirs = [
  743. + "include",
  744. + "." # src
  745. + ]
  746. +
  747. + public_configs = [ ":gtest_config" ]
  748. +
  749. + cflags_cc = [
  750. + "-Wno-c++98-compat-extra-semi",
  751. + "-Wno-unused-const-variable",
  752. + "-Wno-unreachable-code-return",
  753. + ]
  754. +
  755. + defines = [
  756. + "GTEST_HAS_POSIX_RE=0",
  757. + "GTEST_LANG_CXX11=1",
  758. + ]
  759. +
  760. + sources = [
  761. + "include/gtest/gtest_pred_impl.h",
  762. + "include/gtest/gtest_prod.h",
  763. + "include/gtest/gtest-death-test.h",
  764. + "include/gtest/gtest-matchers.h",
  765. + "include/gtest/gtest-message.h",
  766. + "include/gtest/gtest-param-test.h",
  767. + "include/gtest/gtest-printers.h",
  768. + "include/gtest/gtest-spi.h",
  769. + "include/gtest/gtest-test-part.h",
  770. + "include/gtest/gtest-typed-test.h",
  771. + "include/gtest/gtest.h",
  772. + "include/gtest/internal/gtest-death-test-internal.h",
  773. + "include/gtest/internal/gtest-filepath.h",
  774. + "include/gtest/internal/gtest-internal.h",
  775. + "include/gtest/internal/gtest-param-util.h",
  776. + "include/gtest/internal/gtest-port-arch.h",
  777. + "include/gtest/internal/gtest-port.h",
  778. + "include/gtest/internal/gtest-string.h",
  779. + "include/gtest/internal/gtest-type-util.h",
  780. + "include/gtest/internal/custom/gtest-port.h",
  781. + "include/gtest/internal/custom/gtest-printers.h",
  782. + "include/gtest/internal/custom/gtest.h",
  783. + "src/gtest-all.cc",
  784. + "src/gtest-death-test.cc",
  785. + "src/gtest-filepath.cc",
  786. + "src/gtest-internal-inl.h",
  787. + "src/gtest-matchers.cc",
  788. + "src/gtest-port.cc",
  789. + "src/gtest-printers.cc",
  790. + "src/gtest-test-part.cc",
  791. + "src/gtest-typed-test.cc",
  792. + "src/gtest.cc",
  793. + ]
  794. +}
  795. +
  796. +static_library("gtest_main") {
  797. + deps = [ ":gtest" ]
  798. + sources = [ "src/gtest_main.cc" ]
  799. +}
  800. diff --git a/deps/histogram/BUILD.gn b/deps/histogram/BUILD.gn
  801. new file mode 100644
  802. index 0000000000000000000000000000000000000000..02bc887db7c8545e1d8adc57f73f203eec2f2592
  803. --- /dev/null
  804. +++ b/deps/histogram/BUILD.gn
  805. @@ -0,0 +1,19 @@
  806. +config("histogram_config") {
  807. + include_dirs = [ "include" ]
  808. +
  809. + cflags = [
  810. + "-Wno-implicit-function-declaration",
  811. + "-Wno-incompatible-pointer-types",
  812. + "-Wno-unused-function",
  813. + "-Wno-atomic-alignment",
  814. + ]
  815. +}
  816. +
  817. +static_library("histogram") {
  818. + public_configs = [ ":histogram_config" ]
  819. +
  820. + sources = [
  821. + "src/hdr_histogram.c",
  822. + "src/hdr_histogram.h",
  823. + ]
  824. +}
  825. \ No newline at end of file
  826. diff --git a/deps/llhttp/BUILD.gn b/deps/llhttp/BUILD.gn
  827. new file mode 100644
  828. index 0000000000000000000000000000000000000000..fb000f8ee7647c375bc190d1729d67bb7770d109
  829. --- /dev/null
  830. +++ b/deps/llhttp/BUILD.gn
  831. @@ -0,0 +1,15 @@
  832. +config("llhttp_config") {
  833. + include_dirs = [ "include" ]
  834. + cflags = [ "-Wno-unreachable-code" ]
  835. +}
  836. +
  837. +static_library("llhttp") {
  838. + include_dirs = [ "include" ]
  839. + public_configs = [ ":llhttp_config" ]
  840. + cflags_c = [ "-Wno-implicit-fallthrough" ]
  841. + sources = [
  842. + "src/api.c",
  843. + "src/http.c",
  844. + "src/llhttp.c",
  845. + ]
  846. +}
  847. diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn
  848. new file mode 100644
  849. index 0000000000000000000000000000000000000000..7d2ca477db2415f43ababa270d8aefa3124b2765
  850. --- /dev/null
  851. +++ b/deps/nghttp2/BUILD.gn
  852. @@ -0,0 +1,51 @@
  853. +config("nghttp2_config") {
  854. + defines = [ "NGHTTP2_STATICLIB" ]
  855. + include_dirs = [ "lib/includes" ]
  856. +}
  857. +static_library("nghttp2") {
  858. + public_configs = [ ":nghttp2_config" ]
  859. + defines = [
  860. + "_U_",
  861. + "BUILDING_NGHTTP2",
  862. + "NGHTTP2_STATICLIB",
  863. + "HAVE_CONFIG_H",
  864. + ]
  865. + include_dirs = [ "lib/includes" ]
  866. +
  867. + cflags_c = [
  868. + "-Wno-implicit-function-declaration",
  869. + "-Wno-implicit-fallthrough",
  870. + "-Wno-string-plus-int",
  871. + "-Wno-unreachable-code-return",
  872. + "-Wno-unused-but-set-variable",
  873. + ]
  874. +
  875. + sources = [
  876. + "lib/nghttp2_buf.c",
  877. + "lib/nghttp2_callbacks.c",
  878. + "lib/nghttp2_debug.c",
  879. + "lib/nghttp2_extpri.c",
  880. + "lib/nghttp2_frame.c",
  881. + "lib/nghttp2_hd.c",
  882. + "lib/nghttp2_hd_huffman.c",
  883. + "lib/nghttp2_hd_huffman_data.c",
  884. + "lib/nghttp2_helper.c",
  885. + "lib/nghttp2_http.c",
  886. + "lib/nghttp2_map.c",
  887. + "lib/nghttp2_mem.c",
  888. + "lib/nghttp2_npn.c",
  889. + "lib/nghttp2_option.c",
  890. + "lib/nghttp2_outbound_item.c",
  891. + "lib/nghttp2_pq.c",
  892. + "lib/nghttp2_priority_spec.c",
  893. + "lib/nghttp2_queue.c",
  894. + "lib/nghttp2_ratelim.c",
  895. + "lib/nghttp2_rcbuf.c",
  896. + "lib/nghttp2_session.c",
  897. + "lib/nghttp2_stream.c",
  898. + "lib/nghttp2_submit.c",
  899. + "lib/nghttp2_time.c",
  900. + "lib/nghttp2_version.c",
  901. + "lib/sfparse.c"
  902. + ]
  903. +}
  904. diff --git a/deps/simdutf/BUILD.gn b/deps/simdutf/BUILD.gn
  905. new file mode 100644
  906. index 0000000000000000000000000000000000000000..bfbd4e656db1a6c73048443f96f1d576a0df7519
  907. --- /dev/null
  908. +++ b/deps/simdutf/BUILD.gn
  909. @@ -0,0 +1,20 @@
  910. +config("simdutf_config") {
  911. + include_dirs = [ "." ]
  912. +}
  913. +
  914. +static_library("simdutf") {
  915. + include_dirs = [ "." ]
  916. + sources = [
  917. + "simdutf.cpp",
  918. + ]
  919. +
  920. + public_configs = [ ":simdutf_config" ]
  921. +
  922. + cflags_cc = [
  923. + "-Wno-ambiguous-reversed-operator",
  924. + "-Wno-c++98-compat-extra-semi",
  925. + "-Wno-unreachable-code-break",
  926. + "-Wno-unused-const-variable",
  927. + "-Wno-unused-function",
  928. + ]
  929. +}
  930. diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn
  931. new file mode 100644
  932. index 0000000000000000000000000000000000000000..7518168141db7958550c7f5dc1ed17ccdbbe4a60
  933. --- /dev/null
  934. +++ b/deps/uv/BUILD.gn
  935. @@ -0,0 +1,194 @@
  936. +config("libuv_config") {
  937. + include_dirs = [ "include" ]
  938. +
  939. + defines = []
  940. +
  941. + if (is_linux) {
  942. + defines += [ "_POSIX_C_SOURCE=200112" ]
  943. + }
  944. + if (!is_win) {
  945. + defines += [
  946. + "_LARGEFILE_SOURCE",
  947. + "_FILE_OFFSET_BITS=64",
  948. + ]
  949. + }
  950. + if (is_mac) {
  951. + defines += [ "_DARWIN_USE_64_BIT_INODE=1" ]
  952. + }
  953. +}
  954. +
  955. +static_library("uv") {
  956. + include_dirs = [
  957. + "include",
  958. + "src",
  959. + ]
  960. +
  961. + public_configs = [ ":libuv_config" ]
  962. +
  963. + ldflags = []
  964. +
  965. + defines = []
  966. +
  967. + # This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib
  968. + defines += [ "BUILDING_UV_SHARED=1" ]
  969. +
  970. + cflags_c = [
  971. + "-Wno-incompatible-pointer-types",
  972. + "-Wno-bitwise-op-parentheses",
  973. + "-Wno-implicit-fallthrough",
  974. + "-Wno-implicit-function-declaration",
  975. + "-Wno-missing-braces",
  976. + "-Wno-sign-compare",
  977. + "-Wno-sometimes-uninitialized",
  978. + "-Wno-string-conversion",
  979. + "-Wno-switch",
  980. + "-Wno-unused-function",
  981. + "-Wno-unused-result",
  982. + "-Wno-unused-variable",
  983. + "-Wno-unreachable-code",
  984. + "-Wno-unreachable-code-return",
  985. + "-Wno-unused-but-set-variable",
  986. + "-Wno-shadow",
  987. + ]
  988. +
  989. + libs = []
  990. +
  991. + sources = [
  992. + "include/uv.h",
  993. + "include/uv/tree.h",
  994. + "include/uv/errno.h",
  995. + "include/uv/threadpool.h",
  996. + "include/uv/version.h",
  997. + "src/fs-poll.c",
  998. + "src/heap-inl.h",
  999. + "src/idna.c",
  1000. + "src/idna.h",
  1001. + "src/inet.c",
  1002. + "src/queue.h",
  1003. + "src/random.c",
  1004. + "src/strscpy.c",
  1005. + "src/strscpy.h",
  1006. + "src/strtok.c",
  1007. + "src/strtok.h",
  1008. + "src/thread-common.c",
  1009. + "src/threadpool.c",
  1010. + "src/timer.c",
  1011. + "src/uv-data-getter-setters.c",
  1012. + "src/uv-common.c",
  1013. + "src/uv-common.h",
  1014. + "src/version.c",
  1015. + ]
  1016. +
  1017. + if (is_win) {
  1018. + defines += [ "_GNU_SOURCE" ]
  1019. + sources += [
  1020. + "include/uv/win.h",
  1021. + "src/win/async.c",
  1022. + "src/win/atomicops-inl.h",
  1023. + "src/win/core.c",
  1024. + "src/win/detect-wakeup.c",
  1025. + "src/win/dl.c",
  1026. + "src/win/error.c",
  1027. + "src/win/fs.c",
  1028. + "src/win/fs-event.c",
  1029. + "src/win/getaddrinfo.c",
  1030. + "src/win/getnameinfo.c",
  1031. + "src/win/handle.c",
  1032. + "src/win/handle-inl.h",
  1033. + "src/win/internal.h",
  1034. + "src/win/loop-watcher.c",
  1035. + "src/win/pipe.c",
  1036. + "src/win/thread.c",
  1037. + "src/win/poll.c",
  1038. + "src/win/process.c",
  1039. + "src/win/process-stdio.c",
  1040. + "src/win/req-inl.h",
  1041. + "src/win/signal.c",
  1042. + "src/win/snprintf.c",
  1043. + "src/win/stream.c",
  1044. + "src/win/stream-inl.h",
  1045. + "src/win/tcp.c",
  1046. + "src/win/tty.c",
  1047. + "src/win/udp.c",
  1048. + "src/win/util.c",
  1049. + "src/win/winapi.c",
  1050. + "src/win/winapi.h",
  1051. + "src/win/winsock.c",
  1052. + "src/win/winsock.h",
  1053. + ]
  1054. +
  1055. + libs += [
  1056. + "advapi32.lib",
  1057. + "iphlpapi.lib",
  1058. + "psapi.lib",
  1059. + "shell32.lib",
  1060. + "user32.lib",
  1061. + "userenv.lib",
  1062. + "ws2_32.lib",
  1063. + ]
  1064. + } else {
  1065. + sources += [
  1066. + "include/uv/unix.h",
  1067. + "include/uv/linux.h",
  1068. + "include/uv/sunos.h",
  1069. + "include/uv/darwin.h",
  1070. + "include/uv/bsd.h",
  1071. + "include/uv/aix.h",
  1072. + "src/unix/async.c",
  1073. + "src/unix/core.c",
  1074. + "src/unix/dl.c",
  1075. + "src/unix/fs.c",
  1076. + "src/unix/getaddrinfo.c",
  1077. + "src/unix/getnameinfo.c",
  1078. + "src/unix/internal.h",
  1079. + "src/unix/loop.c",
  1080. + "src/unix/loop-watcher.c",
  1081. + "src/unix/pipe.c",
  1082. + "src/unix/poll.c",
  1083. + "src/unix/process.c",
  1084. + "src/unix/random-devurandom.c",
  1085. + "src/unix/signal.c",
  1086. + "src/unix/stream.c",
  1087. + "src/unix/tcp.c",
  1088. + "src/unix/thread.c",
  1089. + "src/unix/tty.c",
  1090. + "src/unix/udp.c",
  1091. + ]
  1092. + libs += [ "m" ]
  1093. + ldflags += [ "-pthread" ]
  1094. + }
  1095. + if (is_mac || is_linux) {
  1096. + sources += [ "src/unix/proctitle.c" ]
  1097. + }
  1098. + if (is_mac) {
  1099. + sources += [
  1100. + "src/unix/darwin-proctitle.c",
  1101. + "src/unix/darwin.c",
  1102. + "src/unix/fsevents.c",
  1103. + "src/unix/random-getentropy.c",
  1104. + ]
  1105. + defines += [
  1106. + "_DARWIN_USE_64_BIT_INODE=1",
  1107. + "_DARWIN_UNLIMITED_SELECT=1",
  1108. + ]
  1109. + }
  1110. + if (is_linux) {
  1111. + defines += [ "_GNU_SOURCE" ]
  1112. + sources += [
  1113. + "src/unix/linux.c",
  1114. + "src/unix/procfs-exepath.c",
  1115. + "src/unix/random-getrandom.c",
  1116. + "src/unix/random-sysctl-linux.c",
  1117. + ]
  1118. + libs += [
  1119. + "dl",
  1120. + "rt",
  1121. + ]
  1122. + }
  1123. + if (is_mac) { # is_bsd
  1124. + sources += [
  1125. + "src/unix/bsd-ifaddrs.c",
  1126. + "src/unix/kqueue.c",
  1127. + ]
  1128. + }
  1129. +}
  1130. diff --git a/deps/uvwasi/BUILD.gn b/deps/uvwasi/BUILD.gn
  1131. new file mode 100644
  1132. index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df6369a765c07
  1133. --- /dev/null
  1134. +++ b/deps/uvwasi/BUILD.gn
  1135. @@ -0,0 +1,38 @@
  1136. +config("uvwasi_config") {
  1137. + include_dirs = [ "include" ]
  1138. +}
  1139. +
  1140. +static_library("uvwasi") {
  1141. + include_dirs = [
  1142. + "include",
  1143. + "src",
  1144. + ]
  1145. +
  1146. + defines = []
  1147. + if (is_linux) {
  1148. + defines += [
  1149. + "_GNU_SOURCE",
  1150. + "_POSIX_C_SOURCE=200112"
  1151. + ]
  1152. + }
  1153. +
  1154. + deps = [ "../../deps/uv" ]
  1155. +
  1156. + public_configs = [ ":uvwasi_config" ]
  1157. +
  1158. + cflags_c = []
  1159. + if (!is_win) {
  1160. + cflags_c += [ "-fvisibility=hidden" ]
  1161. + }
  1162. +
  1163. + sources = [
  1164. + "src/clocks.c",
  1165. + "src/fd_table.c",
  1166. + "src/path_resolver.c",
  1167. + "src/poll_oneoff.c",
  1168. + "src/uv_mapping.c",
  1169. + "src/uvwasi.c",
  1170. + "src/wasi_rights.c",
  1171. + "src/wasi_serdes.c"
  1172. + ]
  1173. +}
  1174. diff --git a/filenames.json b/filenames.json
  1175. new file mode 100644
  1176. index 0000000000000000000000000000000000000000..aa118ab320d83745723a2275efc556555c1e7768
  1177. --- /dev/null
  1178. +++ b/filenames.json
  1179. @@ -0,0 +1,733 @@
  1180. +// This file is automatically generated by generate_gn_filenames_json.py
  1181. +// DO NOT EDIT
  1182. +{
  1183. + "fs_files": [
  1184. + "lib/internal/fs/cp/cp-sync.js",
  1185. + "lib/internal/fs/cp/cp.js",
  1186. + "lib/internal/fs/dir.js",
  1187. + "lib/internal/fs/promises.js",
  1188. + "lib/internal/fs/read/context.js",
  1189. + "lib/internal/fs/recursive_watch.js",
  1190. + "lib/internal/fs/rimraf.js",
  1191. + "lib/internal/fs/streams.js",
  1192. + "lib/internal/fs/sync.js",
  1193. + "lib/internal/fs/sync_write_stream.js",
  1194. + "lib/internal/fs/utils.js",
  1195. + "lib/internal/fs/watchers.js",
  1196. + "lib/fs.js"
  1197. + ],
  1198. + "headers": [
  1199. + {
  1200. + "dest_dir": "include/node/",
  1201. + "files": [
  1202. + "src/js_native_api.h",
  1203. + "src/js_native_api_types.h",
  1204. + "src/node.h",
  1205. + "src/node_api.h",
  1206. + "src/node_api_types.h",
  1207. + "src/node_buffer.h",
  1208. + "src/node_object_wrap.h"
  1209. + ]
  1210. + },
  1211. + {
  1212. + "dest_dir": "include/node//",
  1213. + "files": [
  1214. + "//v8/include/v8-array-buffer.h",
  1215. + "//v8/include/v8-callbacks.h",
  1216. + "//v8/include/v8-container.h",
  1217. + "//v8/include/v8-context.h",
  1218. + "//v8/include/v8-cppgc.h",
  1219. + "//v8/include/v8-data.h",
  1220. + "//v8/include/v8-date.h",
  1221. + "//v8/include/v8-debug.h",
  1222. + "//v8/include/v8-embedder-heap.h",
  1223. + "//v8/include/v8-embedder-state-scope.h",
  1224. + "//v8/include/v8-exception.h",
  1225. + "//v8/include/v8-extension.h",
  1226. + "//v8/include/v8-external.h",
  1227. + "//v8/include/v8-forward.h",
  1228. + "//v8/include/v8-function-callback.h",
  1229. + "//v8/include/v8-function.h",
  1230. + "//v8/include/v8-handle-base.h",
  1231. + "//v8/include/v8-initialization.h",
  1232. + "//v8/include/v8-internal.h",
  1233. + "//v8/include/v8-isolate.h",
  1234. + "//v8/include/v8-json.h",
  1235. + "//v8/include/v8-local-handle.h",
  1236. + "//v8/include/v8-locker.h",
  1237. + "//v8/include/v8-maybe.h",
  1238. + "//v8/include/v8-memory-span.h",
  1239. + "//v8/include/v8-message.h",
  1240. + "//v8/include/v8-microtask-queue.h",
  1241. + "//v8/include/v8-microtask.h",
  1242. + "//v8/include/v8-object.h",
  1243. + "//v8/include/v8-persistent-handle.h",
  1244. + "//v8/include/v8-platform.h",
  1245. + "//v8/include/v8-primitive-object.h",
  1246. + "//v8/include/v8-primitive.h",
  1247. + "//v8/include/v8-profiler.h",
  1248. + "//v8/include/v8-promise.h",
  1249. + "//v8/include/v8-proxy.h",
  1250. + "//v8/include/v8-regexp.h",
  1251. + "//v8/include/v8-script.h",
  1252. + "//v8/include/v8-snapshot.h",
  1253. + "//v8/include/v8-source-location.h",
  1254. + "//v8/include/v8-statistics.h",
  1255. + "//v8/include/v8-template.h",
  1256. + "//v8/include/v8-traced-handle.h",
  1257. + "//v8/include/v8-typed-array.h",
  1258. + "//v8/include/v8-unwinder.h",
  1259. + "//v8/include/v8-value-serializer.h",
  1260. + "//v8/include/v8-value.h",
  1261. + "//v8/include/v8-version.h",
  1262. + "//v8/include/v8-wasm.h",
  1263. + "//v8/include/v8-weak-callback-info.h",
  1264. + "//v8/include/v8.h",
  1265. + "//v8/include/v8config.h"
  1266. + ]
  1267. + },
  1268. + {
  1269. + "dest_dir": "include/node//libplatform/",
  1270. + "files": [
  1271. + "//v8/include/libplatform/libplatform-export.h",
  1272. + "//v8/include/libplatform/libplatform.h",
  1273. + "//v8/include/libplatform/v8-tracing.h"
  1274. + ]
  1275. + },
  1276. + {
  1277. + "dest_dir": "include/node//cppgc/",
  1278. + "files": [
  1279. + "//v8/include/cppgc/allocation.h",
  1280. + "//v8/include/cppgc/common.h",
  1281. + "//v8/include/cppgc/cross-thread-persistent.h",
  1282. + "//v8/include/cppgc/custom-space.h",
  1283. + "//v8/include/cppgc/default-platform.h",
  1284. + "//v8/include/cppgc/ephemeron-pair.h",
  1285. + "//v8/include/cppgc/explicit-management.h",
  1286. + "//v8/include/cppgc/garbage-collected.h",
  1287. + "//v8/include/cppgc/heap-consistency.h",
  1288. + "//v8/include/cppgc/heap-handle.h",
  1289. + "//v8/include/cppgc/heap-state.h",
  1290. + "//v8/include/cppgc/heap-statistics.h",
  1291. + "//v8/include/cppgc/heap.h",
  1292. + "//v8/include/cppgc/liveness-broker.h",
  1293. + "//v8/include/cppgc/macros.h",
  1294. + "//v8/include/cppgc/member.h",
  1295. + "//v8/include/cppgc/name-provider.h",
  1296. + "//v8/include/cppgc/object-size-trait.h",
  1297. + "//v8/include/cppgc/persistent.h",
  1298. + "//v8/include/cppgc/platform.h",
  1299. + "//v8/include/cppgc/prefinalizer.h",
  1300. + "//v8/include/cppgc/process-heap-statistics.h",
  1301. + "//v8/include/cppgc/sentinel-pointer.h",
  1302. + "//v8/include/cppgc/source-location.h",
  1303. + "//v8/include/cppgc/testing.h",
  1304. + "//v8/include/cppgc/trace-trait.h",
  1305. + "//v8/include/cppgc/type-traits.h",
  1306. + "//v8/include/cppgc/visitor.h"
  1307. + ]
  1308. + },
  1309. + {
  1310. + "dest_dir": "include/node//cppgc/internal/",
  1311. + "files": [
  1312. + "//v8/include/cppgc/internal/api-constants.h",
  1313. + "//v8/include/cppgc/internal/atomic-entry-flag.h",
  1314. + "//v8/include/cppgc/internal/base-page-handle.h",
  1315. + "//v8/include/cppgc/internal/caged-heap-local-data.h",
  1316. + "//v8/include/cppgc/internal/caged-heap.h",
  1317. + "//v8/include/cppgc/internal/compiler-specific.h",
  1318. + "//v8/include/cppgc/internal/finalizer-trait.h",
  1319. + "//v8/include/cppgc/internal/gc-info.h",
  1320. + "//v8/include/cppgc/internal/logging.h",
  1321. + "//v8/include/cppgc/internal/member-storage.h",
  1322. + "//v8/include/cppgc/internal/name-trait.h",
  1323. + "//v8/include/cppgc/internal/persistent-node.h",
  1324. + "//v8/include/cppgc/internal/pointer-policies.h",
  1325. + "//v8/include/cppgc/internal/write-barrier.h"
  1326. + ]
  1327. + },
  1328. + {
  1329. + "dest_dir": "include/node//",
  1330. + "files": [
  1331. + "deps/uv/include/uv.h"
  1332. + ]
  1333. + },
  1334. + {
  1335. + "dest_dir": "include/node//uv/",
  1336. + "files": [
  1337. + "deps/uv/include/uv/aix.h",
  1338. + "deps/uv/include/uv/bsd.h",
  1339. + "deps/uv/include/uv/darwin.h",
  1340. + "deps/uv/include/uv/errno.h",
  1341. + "deps/uv/include/uv/linux.h",
  1342. + "deps/uv/include/uv/os390.h",
  1343. + "deps/uv/include/uv/posix.h",
  1344. + "deps/uv/include/uv/sunos.h",
  1345. + "deps/uv/include/uv/threadpool.h",
  1346. + "deps/uv/include/uv/tree.h",
  1347. + "deps/uv/include/uv/unix.h",
  1348. + "deps/uv/include/uv/version.h",
  1349. + "deps/uv/include/uv/win.h"
  1350. + ]
  1351. + }
  1352. + ],
  1353. + "library_files": [
  1354. + "lib/_http_agent.js",
  1355. + "lib/_http_client.js",
  1356. + "lib/_http_common.js",
  1357. + "lib/_http_incoming.js",
  1358. + "lib/_http_outgoing.js",
  1359. + "lib/_http_server.js",
  1360. + "lib/_stream_duplex.js",
  1361. + "lib/_stream_passthrough.js",
  1362. + "lib/_stream_readable.js",
  1363. + "lib/_stream_transform.js",
  1364. + "lib/_stream_wrap.js",
  1365. + "lib/_stream_writable.js",
  1366. + "lib/_tls_common.js",
  1367. + "lib/_tls_wrap.js",
  1368. + "lib/assert.js",
  1369. + "lib/assert/strict.js",
  1370. + "lib/async_hooks.js",
  1371. + "lib/buffer.js",
  1372. + "lib/child_process.js",
  1373. + "lib/cluster.js",
  1374. + "lib/console.js",
  1375. + "lib/constants.js",
  1376. + "lib/crypto.js",
  1377. + "lib/dgram.js",
  1378. + "lib/diagnostics_channel.js",
  1379. + "lib/dns.js",
  1380. + "lib/dns/promises.js",
  1381. + "lib/domain.js",
  1382. + "lib/events.js",
  1383. + "lib/fs/promises.js",
  1384. + "lib/http.js",
  1385. + "lib/http2.js",
  1386. + "lib/https.js",
  1387. + "lib/inspector.js",
  1388. + "lib/inspector/promises.js",
  1389. + "lib/internal/abort_controller.js",
  1390. + "lib/internal/assert.js",
  1391. + "lib/internal/assert/assertion_error.js",
  1392. + "lib/internal/assert/calltracker.js",
  1393. + "lib/internal/async_hooks.js",
  1394. + "lib/internal/blob.js",
  1395. + "lib/internal/blocklist.js",
  1396. + "lib/internal/bootstrap/node.js",
  1397. + "lib/internal/bootstrap/realm.js",
  1398. + "lib/internal/bootstrap/switches/does_not_own_process_state.js",
  1399. + "lib/internal/bootstrap/switches/does_own_process_state.js",
  1400. + "lib/internal/bootstrap/switches/is_main_thread.js",
  1401. + "lib/internal/bootstrap/switches/is_not_main_thread.js",
  1402. + "lib/internal/bootstrap/web/exposed-wildcard.js",
  1403. + "lib/internal/bootstrap/web/exposed-window-or-worker.js",
  1404. + "lib/internal/buffer.js",
  1405. + "lib/internal/child_process.js",
  1406. + "lib/internal/child_process/serialization.js",
  1407. + "lib/internal/cli_table.js",
  1408. + "lib/internal/cluster/child.js",
  1409. + "lib/internal/cluster/primary.js",
  1410. + "lib/internal/cluster/round_robin_handle.js",
  1411. + "lib/internal/cluster/shared_handle.js",
  1412. + "lib/internal/cluster/utils.js",
  1413. + "lib/internal/cluster/worker.js",
  1414. + "lib/internal/console/constructor.js",
  1415. + "lib/internal/console/global.js",
  1416. + "lib/internal/constants.js",
  1417. + "lib/internal/crypto/aes.js",
  1418. + "lib/internal/crypto/certificate.js",
  1419. + "lib/internal/crypto/cfrg.js",
  1420. + "lib/internal/crypto/cipher.js",
  1421. + "lib/internal/crypto/diffiehellman.js",
  1422. + "lib/internal/crypto/ec.js",
  1423. + "lib/internal/crypto/hash.js",
  1424. + "lib/internal/crypto/hashnames.js",
  1425. + "lib/internal/crypto/hkdf.js",
  1426. + "lib/internal/crypto/keygen.js",
  1427. + "lib/internal/crypto/keys.js",
  1428. + "lib/internal/crypto/mac.js",
  1429. + "lib/internal/crypto/pbkdf2.js",
  1430. + "lib/internal/crypto/random.js",
  1431. + "lib/internal/crypto/rsa.js",
  1432. + "lib/internal/crypto/scrypt.js",
  1433. + "lib/internal/crypto/sig.js",
  1434. + "lib/internal/crypto/util.js",
  1435. + "lib/internal/crypto/webcrypto.js",
  1436. + "lib/internal/crypto/webidl.js",
  1437. + "lib/internal/crypto/x509.js",
  1438. + "lib/internal/debugger/inspect.js",
  1439. + "lib/internal/debugger/inspect_client.js",
  1440. + "lib/internal/debugger/inspect_repl.js",
  1441. + "lib/internal/dgram.js",
  1442. + "lib/internal/dns/callback_resolver.js",
  1443. + "lib/internal/dns/promises.js",
  1444. + "lib/internal/dns/utils.js",
  1445. + "lib/internal/encoding.js",
  1446. + "lib/internal/error_serdes.js",
  1447. + "lib/internal/errors.js",
  1448. + "lib/internal/event_target.js",
  1449. + "lib/internal/events/symbols.js",
  1450. + "lib/internal/file.js",
  1451. + "lib/internal/fixed_queue.js",
  1452. + "lib/internal/freelist.js",
  1453. + "lib/internal/freeze_intrinsics.js",
  1454. + "lib/internal/heap_utils.js",
  1455. + "lib/internal/histogram.js",
  1456. + "lib/internal/http.js",
  1457. + "lib/internal/http2/compat.js",
  1458. + "lib/internal/http2/core.js",
  1459. + "lib/internal/http2/util.js",
  1460. + "lib/internal/idna.js",
  1461. + "lib/internal/inspector_async_hook.js",
  1462. + "lib/internal/js_stream_socket.js",
  1463. + "lib/internal/legacy/processbinding.js",
  1464. + "lib/internal/linkedlist.js",
  1465. + "lib/internal/main/check_syntax.js",
  1466. + "lib/internal/main/embedding.js",
  1467. + "lib/internal/main/eval_stdin.js",
  1468. + "lib/internal/main/eval_string.js",
  1469. + "lib/internal/main/inspect.js",
  1470. + "lib/internal/main/mksnapshot.js",
  1471. + "lib/internal/main/print_help.js",
  1472. + "lib/internal/main/prof_process.js",
  1473. + "lib/internal/main/repl.js",
  1474. + "lib/internal/main/run_main_module.js",
  1475. + "lib/internal/main/test_runner.js",
  1476. + "lib/internal/main/watch_mode.js",
  1477. + "lib/internal/main/worker_thread.js",
  1478. + "lib/internal/mime.js",
  1479. + "lib/internal/modules/cjs/loader.js",
  1480. + "lib/internal/modules/esm/assert.js",
  1481. + "lib/internal/modules/esm/create_dynamic_module.js",
  1482. + "lib/internal/modules/esm/fetch_module.js",
  1483. + "lib/internal/modules/esm/formats.js",
  1484. + "lib/internal/modules/esm/get_format.js",
  1485. + "lib/internal/modules/esm/handle_process_exit.js",
  1486. + "lib/internal/modules/esm/hooks.js",
  1487. + "lib/internal/modules/esm/initialize_import_meta.js",
  1488. + "lib/internal/modules/esm/load.js",
  1489. + "lib/internal/modules/esm/loader.js",
  1490. + "lib/internal/modules/esm/module_job.js",
  1491. + "lib/internal/modules/esm/module_map.js",
  1492. + "lib/internal/modules/esm/package_config.js",
  1493. + "lib/internal/modules/esm/resolve.js",
  1494. + "lib/internal/modules/esm/shared_constants.js",
  1495. + "lib/internal/modules/esm/translators.js",
  1496. + "lib/internal/modules/esm/utils.js",
  1497. + "lib/internal/modules/esm/worker.js",
  1498. + "lib/internal/modules/helpers.js",
  1499. + "lib/internal/modules/package_json_reader.js",
  1500. + "lib/internal/modules/run_main.js",
  1501. + "lib/internal/net.js",
  1502. + "lib/internal/options.js",
  1503. + "lib/internal/per_context/domexception.js",
  1504. + "lib/internal/per_context/messageport.js",
  1505. + "lib/internal/per_context/primordials.js",
  1506. + "lib/internal/perf/event_loop_delay.js",
  1507. + "lib/internal/perf/event_loop_utilization.js",
  1508. + "lib/internal/perf/nodetiming.js",
  1509. + "lib/internal/perf/observe.js",
  1510. + "lib/internal/perf/performance.js",
  1511. + "lib/internal/perf/performance_entry.js",
  1512. + "lib/internal/perf/resource_timing.js",
  1513. + "lib/internal/perf/timerify.js",
  1514. + "lib/internal/perf/usertiming.js",
  1515. + "lib/internal/perf/utils.js",
  1516. + "lib/internal/policy/manifest.js",
  1517. + "lib/internal/policy/sri.js",
  1518. + "lib/internal/priority_queue.js",
  1519. + "lib/internal/process/esm_loader.js",
  1520. + "lib/internal/process/execution.js",
  1521. + "lib/internal/process/per_thread.js",
  1522. + "lib/internal/process/permission.js",
  1523. + "lib/internal/process/policy.js",
  1524. + "lib/internal/process/pre_execution.js",
  1525. + "lib/internal/process/promises.js",
  1526. + "lib/internal/process/report.js",
  1527. + "lib/internal/process/signal.js",
  1528. + "lib/internal/process/task_queues.js",
  1529. + "lib/internal/process/warning.js",
  1530. + "lib/internal/process/worker_thread_only.js",
  1531. + "lib/internal/promise_hooks.js",
  1532. + "lib/internal/querystring.js",
  1533. + "lib/internal/readline/callbacks.js",
  1534. + "lib/internal/readline/emitKeypressEvents.js",
  1535. + "lib/internal/readline/interface.js",
  1536. + "lib/internal/readline/promises.js",
  1537. + "lib/internal/readline/utils.js",
  1538. + "lib/internal/repl.js",
  1539. + "lib/internal/repl/await.js",
  1540. + "lib/internal/repl/history.js",
  1541. + "lib/internal/repl/utils.js",
  1542. + "lib/internal/socket_list.js",
  1543. + "lib/internal/socketaddress.js",
  1544. + "lib/internal/source_map/prepare_stack_trace.js",
  1545. + "lib/internal/source_map/source_map.js",
  1546. + "lib/internal/source_map/source_map_cache.js",
  1547. + "lib/internal/stream_base_commons.js",
  1548. + "lib/internal/streams/add-abort-signal.js",
  1549. + "lib/internal/streams/buffer_list.js",
  1550. + "lib/internal/streams/compose.js",
  1551. + "lib/internal/streams/destroy.js",
  1552. + "lib/internal/streams/duplex.js",
  1553. + "lib/internal/streams/duplexify.js",
  1554. + "lib/internal/streams/end-of-stream.js",
  1555. + "lib/internal/streams/from.js",
  1556. + "lib/internal/streams/lazy_transform.js",
  1557. + "lib/internal/streams/legacy.js",
  1558. + "lib/internal/streams/operators.js",
  1559. + "lib/internal/streams/passthrough.js",
  1560. + "lib/internal/streams/pipeline.js",
  1561. + "lib/internal/streams/readable.js",
  1562. + "lib/internal/streams/state.js",
  1563. + "lib/internal/streams/transform.js",
  1564. + "lib/internal/streams/utils.js",
  1565. + "lib/internal/streams/writable.js",
  1566. + "lib/internal/structured_clone.js",
  1567. + "lib/internal/test/binding.js",
  1568. + "lib/internal/test/transfer.js",
  1569. + "lib/internal/test_runner/coverage.js",
  1570. + "lib/internal/test_runner/harness.js",
  1571. + "lib/internal/test_runner/mock/mock.js",
  1572. + "lib/internal/test_runner/mock/mock_timers.js",
  1573. + "lib/internal/test_runner/reporter/dot.js",
  1574. + "lib/internal/test_runner/reporter/junit.js",
  1575. + "lib/internal/test_runner/reporter/spec.js",
  1576. + "lib/internal/test_runner/reporter/tap.js",
  1577. + "lib/internal/test_runner/reporter/v8-serializer.js",
  1578. + "lib/internal/test_runner/runner.js",
  1579. + "lib/internal/test_runner/test.js",
  1580. + "lib/internal/test_runner/tests_stream.js",
  1581. + "lib/internal/test_runner/utils.js",
  1582. + "lib/internal/timers.js",
  1583. + "lib/internal/tls/secure-context.js",
  1584. + "lib/internal/tls/secure-pair.js",
  1585. + "lib/internal/trace_events_async_hooks.js",
  1586. + "lib/internal/tty.js",
  1587. + "lib/internal/url.js",
  1588. + "lib/internal/util.js",
  1589. + "lib/internal/util/colors.js",
  1590. + "lib/internal/util/comparisons.js",
  1591. + "lib/internal/util/debuglog.js",
  1592. + "lib/internal/util/embedding.js",
  1593. + "lib/internal/util/inspect.js",
  1594. + "lib/internal/util/inspector.js",
  1595. + "lib/internal/util/iterable_weak_map.js",
  1596. + "lib/internal/util/parse_args/parse_args.js",
  1597. + "lib/internal/util/parse_args/utils.js",
  1598. + "lib/internal/util/types.js",
  1599. + "lib/internal/v8/startup_snapshot.js",
  1600. + "lib/internal/v8_prof_polyfill.js",
  1601. + "lib/internal/v8_prof_processor.js",
  1602. + "lib/internal/validators.js",
  1603. + "lib/internal/vm.js",
  1604. + "lib/internal/vm/module.js",
  1605. + "lib/internal/wasm_web_api.js",
  1606. + "lib/internal/watch_mode/files_watcher.js",
  1607. + "lib/internal/watchdog.js",
  1608. + "lib/internal/webidl.js",
  1609. + "lib/internal/webstreams/adapters.js",
  1610. + "lib/internal/webstreams/compression.js",
  1611. + "lib/internal/webstreams/encoding.js",
  1612. + "lib/internal/webstreams/queuingstrategies.js",
  1613. + "lib/internal/webstreams/readablestream.js",
  1614. + "lib/internal/webstreams/transfer.js",
  1615. + "lib/internal/webstreams/transformstream.js",
  1616. + "lib/internal/webstreams/util.js",
  1617. + "lib/internal/webstreams/writablestream.js",
  1618. + "lib/internal/worker.js",
  1619. + "lib/internal/worker/io.js",
  1620. + "lib/internal/worker/js_transferable.js",
  1621. + "lib/module.js",
  1622. + "lib/net.js",
  1623. + "lib/os.js",
  1624. + "lib/path.js",
  1625. + "lib/path/posix.js",
  1626. + "lib/path/win32.js",
  1627. + "lib/perf_hooks.js",
  1628. + "lib/process.js",
  1629. + "lib/punycode.js",
  1630. + "lib/querystring.js",
  1631. + "lib/readline.js",
  1632. + "lib/readline/promises.js",
  1633. + "lib/repl.js",
  1634. + "lib/stream.js",
  1635. + "lib/stream/consumers.js",
  1636. + "lib/stream/promises.js",
  1637. + "lib/stream/web.js",
  1638. + "lib/string_decoder.js",
  1639. + "lib/sys.js",
  1640. + "lib/test.js",
  1641. + "lib/test/reporters.js",
  1642. + "lib/timers.js",
  1643. + "lib/timers/promises.js",
  1644. + "lib/tls.js",
  1645. + "lib/trace_events.js",
  1646. + "lib/tty.js",
  1647. + "lib/url.js",
  1648. + "lib/util.js",
  1649. + "lib/util/types.js",
  1650. + "lib/v8.js",
  1651. + "lib/vm.js",
  1652. + "lib/wasi.js",
  1653. + "lib/worker_threads.js",
  1654. + "lib/zlib.js",
  1655. + "deps/v8/tools/splaytree.mjs",
  1656. + "deps/v8/tools/codemap.mjs",
  1657. + "deps/v8/tools/consarray.mjs",
  1658. + "deps/v8/tools/csvparser.mjs",
  1659. + "deps/v8/tools/profile.mjs",
  1660. + "deps/v8/tools/profile_view.mjs",
  1661. + "deps/v8/tools/logreader.mjs",
  1662. + "deps/v8/tools/arguments.mjs",
  1663. + "deps/v8/tools/tickprocessor.mjs",
  1664. + "deps/v8/tools/sourcemap.mjs",
  1665. + "deps/v8/tools/tickprocessor-driver.mjs",
  1666. + "deps/acorn/acorn/dist/acorn.js",
  1667. + "deps/acorn/acorn-walk/dist/walk.js",
  1668. + "deps/minimatch/index.js",
  1669. + "deps/cjs-module-lexer/lexer.js",
  1670. + "deps/cjs-module-lexer/dist/lexer.js",
  1671. + "deps/undici/undici.js"
  1672. + ],
  1673. + "node_sources": [
  1674. + "src/api/async_resource.cc",
  1675. + "src/api/callback.cc",
  1676. + "src/api/embed_helpers.cc",
  1677. + "src/api/encoding.cc",
  1678. + "src/api/environment.cc",
  1679. + "src/api/exceptions.cc",
  1680. + "src/api/hooks.cc",
  1681. + "src/api/utils.cc",
  1682. + "src/async_wrap.cc",
  1683. + "src/base_object.cc",
  1684. + "src/cares_wrap.cc",
  1685. + "src/cleanup_queue.cc",
  1686. + "src/connect_wrap.cc",
  1687. + "src/connection_wrap.cc",
  1688. + "src/dataqueue/queue.cc",
  1689. + "src/debug_utils.cc",
  1690. + "src/encoding_binding.cc",
  1691. + "src/env.cc",
  1692. + "src/fs_event_wrap.cc",
  1693. + "src/handle_wrap.cc",
  1694. + "src/heap_utils.cc",
  1695. + "src/histogram.cc",
  1696. + "src/js_native_api.h",
  1697. + "src/js_native_api_types.h",
  1698. + "src/js_native_api_v8.cc",
  1699. + "src/js_native_api_v8.h",
  1700. + "src/js_native_api_v8_internals.h",
  1701. + "src/js_stream.cc",
  1702. + "src/json_utils.cc",
  1703. + "src/js_udp_wrap.cc",
  1704. + "src/json_parser.h",
  1705. + "src/json_parser.cc",
  1706. + "src/module_wrap.cc",
  1707. + "src/node.cc",
  1708. + "src/node_api.cc",
  1709. + "src/node_binding.cc",
  1710. + "src/node_blob.cc",
  1711. + "src/node_buffer.cc",
  1712. + "src/node_builtins.cc",
  1713. + "src/node_config.cc",
  1714. + "src/node_constants.cc",
  1715. + "src/node_contextify.cc",
  1716. + "src/node_credentials.cc",
  1717. + "src/node_dir.cc",
  1718. + "src/node_dotenv.cc",
  1719. + "src/node_env_var.cc",
  1720. + "src/node_errors.cc",
  1721. + "src/node_external_reference.cc",
  1722. + "src/node_file.cc",
  1723. + "src/node_http_parser.cc",
  1724. + "src/node_http2.cc",
  1725. + "src/node_i18n.cc",
  1726. + "src/node_main_instance.cc",
  1727. + "src/node_messaging.cc",
  1728. + "src/node_metadata.cc",
  1729. + "src/node_options.cc",
  1730. + "src/node_os.cc",
  1731. + "src/node_perf.cc",
  1732. + "src/node_platform.cc",
  1733. + "src/node_postmortem_metadata.cc",
  1734. + "src/node_process_events.cc",
  1735. + "src/node_process_methods.cc",
  1736. + "src/node_process_object.cc",
  1737. + "src/node_realm.cc",
  1738. + "src/node_report.cc",
  1739. + "src/node_report_module.cc",
  1740. + "src/node_report_utils.cc",
  1741. + "src/node_sea.cc",
  1742. + "src/node_serdes.cc",
  1743. + "src/node_shadow_realm.cc",
  1744. + "src/node_snapshotable.cc",
  1745. + "src/node_sockaddr.cc",
  1746. + "src/node_stat_watcher.cc",
  1747. + "src/node_symbols.cc",
  1748. + "src/node_task_queue.cc",
  1749. + "src/node_trace_events.cc",
  1750. + "src/node_types.cc",
  1751. + "src/node_url.cc",
  1752. + "src/node_util.cc",
  1753. + "src/node_v8.cc",
  1754. + "src/node_wasi.cc",
  1755. + "src/node_wasm_web_api.cc",
  1756. + "src/node_watchdog.cc",
  1757. + "src/node_worker.cc",
  1758. + "src/node_zlib.cc",
  1759. + "src/permission/child_process_permission.cc",
  1760. + "src/permission/fs_permission.cc",
  1761. + "src/permission/inspector_permission.cc",
  1762. + "src/permission/permission.cc",
  1763. + "src/permission/worker_permission.cc",
  1764. + "src/pipe_wrap.cc",
  1765. + "src/process_wrap.cc",
  1766. + "src/signal_wrap.cc",
  1767. + "src/spawn_sync.cc",
  1768. + "src/stream_base.cc",
  1769. + "src/stream_pipe.cc",
  1770. + "src/stream_wrap.cc",
  1771. + "src/string_bytes.cc",
  1772. + "src/string_decoder.cc",
  1773. + "src/tcp_wrap.cc",
  1774. + "src/timers.cc",
  1775. + "src/timer_wrap.cc",
  1776. + "src/tracing/agent.cc",
  1777. + "src/tracing/node_trace_buffer.cc",
  1778. + "src/tracing/node_trace_writer.cc",
  1779. + "src/tracing/trace_event.cc",
  1780. + "src/tracing/traced_value.cc",
  1781. + "src/tty_wrap.cc",
  1782. + "src/udp_wrap.cc",
  1783. + "src/util.cc",
  1784. + "src/uv.cc",
  1785. + "src/aliased_buffer.h",
  1786. + "src/aliased_buffer-inl.h",
  1787. + "src/aliased_struct.h",
  1788. + "src/aliased_struct-inl.h",
  1789. + "src/async_wrap.h",
  1790. + "src/async_wrap-inl.h",
  1791. + "src/base_object.h",
  1792. + "src/base_object-inl.h",
  1793. + "src/base_object_types.h",
  1794. + "src/base64.h",
  1795. + "src/base64-inl.h",
  1796. + "src/blob_serializer_deserializer.h",
  1797. + "src/blob_serializer_deserializer-inl.h",
  1798. + "src/callback_queue.h",
  1799. + "src/callback_queue-inl.h",
  1800. + "src/cleanup_queue.h",
  1801. + "src/cleanup_queue-inl.h",
  1802. + "src/connect_wrap.h",
  1803. + "src/connection_wrap.h",
  1804. + "src/dataqueue/queue.h",
  1805. + "src/debug_utils.h",
  1806. + "src/debug_utils-inl.h",
  1807. + "src/encoding_binding.h",
  1808. + "src/env_properties.h",
  1809. + "src/env.h",
  1810. + "src/env-inl.h",
  1811. + "src/handle_wrap.h",
  1812. + "src/histogram.h",
  1813. + "src/histogram-inl.h",
  1814. + "src/js_stream.h",
  1815. + "src/json_utils.h",
  1816. + "src/large_pages/node_large_page.cc",
  1817. + "src/large_pages/node_large_page.h",
  1818. + "src/memory_tracker.h",
  1819. + "src/memory_tracker-inl.h",
  1820. + "src/module_wrap.h",
  1821. + "src/node.h",
  1822. + "src/node_api.h",
  1823. + "src/node_api_types.h",
  1824. + "src/node_binding.h",
  1825. + "src/node_blob.h",
  1826. + "src/node_buffer.h",
  1827. + "src/node_builtins.h",
  1828. + "src/node_constants.h",
  1829. + "src/node_context_data.h",
  1830. + "src/node_contextify.h",
  1831. + "src/node_dir.h",
  1832. + "src/node_dotenv.h",
  1833. + "src/node_errors.h",
  1834. + "src/node_exit_code.h",
  1835. + "src/node_external_reference.h",
  1836. + "src/node_file.h",
  1837. + "src/node_file-inl.h",
  1838. + "src/node_http_common.h",
  1839. + "src/node_http_common-inl.h",
  1840. + "src/node_http2.h",
  1841. + "src/node_http2_state.h",
  1842. + "src/node_i18n.h",
  1843. + "src/node_internals.h",
  1844. + "src/node_main_instance.h",
  1845. + "src/node_mem.h",
  1846. + "src/node_mem-inl.h",
  1847. + "src/node_messaging.h",
  1848. + "src/node_metadata.h",
  1849. + "src/node_mutex.h",
  1850. + "src/node_object_wrap.h",
  1851. + "src/node_options.h",
  1852. + "src/node_options-inl.h",
  1853. + "src/node_perf.h",
  1854. + "src/node_perf_common.h",
  1855. + "src/node_platform.h",
  1856. + "src/node_process.h",
  1857. + "src/node_process-inl.h",
  1858. + "src/node_realm.h",
  1859. + "src/node_realm-inl.h",
  1860. + "src/node_report.h",
  1861. + "src/node_revert.h",
  1862. + "src/node_root_certs.h",
  1863. + "src/node_sea.h",
  1864. + "src/node_shadow_realm.h",
  1865. + "src/node_snapshotable.h",
  1866. + "src/node_snapshot_builder.h",
  1867. + "src/node_sockaddr.h",
  1868. + "src/node_sockaddr-inl.h",
  1869. + "src/node_stat_watcher.h",
  1870. + "src/node_union_bytes.h",
  1871. + "src/node_url.h",
  1872. + "src/node_version.h",
  1873. + "src/node_v8.h",
  1874. + "src/node_v8_platform-inl.h",
  1875. + "src/node_wasi.h",
  1876. + "src/node_watchdog.h",
  1877. + "src/node_worker.h",
  1878. + "src/permission/child_process_permission.h",
  1879. + "src/permission/fs_permission.h",
  1880. + "src/permission/inspector_permission.h",
  1881. + "src/permission/permission.h",
  1882. + "src/permission/worker_permission.h",
  1883. + "src/pipe_wrap.h",
  1884. + "src/req_wrap.h",
  1885. + "src/req_wrap-inl.h",
  1886. + "src/spawn_sync.h",
  1887. + "src/stream_base.h",
  1888. + "src/stream_base-inl.h",
  1889. + "src/stream_pipe.h",
  1890. + "src/stream_wrap.h",
  1891. + "src/string_bytes.h",
  1892. + "src/string_decoder.h",
  1893. + "src/string_decoder-inl.h",
  1894. + "src/string_search.h",
  1895. + "src/tcp_wrap.h",
  1896. + "src/timers.h",
  1897. + "src/tracing/agent.h",
  1898. + "src/tracing/node_trace_buffer.h",
  1899. + "src/tracing/node_trace_writer.h",
  1900. + "src/tracing/trace_event.h",
  1901. + "src/tracing/trace_event_common.h",
  1902. + "src/tracing/traced_value.h",
  1903. + "src/timer_wrap.h",
  1904. + "src/timer_wrap-inl.h",
  1905. + "src/tty_wrap.h",
  1906. + "src/udp_wrap.h",
  1907. + "src/util.h",
  1908. + "src/util-inl.h",
  1909. + "//v8/include/v8.h",
  1910. + "deps/postject/postject-api.h"
  1911. + ]
  1912. +}
  1913. diff --git a/node.gni b/node.gni
  1914. new file mode 100644
  1915. index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1c4349223
  1916. --- /dev/null
  1917. +++ b/node.gni
  1918. @@ -0,0 +1,4 @@
  1919. +declare_args() {
  1920. + # Allows embedders to override the NODE_MODULE_VERSION define
  1921. + node_module_version = ""
  1922. +}
  1923. diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
  1924. new file mode 100644
  1925. index 0000000000000000000000000000000000000000..4ab828dcbf322a9e28674e48c4a6868bd1321be2
  1926. --- /dev/null
  1927. +++ b/src/inspector/BUILD.gn
  1928. @@ -0,0 +1,200 @@
  1929. +import("//v8/gni/v8.gni")
  1930. +
  1931. +inspector_protocol_dir = "../../tools/inspector_protocol"
  1932. +
  1933. +_protocol_generated = [
  1934. + "protocol/Forward.h",
  1935. + "protocol/Protocol.cpp",
  1936. + "protocol/Protocol.h",
  1937. + "protocol/NodeWorker.cpp",
  1938. + "protocol/NodeWorker.h",
  1939. + "protocol/NodeTracing.cpp",
  1940. + "protocol/NodeTracing.h",
  1941. + "protocol/NodeRuntime.cpp",
  1942. + "protocol/NodeRuntime.h",
  1943. +]
  1944. +
  1945. +# These are from node_protocol_config.json
  1946. +# These convoluted path hacks are to work around the fact that node.js is very
  1947. +# confused about what paths are in its includes, without changing node at all.
  1948. +# Hopefully, keying everything in this file off the paths that are in
  1949. +# node_protocol_config.json will mean that the paths stay in sync.
  1950. +inspector_protocol_package = "src/node/inspector/protocol"
  1951. +inspector_protocol_output = "node/inspector/protocol"
  1952. +
  1953. +config("inspector_config") {
  1954. + include_dirs = [
  1955. + "$target_gen_dir",
  1956. + "$target_gen_dir/src",
  1957. + ]
  1958. +
  1959. + configs = [ "../..:node_features" ]
  1960. +}
  1961. +
  1962. +source_set("inspector") {
  1963. + sources = [
  1964. + "main_thread_interface.cc",
  1965. + "main_thread_interface.h",
  1966. + "node_string.cc",
  1967. + "node_string.h",
  1968. + "runtime_agent.cc",
  1969. + "runtime_agent.h",
  1970. + "tracing_agent.cc",
  1971. + "tracing_agent.h",
  1972. + "worker_agent.cc",
  1973. + "worker_agent.h",
  1974. + "worker_inspector.cc",
  1975. + "worker_inspector.h",
  1976. + ]
  1977. + sources += rebase_path(_protocol_generated,
  1978. + ".",
  1979. + "$target_gen_dir/$inspector_protocol_package/..")
  1980. + include_dirs = [
  1981. + "//v8/include",
  1982. + "..",
  1983. + ]
  1984. + deps = [
  1985. + ":protocol_generated_sources",
  1986. + ":v8_inspector_compress_protocol_json",
  1987. + "../../deps/uv",
  1988. + "../../deps/simdutf",
  1989. + "//third_party/icu:icuuc",
  1990. + ]
  1991. + configs += [ "../..:node_internal_config" ]
  1992. + public_configs = [ ":inspector_config" ]
  1993. +}
  1994. +
  1995. +# This based on the template from //v8/../inspector_protocol.gni
  1996. +action("protocol_generated_sources") {
  1997. + # This is to ensure that the output directory exists--the code generator
  1998. + # doesn't create it.
  1999. + write_file("$target_gen_dir/$inspector_protocol_package/.dummy", "")
  2000. + script = "$inspector_protocol_dir/code_generator.py"
  2001. +
  2002. + inputs = [
  2003. + "$target_gen_dir/node_protocol_config.json",
  2004. + "$target_gen_dir/src/node_protocol.json",
  2005. + "$inspector_protocol_dir/lib/base_string_adapter_cc.template",
  2006. + "$inspector_protocol_dir/lib/base_string_adapter_h.template",
  2007. + "$inspector_protocol_dir/lib/Allocator_h.template",
  2008. + "$inspector_protocol_dir/lib/Array_h.template",
  2009. + "$inspector_protocol_dir/lib/DispatcherBase_cpp.template",
  2010. + "$inspector_protocol_dir/lib/DispatcherBase_h.template",
  2011. + "$inspector_protocol_dir/lib/ErrorSupport_cpp.template",
  2012. + "$inspector_protocol_dir/lib/ErrorSupport_h.template",
  2013. + "$inspector_protocol_dir/lib/Forward_h.template",
  2014. + "$inspector_protocol_dir/lib/FrontendChannel_h.template",
  2015. + "$inspector_protocol_dir/lib/Maybe_h.template",
  2016. + "$inspector_protocol_dir/lib/Object_cpp.template",
  2017. + "$inspector_protocol_dir/lib/Object_h.template",
  2018. + "$inspector_protocol_dir/lib/Parser_cpp.template",
  2019. + "$inspector_protocol_dir/lib/Parser_h.template",
  2020. + "$inspector_protocol_dir/lib/Protocol_cpp.template",
  2021. + "$inspector_protocol_dir/lib/ValueConversions_h.template",
  2022. + "$inspector_protocol_dir/lib/Values_cpp.template",
  2023. + "$inspector_protocol_dir/lib/Values_h.template",
  2024. + "$inspector_protocol_dir/templates/Exported_h.template",
  2025. + "$inspector_protocol_dir/templates/Imported_h.template",
  2026. + "$inspector_protocol_dir/templates/TypeBuilder_cpp.template",
  2027. + "$inspector_protocol_dir/templates/TypeBuilder_h.template",
  2028. + ]
  2029. +
  2030. + deps = [
  2031. + ":node_protocol_config",
  2032. + ":node_protocol_json",
  2033. + ]
  2034. +
  2035. + args = [
  2036. + "--jinja_dir",
  2037. + rebase_path("//third_party/", root_build_dir), # jinja is in chromium's third_party
  2038. + "--output_base",
  2039. + rebase_path("$target_gen_dir/src", root_build_dir),
  2040. + "--config",
  2041. + rebase_path("$target_gen_dir/node_protocol_config.json", root_build_dir),
  2042. + ]
  2043. +
  2044. + outputs =
  2045. + get_path_info(rebase_path(rebase_path(_protocol_generated,
  2046. + ".",
  2047. + "$inspector_protocol_output/.."),
  2048. + ".",
  2049. + "$target_gen_dir/src"),
  2050. + "abspath")
  2051. +}
  2052. +
  2053. +template("generate_protocol_json") {
  2054. + copy_target_name = target_name + "_copy"
  2055. + copy(copy_target_name) {
  2056. + sources = invoker.sources
  2057. + outputs = [
  2058. + "$target_gen_dir/{{source_file_part}}",
  2059. + ]
  2060. + }
  2061. + copied_pdl = get_target_outputs(":$copy_target_name")
  2062. + action(target_name) {
  2063. + deps = [
  2064. + ":$copy_target_name",
  2065. + ]
  2066. + sources = copied_pdl
  2067. + outputs = invoker.outputs
  2068. + script = "$inspector_protocol_dir/convert_protocol_to_json.py"
  2069. + args = rebase_path(sources + outputs, root_build_dir)
  2070. + }
  2071. +}
  2072. +
  2073. +copy("node_protocol_config") {
  2074. + sources = [
  2075. + "node_protocol_config.json",
  2076. + ]
  2077. + outputs = [
  2078. + "$target_gen_dir/{{source_file_part}}",
  2079. + ]
  2080. +}
  2081. +
  2082. +generate_protocol_json("node_protocol_json") {
  2083. + sources = [
  2084. + "node_protocol.pdl",
  2085. + ]
  2086. + outputs = [
  2087. + "$target_gen_dir/src/node_protocol.json",
  2088. + ]
  2089. +}
  2090. +
  2091. +generate_protocol_json("v8_protocol_json") {
  2092. + sources = [
  2093. + "//v8/include/js_protocol.pdl",
  2094. + ]
  2095. + outputs = [
  2096. + "$target_gen_dir/js_protocol.json",
  2097. + ]
  2098. +}
  2099. +
  2100. +action("concatenate_protocols") {
  2101. + deps = [
  2102. + ":node_protocol_json",
  2103. + ":v8_protocol_json",
  2104. + ]
  2105. + inputs = [
  2106. + "$target_gen_dir/js_protocol.json",
  2107. + "$target_gen_dir/src/node_protocol.json",
  2108. + ]
  2109. + outputs = [
  2110. + "$target_gen_dir/concatenated_protocol.json",
  2111. + ]
  2112. + script = "//v8/third_party/inspector_protocol/concatenate_protocols.py"
  2113. + args = rebase_path(inputs + outputs, root_build_dir)
  2114. +}
  2115. +
  2116. +action("v8_inspector_compress_protocol_json") {
  2117. + deps = [
  2118. + ":concatenate_protocols",
  2119. + ]
  2120. + inputs = [
  2121. + "$target_gen_dir/concatenated_protocol.json",
  2122. + ]
  2123. + outputs = [
  2124. + "$target_gen_dir/v8_inspector_protocol_json.h",
  2125. + ]
  2126. + script = "../../tools/compress_json.py"
  2127. + args = rebase_path(inputs + outputs, root_build_dir)
  2128. +}
  2129. diff --git a/src/node_builtins.cc b/src/node_builtins.cc
  2130. index 84815969b6d1faa7cc3ed177e04248d9cb074596..80b36dc1aefca4d5d4124d7f84b12b9762a8de2c 100644
  2131. --- a/src/node_builtins.cc
  2132. +++ b/src/node_builtins.cc
  2133. @@ -738,6 +738,7 @@ void BuiltinLoader::RegisterExternalReferences(
  2134. registry->Register(GetNatives);
  2135. RegisterExternalReferencesForInternalizedBuiltinCode(registry);
  2136. + EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(registry);
  2137. }
  2138. } // namespace builtins
  2139. diff --git a/src/node_builtins.h b/src/node_builtins.h
  2140. index 9f2fbc1e53937448aa27c1f5fe110eabc7edc0df..ea77c7598153bb8a9ba20c89a4ece2c1580b9a25 100644
  2141. --- a/src/node_builtins.h
  2142. +++ b/src/node_builtins.h
  2143. @@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
  2144. // Generated by tools/js2c.py as node_javascript.cc
  2145. void RegisterExternalReferencesForInternalizedBuiltinCode(
  2146. ExternalReferenceRegistry* registry);
  2147. +void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
  2148. + ExternalReferenceRegistry* registry);
  2149. // Handles compilation and caching of built-in JavaScript modules and
  2150. // bootstrap scripts, whose source are bundled into the binary as static data.
  2151. diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
  2152. new file mode 100755
  2153. index 0000000000000000000000000000000000000000..7848ddb1841b6d4f36e9376c73564eb4ff6d7c08
  2154. --- /dev/null
  2155. +++ b/tools/generate_gn_filenames_json.py
  2156. @@ -0,0 +1,90 @@
  2157. +#!/usr/bin/env python3
  2158. +import json
  2159. +import os
  2160. +import sys
  2161. +
  2162. +import install
  2163. +
  2164. +from utils import SearchFiles
  2165. +
  2166. +def LoadPythonDictionary(path):
  2167. + file_string = open(path).read()
  2168. + try:
  2169. + file_data = eval(file_string, {'__builtins__': None}, None)
  2170. + except SyntaxError as e:
  2171. + e.filename = path
  2172. + raise
  2173. + except Exception as e:
  2174. + raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
  2175. +
  2176. + assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
  2177. +
  2178. + return file_data
  2179. +
  2180. +
  2181. +FILENAMES_JSON_HEADER = '''
  2182. +// This file is automatically generated by generate_gn_filenames_json.py
  2183. +// DO NOT EDIT
  2184. +'''.lstrip()
  2185. +
  2186. +
  2187. +if __name__ == '__main__':
  2188. + node_root_dir = os.path.dirname(os.path.dirname(__file__))
  2189. + node_gyp_path = os.path.join(node_root_dir, 'node.gyp')
  2190. + out = {}
  2191. + node_gyp = LoadPythonDictionary(node_gyp_path)
  2192. + node_lib_target = next(
  2193. + t for t in node_gyp['targets']
  2194. + if t['target_name'] == '<(node_lib_target_name)')
  2195. + node_source_blocklist = {
  2196. + '<@(library_files)',
  2197. + '<@(deps_files)',
  2198. + '<@(node_sources)',
  2199. + 'common.gypi',
  2200. + '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
  2201. + }
  2202. +
  2203. + def filter_v8_files(files):
  2204. + if any(f.startswith('deps/v8/') for f in files):
  2205. + files = [f.replace('deps/v8/', '../../v8/', 1) if f.endswith('js') else f.replace('deps/v8/', '//v8/') for f in files]
  2206. +
  2207. + if any(f == '<@(node_builtin_shareable_builtins)' for f in files):
  2208. + files.remove('<@(node_builtin_shareable_builtins)')
  2209. + shared_builtins = ['deps/cjs-module-lexer/lexer.js', 'deps/cjs-module-lexer/dist/lexer.js', 'deps/undici/undici.js']
  2210. + files.extend(shared_builtins)
  2211. +
  2212. + return files
  2213. +
  2214. + def filter_fs_files(files):
  2215. + return [f for f in files if f.startswith('lib/internal/fs/')] + ['lib/fs.js']
  2216. +
  2217. + lib_files = SearchFiles('lib', 'js')
  2218. + out['library_files'] = filter_v8_files(lib_files)
  2219. + out['library_files'] += filter_v8_files(node_gyp['variables']['deps_files'])
  2220. + out['node_sources'] = node_gyp['variables']['node_sources']
  2221. +
  2222. + out['fs_files'] = filter_fs_files(out['library_files'])
  2223. + # fs files are handled separately
  2224. + out['library_files'] = [f for f in out['library_files'] if f not in out['fs_files']]
  2225. +
  2226. + blocklisted_sources = [
  2227. + f for f in node_lib_target['sources']
  2228. + if f not in node_source_blocklist]
  2229. + out['node_sources'] += filter_v8_files(blocklisted_sources)
  2230. +
  2231. + out['headers'] = []
  2232. + def add_headers(files, dest_dir):
  2233. + if 'src/node.h' in files:
  2234. + files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h']
  2235. + elif any(f.startswith('../../v8/') for f in files):
  2236. + files = [f.replace('../../v8/', '//v8/', 1) for f in files]
  2237. + if files:
  2238. + hs = {'files': sorted(files), 'dest_dir': dest_dir}
  2239. + out['headers'].append(hs)
  2240. +
  2241. + install.variables = {'node_shared_libuv': 'false'}
  2242. + install.headers(add_headers)
  2243. + with open(os.path.join(node_root_dir, 'filenames.json'), 'w') as f:
  2244. + f.write(FILENAMES_JSON_HEADER)
  2245. + f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
  2246. + f.write('\n')
  2247. diff --git a/tools/generate_original_fs.py b/tools/generate_original_fs.py
  2248. new file mode 100644
  2249. index 0000000000000000000000000000000000000000..98d569e6ba6d85a29a215a8f9ce3c1f6a9bd655e
  2250. --- /dev/null
  2251. +++ b/tools/generate_original_fs.py
  2252. @@ -0,0 +1,18 @@
  2253. +import os
  2254. +import sys
  2255. +
  2256. +node_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
  2257. +out_dir = sys.argv[1]
  2258. +fs_files = sys.argv[2:]
  2259. +
  2260. +for fs_file in fs_files:
  2261. + with open(os.path.join(node_root_dir, fs_file), 'r') as f:
  2262. + contents = f.read()
  2263. + original_fs_file = fs_file.replace('internal/fs/', 'internal/original-fs/').replace('lib/fs.js', 'lib/original-fs.js')
  2264. +
  2265. + with open(os.path.join(out_dir, fs_file), 'w') as original_f:
  2266. + original_f.write(contents)
  2267. +
  2268. + with open(os.path.join(out_dir, original_fs_file), 'w') as transformed_f:
  2269. + transformed_contents = contents.replace('internal/fs/', 'internal/original-fs/')
  2270. + transformed_f.write(transformed_contents)
  2271. diff --git a/tools/install.py b/tools/install.py
  2272. index 11616e1bcac5308020eb68fdb811bfb86cb14dd5..74b01f8352021f1105c080dbbf8bb29121a13501 100755
  2273. --- a/tools/install.py
  2274. +++ b/tools/install.py
  2275. @@ -199,105 +199,108 @@ def headers(action):
  2276. v8_headers = [
  2277. # The internal cppgc headers are depended on by the public
  2278. # ones, so they need to be included as well.
  2279. - 'deps/v8/include/cppgc/internal/api-constants.h',
  2280. - 'deps/v8/include/cppgc/internal/atomic-entry-flag.h',
  2281. - 'deps/v8/include/cppgc/internal/base-page-handle.h',
  2282. - 'deps/v8/include/cppgc/internal/caged-heap-local-data.h',
  2283. - 'deps/v8/include/cppgc/internal/caged-heap.h',
  2284. - 'deps/v8/include/cppgc/internal/compiler-specific.h',
  2285. - 'deps/v8/include/cppgc/internal/finalizer-trait.h',
  2286. - 'deps/v8/include/cppgc/internal/gc-info.h',
  2287. - 'deps/v8/include/cppgc/internal/logging.h',
  2288. - 'deps/v8/include/cppgc/internal/member-storage.h',
  2289. - 'deps/v8/include/cppgc/internal/name-trait.h',
  2290. - 'deps/v8/include/cppgc/internal/persistent-node.h',
  2291. - 'deps/v8/include/cppgc/internal/pointer-policies.h',
  2292. - 'deps/v8/include/cppgc/internal/write-barrier.h',
  2293. + '../../v8/include/cppgc/internal/api-constants.h',
  2294. + '../../v8/include/cppgc/internal/atomic-entry-flag.h',
  2295. + '../../v8/include/cppgc/internal/base-page-handle.h',
  2296. + '../../v8/include/cppgc/internal/caged-heap-local-data.h',
  2297. + '../../v8/include/cppgc/internal/caged-heap.h',
  2298. + '../../v8/include/cppgc/internal/compiler-specific.h',
  2299. + '../../v8/include/cppgc/internal/finalizer-trait.h',
  2300. + '../../v8/include/cppgc/internal/gc-info.h',
  2301. + '../../v8/include/cppgc/internal/logging.h',
  2302. + '../../v8/include/cppgc/internal/member-storage.h',
  2303. + '../../v8/include/cppgc/internal/name-trait.h',
  2304. + '../../v8/include/cppgc/internal/persistent-node.h',
  2305. + '../../v8/include/cppgc/internal/pointer-policies.h',
  2306. + '../../v8/include/cppgc/internal/write-barrier.h',
  2307. # cppgc headers
  2308. - 'deps/v8/include/cppgc/allocation.h',
  2309. - 'deps/v8/include/cppgc/common.h',
  2310. - 'deps/v8/include/cppgc/cross-thread-persistent.h',
  2311. - 'deps/v8/include/cppgc/custom-space.h',
  2312. - 'deps/v8/include/cppgc/default-platform.h',
  2313. - 'deps/v8/include/cppgc/ephemeron-pair.h',
  2314. - 'deps/v8/include/cppgc/explicit-management.h',
  2315. - 'deps/v8/include/cppgc/garbage-collected.h',
  2316. - 'deps/v8/include/cppgc/heap-consistency.h',
  2317. - 'deps/v8/include/cppgc/heap-handle.h',
  2318. - 'deps/v8/include/cppgc/heap-state.h',
  2319. - 'deps/v8/include/cppgc/heap-statistics.h',
  2320. - 'deps/v8/include/cppgc/heap.h',
  2321. - 'deps/v8/include/cppgc/liveness-broker.h',
  2322. - 'deps/v8/include/cppgc/macros.h',
  2323. - 'deps/v8/include/cppgc/member.h',
  2324. - 'deps/v8/include/cppgc/name-provider.h',
  2325. - 'deps/v8/include/cppgc/object-size-trait.h',
  2326. - 'deps/v8/include/cppgc/persistent.h',
  2327. - 'deps/v8/include/cppgc/platform.h',
  2328. - 'deps/v8/include/cppgc/prefinalizer.h',
  2329. - 'deps/v8/include/cppgc/process-heap-statistics.h',
  2330. - 'deps/v8/include/cppgc/sentinel-pointer.h',
  2331. - 'deps/v8/include/cppgc/source-location.h',
  2332. - 'deps/v8/include/cppgc/testing.h',
  2333. - 'deps/v8/include/cppgc/trace-trait.h',
  2334. - 'deps/v8/include/cppgc/type-traits.h',
  2335. - 'deps/v8/include/cppgc/visitor.h',
  2336. + '../../v8/include/cppgc/allocation.h',
  2337. + '../../v8/include/cppgc/common.h',
  2338. + '../../v8/include/cppgc/cross-thread-persistent.h',
  2339. + '../../v8/include/cppgc/custom-space.h',
  2340. + '../../v8/include/cppgc/default-platform.h',
  2341. + '../../v8/include/cppgc/ephemeron-pair.h',
  2342. + '../../v8/include/cppgc/explicit-management.h',
  2343. + '../../v8/include/cppgc/garbage-collected.h',
  2344. + '../../v8/include/cppgc/heap-consistency.h',
  2345. + '../../v8/include/cppgc/heap-handle.h',
  2346. + '../../v8/include/cppgc/heap-state.h',
  2347. + '../../v8/include/cppgc/heap-statistics.h',
  2348. + '../../v8/include/cppgc/heap.h',
  2349. + '../../v8/include/cppgc/liveness-broker.h',
  2350. + '../../v8/include/cppgc/macros.h',
  2351. + '../../v8/include/cppgc/member.h',
  2352. + '../../v8/include/cppgc/name-provider.h',
  2353. + '../../v8/include/cppgc/object-size-trait.h',
  2354. + '../../v8/include/cppgc/persistent.h',
  2355. + '../../v8/include/cppgc/platform.h',
  2356. + '../../v8/include/cppgc/prefinalizer.h',
  2357. + '../../v8/include/cppgc/process-heap-statistics.h',
  2358. + '../../v8/include/cppgc/sentinel-pointer.h',
  2359. + '../../v8/include/cppgc/source-location.h',
  2360. + '../../v8/include/cppgc/testing.h',
  2361. + '../../v8/include/cppgc/trace-trait.h',
  2362. + '../../v8/include/cppgc/type-traits.h',
  2363. + '../../v8/include/cppgc/visitor.h',
  2364. # libplatform headers
  2365. - 'deps/v8/include/libplatform/libplatform-export.h',
  2366. - 'deps/v8/include/libplatform/libplatform.h',
  2367. - 'deps/v8/include/libplatform/v8-tracing.h',
  2368. + '../../v8/include/libplatform/libplatform-export.h',
  2369. + '../../v8/include/libplatform/libplatform.h',
  2370. + '../../v8/include/libplatform/v8-tracing.h',
  2371. # v8 headers
  2372. - 'deps/v8/include/v8-array-buffer.h',
  2373. - 'deps/v8/include/v8-callbacks.h',
  2374. - 'deps/v8/include/v8-container.h',
  2375. - 'deps/v8/include/v8-context.h',
  2376. - 'deps/v8/include/v8-cppgc.h',
  2377. - 'deps/v8/include/v8-data.h',
  2378. - 'deps/v8/include/v8-date.h',
  2379. - 'deps/v8/include/v8-debug.h',
  2380. - 'deps/v8/include/v8-embedder-heap.h',
  2381. - 'deps/v8/include/v8-embedder-state-scope.h',
  2382. - 'deps/v8/include/v8-exception.h',
  2383. - 'deps/v8/include/v8-extension.h',
  2384. - 'deps/v8/include/v8-external.h',
  2385. - 'deps/v8/include/v8-forward.h',
  2386. - 'deps/v8/include/v8-function-callback.h',
  2387. - 'deps/v8/include/v8-function.h',
  2388. - 'deps/v8/include/v8-initialization.h',
  2389. - 'deps/v8/include/v8-internal.h',
  2390. - 'deps/v8/include/v8-isolate.h',
  2391. - 'deps/v8/include/v8-json.h',
  2392. - 'deps/v8/include/v8-local-handle.h',
  2393. - 'deps/v8/include/v8-locker.h',
  2394. - 'deps/v8/include/v8-maybe.h',
  2395. - 'deps/v8/include/v8-memory-span.h',
  2396. - 'deps/v8/include/v8-message.h',
  2397. - 'deps/v8/include/v8-microtask-queue.h',
  2398. - 'deps/v8/include/v8-microtask.h',
  2399. - 'deps/v8/include/v8-object.h',
  2400. - 'deps/v8/include/v8-persistent-handle.h',
  2401. - 'deps/v8/include/v8-platform.h',
  2402. - 'deps/v8/include/v8-primitive-object.h',
  2403. - 'deps/v8/include/v8-primitive.h',
  2404. - 'deps/v8/include/v8-profiler.h',
  2405. - 'deps/v8/include/v8-promise.h',
  2406. - 'deps/v8/include/v8-proxy.h',
  2407. - 'deps/v8/include/v8-regexp.h',
  2408. - 'deps/v8/include/v8-script.h',
  2409. - 'deps/v8/include/v8-snapshot.h',
  2410. - 'deps/v8/include/v8-statistics.h',
  2411. - 'deps/v8/include/v8-template.h',
  2412. - 'deps/v8/include/v8-traced-handle.h',
  2413. - 'deps/v8/include/v8-typed-array.h',
  2414. - 'deps/v8/include/v8-unwinder.h',
  2415. - 'deps/v8/include/v8-value-serializer.h',
  2416. - 'deps/v8/include/v8-value.h',
  2417. - 'deps/v8/include/v8-version.h',
  2418. - 'deps/v8/include/v8-wasm.h',
  2419. - 'deps/v8/include/v8-weak-callback-info.h',
  2420. - 'deps/v8/include/v8.h',
  2421. - 'deps/v8/include/v8config.h',
  2422. + '../../v8/include/v8-array-buffer.h',
  2423. + '../../v8/include/v8-callbacks.h',
  2424. + '../../v8/include/v8-container.h',
  2425. + '../../v8/include/v8-context.h',
  2426. + '../../v8/include/v8-cppgc.h',
  2427. + '../../v8/include/v8-data.h',
  2428. + '../../v8/include/v8-date.h',
  2429. + '../../v8/include/v8-debug.h',
  2430. + '../../v8/include/v8-embedder-heap.h',
  2431. + '../../v8/include/v8-embedder-state-scope.h',
  2432. + '../../v8/include/v8-exception.h',
  2433. + '../../v8/include/v8-extension.h',
  2434. + '../../v8/include/v8-external.h',
  2435. + '../../v8/include/v8-forward.h',
  2436. + '../../v8/include/v8-function-callback.h',
  2437. + '../../v8/include/v8-function.h',
  2438. + '../../v8/include/v8-handle-base.h',
  2439. + '../../v8/include/v8-initialization.h',
  2440. + '../../v8/include/v8-internal.h',
  2441. + '../../v8/include/v8-isolate.h',
  2442. + '../../v8/include/v8-json.h',
  2443. + '../../v8/include/v8-local-handle.h',
  2444. + '../../v8/include/v8-locker.h',
  2445. + '../../v8/include/v8-maybe.h',
  2446. + '../../v8/include/v8-memory-span.h',
  2447. + '../../v8/include/v8-message.h',
  2448. + '../../v8/include/v8-microtask-queue.h',
  2449. + '../../v8/include/v8-microtask.h',
  2450. + '../../v8/include/v8-object.h',
  2451. + '../../v8/include/v8-persistent-handle.h',
  2452. + '../../v8/include/v8-platform.h',
  2453. + '../../v8/include/v8-primitive-object.h',
  2454. + '../../v8/include/v8-primitive.h',
  2455. + '../../v8/include/v8-profiler.h',
  2456. + '../../v8/include/v8-promise.h',
  2457. + '../../v8/include/v8-proxy.h',
  2458. + '../../v8/include/v8-regexp.h',
  2459. + '../../v8/include/v8-script.h',
  2460. + '../../v8/include/v8-snapshot.h',
  2461. + '../../v8/include/v8-source-location.h',
  2462. + '../../v8/include/v8-statistics.h',
  2463. + '../../v8/include/v8-template.h',
  2464. + '../../v8/include/v8-traced-handle.h',
  2465. + '../../v8/include/v8-typed-array.h',
  2466. + '../../v8/include/v8-unwinder.h',
  2467. + '../../v8/include/v8-value-serializer.h',
  2468. + '../../v8/include/v8-value.h',
  2469. + '../../v8/include/v8-version.h',
  2470. + '../../v8/include/v8-wasm.h',
  2471. + '../../v8/include/v8-weak-callback-info.h',
  2472. + '../../v8/include/v8.h',
  2473. + '../../v8/include/v8config.h',
  2474. ]
  2475. + v8_headers = [h.replace('deps/', '../../') for h in v8_headers]
  2476. files_arg = [name for name in files_arg if name in v8_headers]
  2477. action(files_arg, dest)
  2478. @@ -324,7 +327,7 @@ def headers(action):
  2479. if sys.platform.startswith('aix') or sys.platform == "os400":
  2480. action(['out/Release/node.exp'], 'include/node/')
  2481. - subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
  2482. + subdir_files('../../v8/include', 'include/node/', wanted_v8_headers)
  2483. if 'false' == variables.get('node_shared_libuv'):
  2484. subdir_files('deps/uv/include', 'include/node/', action)
  2485. diff --git a/tools/js2c.cc b/tools/js2c.cc
  2486. old mode 100644
  2487. new mode 100755
  2488. index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26721d1413
  2489. --- a/tools/js2c.cc
  2490. +++ b/tools/js2c.cc
  2491. @@ -29,6 +29,7 @@ namespace js2c {
  2492. int Main(int argc, char* argv[]);
  2493. static bool is_verbose = false;
  2494. +static bool only_js = false;
  2495. void Debug(const char* format, ...) {
  2496. va_list arguments;
  2497. @@ -195,6 +196,7 @@ const char* kTemplate = R"(
  2498. #include "node_builtins.h"
  2499. #include "node_external_reference.h"
  2500. #include "node_internals.h"
  2501. +#include "node_threadsafe_cow-inl.h"
  2502. namespace node {
  2503. @@ -210,7 +212,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
  2504. } // anonymous namespace
  2505. void BuiltinLoader::LoadJavaScriptSource() {
  2506. - source_ = global_source_map;
  2507. + BuiltinSourceMap map = *source_.read();
  2508. + BuiltinSourceMap new_map = *global_source_map.read();
  2509. +
  2510. + map.merge(new_map);
  2511. + source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
  2512. }
  2513. void RegisterExternalReferencesForInternalizedBuiltinCode(
  2514. @@ -227,6 +233,45 @@ UnionBytes BuiltinLoader::GetConfig() {
  2515. } // namespace node
  2516. )";
  2517. +const char* kEmbedderTemplate = R"(
  2518. +#include "env-inl.h"
  2519. +#include "node_builtins.h"
  2520. +#include "node_external_reference.h"
  2521. +#include "node_internals.h"
  2522. +#include "node_threadsafe_cow-inl.h"
  2523. +
  2524. +namespace node {
  2525. +
  2526. +namespace builtins {
  2527. +
  2528. +%.*s
  2529. +namespace {
  2530. +const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
  2531. + BuiltinSourceMap {
  2532. +%.*s
  2533. + } // BuiltinSourceMap
  2534. +
  2535. +}; // ThreadsafeCopyOnWrite
  2536. +} // anonymous namespace
  2537. +
  2538. +void BuiltinLoader::LoadEmbedderJavaScriptSource() {
  2539. + BuiltinSourceMap map = *source_.read();
  2540. + BuiltinSourceMap new_map = *global_source_map.read();
  2541. +
  2542. + map.merge(new_map);
  2543. + source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
  2544. +}
  2545. +
  2546. +void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
  2547. + ExternalReferenceRegistry* registry) {
  2548. +%.*s
  2549. +}
  2550. +
  2551. +} // namespace builtins
  2552. +
  2553. +} // namespace node
  2554. +)";
  2555. +
  2556. Fragment Format(const Fragments& definitions,
  2557. const Fragments& initializers,
  2558. const Fragments& registrations) {
  2559. @@ -236,13 +281,12 @@ Fragment Format(const Fragments& definitions,
  2560. size_t init_size = init_buf.size();
  2561. std::vector<char> reg_buf = Join(registrations, "\n");
  2562. size_t reg_size = reg_buf.size();
  2563. -
  2564. - size_t result_size =
  2565. - def_size + init_size + reg_size + strlen(kTemplate) + 100;
  2566. + size_t result_size = def_size + init_size + reg_size +
  2567. + strlen(only_js ? kEmbedderTemplate: kTemplate) + 300;
  2568. std::vector<char> result(result_size, 0);
  2569. int r = snprintf(result.data(),
  2570. result_size,
  2571. - kTemplate,
  2572. + only_js ? kEmbedderTemplate: kTemplate,
  2573. static_cast<int>(def_buf.size()),
  2574. def_buf.data(),
  2575. static_cast<int>(init_buf.size()),
  2576. @@ -711,12 +755,15 @@ int JS2C(const FileList& js_files,
  2577. }
  2578. }
  2579. + if (!only_js) {
  2580. assert(FilenameIsConfigGypi(config));
  2581. // "config.gypi" -> config_raw.
  2582. int r = AddGypi("config", config, &definitions);
  2583. if (r != 0) {
  2584. return r;
  2585. }
  2586. + }
  2587. +
  2588. Fragment out = Format(definitions, initializers, registrations);
  2589. return WriteIfChanged(out, dest);
  2590. }
  2591. @@ -742,6 +789,8 @@ int Main(int argc, char* argv[]) {
  2592. std::string arg(argv[i]);
  2593. if (arg == "--verbose") {
  2594. is_verbose = true;
  2595. + } else if (arg == "--only-js") {
  2596. + only_js = true;
  2597. } else if (arg == "--root") {
  2598. if (i == argc - 1) {
  2599. fprintf(stderr, "--root must be followed by a path\n");
  2600. @@ -790,6 +839,14 @@ int Main(int argc, char* argv[]) {
  2601. }
  2602. }
  2603. + if (only_js) {
  2604. + auto js_it = file_map.find(".js");
  2605. +
  2606. + assert(file_map.size() == 1);
  2607. + assert(js_it != file_map.end());
  2608. +
  2609. + return JS2C(js_it->second, FileList(), std::string(), output);
  2610. + } else {
  2611. // Should have exactly 3 types: `.js`, `.mjs` and `.gypi`.
  2612. assert(file_map.size() == 3);
  2613. auto gypi_it = file_map.find(".gypi");
  2614. @@ -809,6 +866,7 @@ int Main(int argc, char* argv[]) {
  2615. std::sort(mjs_it->second.begin(), mjs_it->second.end());
  2616. return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
  2617. + }
  2618. }
  2619. } // namespace js2c
  2620. } // namespace node
  2621. @@ -817,4 +875,4 @@ NODE_MAIN(int argc, node::argv_type raw_argv[]) {
  2622. char** argv;
  2623. node::FixupMain(argc, raw_argv, &argv);
  2624. return node::js2c::Main(argc, argv);
  2625. -}
  2626. +}
  2627. \ No newline at end of file