@volter/tabnode 0.2.14-volter.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +78 -0
  3. package/THIRD-PARTY-NOTICES.md +12 -0
  4. package/dist/__sw__.js +526 -0
  5. package/dist/assets/runtime-worker-4MKaHFVb.js +75221 -0
  6. package/dist/assets/runtime-worker-4MKaHFVb.js.map +1 -0
  7. package/dist/code-transforms.d.ts +21 -0
  8. package/dist/code-transforms.d.ts.map +1 -0
  9. package/dist/config/cdn.d.ts +12 -0
  10. package/dist/config/cdn.d.ts.map +1 -0
  11. package/dist/create-runtime.d.ts +22 -0
  12. package/dist/create-runtime.d.ts.map +1 -0
  13. package/dist/host-globals.d.ts +62 -0
  14. package/dist/host-globals.d.ts.map +1 -0
  15. package/dist/index.cjs +36021 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.ts +127 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.mjs +36020 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/node-internals.d.ts +68 -0
  22. package/dist/node-internals.d.ts.map +1 -0
  23. package/dist/node-lib/binding/blob.d.ts +12 -0
  24. package/dist/node-lib/binding/blob.d.ts.map +1 -0
  25. package/dist/node-lib/binding/buffer.d.ts +144 -0
  26. package/dist/node-lib/binding/buffer.d.ts.map +1 -0
  27. package/dist/node-lib/binding/cares_wrap.d.ts +14 -0
  28. package/dist/node-lib/binding/cares_wrap.d.ts.map +1 -0
  29. package/dist/node-lib/binding/fds.d.ts +30 -0
  30. package/dist/node-lib/binding/fds.d.ts.map +1 -0
  31. package/dist/node-lib/binding/fs.d.ts +157 -0
  32. package/dist/node-lib/binding/fs.d.ts.map +1 -0
  33. package/dist/node-lib/binding/handles.d.ts +81 -0
  34. package/dist/node-lib/binding/handles.d.ts.map +1 -0
  35. package/dist/node-lib/binding/http_parser.d.ts +122 -0
  36. package/dist/node-lib/binding/http_parser.d.ts.map +1 -0
  37. package/dist/node-lib/binding/index.d.ts +3 -0
  38. package/dist/node-lib/binding/index.d.ts.map +1 -0
  39. package/dist/node-lib/binding/llhttp-wasm.d.ts +22 -0
  40. package/dist/node-lib/binding/llhttp-wasm.d.ts.map +1 -0
  41. package/dist/node-lib/binding/misc.d.ts +123 -0
  42. package/dist/node-lib/binding/misc.d.ts.map +1 -0
  43. package/dist/node-lib/binding/pipe_wrap.d.ts +84 -0
  44. package/dist/node-lib/binding/pipe_wrap.d.ts.map +1 -0
  45. package/dist/node-lib/binding/process_wrap.d.ts +173 -0
  46. package/dist/node-lib/binding/process_wrap.d.ts.map +1 -0
  47. package/dist/node-lib/binding/spawn_sync.d.ts +30 -0
  48. package/dist/node-lib/binding/spawn_sync.d.ts.map +1 -0
  49. package/dist/node-lib/binding/stream_wrap.d.ts +191 -0
  50. package/dist/node-lib/binding/stream_wrap.d.ts.map +1 -0
  51. package/dist/node-lib/binding/stubs.d.ts +23 -0
  52. package/dist/node-lib/binding/stubs.d.ts.map +1 -0
  53. package/dist/node-lib/binding/tcp_wrap.d.ts +98 -0
  54. package/dist/node-lib/binding/tcp_wrap.d.ts.map +1 -0
  55. package/dist/node-lib/binding/tty_wrap.d.ts +36 -0
  56. package/dist/node-lib/binding/tty_wrap.d.ts.map +1 -0
  57. package/dist/node-lib/binding/util.d.ts +126 -0
  58. package/dist/node-lib/binding/util.d.ts.map +1 -0
  59. package/dist/node-lib/binding/uv.d.ts +32 -0
  60. package/dist/node-lib/binding/uv.d.ts.map +1 -0
  61. package/dist/node-lib/binding/zlib-pako.d.ts +22 -0
  62. package/dist/node-lib/binding/zlib-pako.d.ts.map +1 -0
  63. package/dist/node-lib/binding/zlib.d.ts +38 -0
  64. package/dist/node-lib/binding/zlib.d.ts.map +1 -0
  65. package/dist/node-lib/buffer-module.d.ts +51 -0
  66. package/dist/node-lib/buffer-module.d.ts.map +1 -0
  67. package/dist/node-lib/child-process-module.d.ts +26 -0
  68. package/dist/node-lib/child-process-module.d.ts.map +1 -0
  69. package/dist/node-lib/events-module.d.ts +58 -0
  70. package/dist/node-lib/events-module.d.ts.map +1 -0
  71. package/dist/node-lib/fs-module.d.ts +5 -0
  72. package/dist/node-lib/fs-module.d.ts.map +1 -0
  73. package/dist/node-lib/http-bridge.d.ts +43 -0
  74. package/dist/node-lib/http-bridge.d.ts.map +1 -0
  75. package/dist/node-lib/http-module.d.ts +35 -0
  76. package/dist/node-lib/http-module.d.ts.map +1 -0
  77. package/dist/node-lib/internals/addresses.d.ts +40 -0
  78. package/dist/node-lib/internals/addresses.d.ts.map +1 -0
  79. package/dist/node-lib/internals/buffer-and-streams.d.ts +96 -0
  80. package/dist/node-lib/internals/buffer-and-streams.d.ts.map +1 -0
  81. package/dist/node-lib/internals/child-process.d.ts +27 -0
  82. package/dist/node-lib/internals/child-process.d.ts.map +1 -0
  83. package/dist/node-lib/internals/events-util.d.ts +83 -0
  84. package/dist/node-lib/internals/events-util.d.ts.map +1 -0
  85. package/dist/node-lib/internals/index.d.ts +2 -0
  86. package/dist/node-lib/internals/index.d.ts.map +1 -0
  87. package/dist/node-lib/internals/modules.d.ts +67 -0
  88. package/dist/node-lib/internals/modules.d.ts.map +1 -0
  89. package/dist/node-lib/internals/readline-access.d.ts +2 -0
  90. package/dist/node-lib/internals/readline-access.d.ts.map +1 -0
  91. package/dist/node-lib/internals/runtime.d.ts +150 -0
  92. package/dist/node-lib/internals/runtime.d.ts.map +1 -0
  93. package/dist/node-lib/internals/util.d.ts +33 -0
  94. package/dist/node-lib/internals/util.d.ts.map +1 -0
  95. package/dist/node-lib/lazy.d.ts +31 -0
  96. package/dist/node-lib/lazy.d.ts.map +1 -0
  97. package/dist/node-lib/load.d.ts +27 -0
  98. package/dist/node-lib/load.d.ts.map +1 -0
  99. package/dist/node-lib/module-hooks.d.ts +89 -0
  100. package/dist/node-lib/module-hooks.d.ts.map +1 -0
  101. package/dist/node-lib/net-module.d.ts +181 -0
  102. package/dist/node-lib/net-module.d.ts.map +1 -0
  103. package/dist/node-lib/node-versions.d.ts +27 -0
  104. package/dist/node-lib/node-versions.d.ts.map +1 -0
  105. package/dist/node-lib/public-modules.d.ts +2 -0
  106. package/dist/node-lib/public-modules.d.ts.map +1 -0
  107. package/dist/node-lib/require-hook.d.ts +15 -0
  108. package/dist/node-lib/require-hook.d.ts.map +1 -0
  109. package/dist/node-lib/small-modules.d.ts +16 -0
  110. package/dist/node-lib/small-modules.d.ts.map +1 -0
  111. package/dist/node-lib/sources.d.ts +4 -0
  112. package/dist/node-lib/sources.d.ts.map +1 -0
  113. package/dist/node-lib/stream-module.d.ts +77 -0
  114. package/dist/node-lib/stream-module.d.ts.map +1 -0
  115. package/dist/node-lib/timers.d.ts +19 -0
  116. package/dist/node-lib/timers.d.ts.map +1 -0
  117. package/dist/node-lib/util-module.d.ts +76 -0
  118. package/dist/node-lib/util-module.d.ts.map +1 -0
  119. package/dist/node-resolution.d.ts +50 -0
  120. package/dist/node-resolution.d.ts.map +1 -0
  121. package/dist/node-resolver.d.ts +7 -0
  122. package/dist/node-resolver.d.ts.map +1 -0
  123. package/dist/npm/index.d.ts +73 -0
  124. package/dist/npm/index.d.ts.map +1 -0
  125. package/dist/npm/registry.d.ts +111 -0
  126. package/dist/npm/registry.d.ts.map +1 -0
  127. package/dist/npm/resolver.d.ts +79 -0
  128. package/dist/npm/resolver.d.ts.map +1 -0
  129. package/dist/npm/tarball.d.ts +28 -0
  130. package/dist/npm/tarball.d.ts.map +1 -0
  131. package/dist/process-tokens.d.ts +77 -0
  132. package/dist/process-tokens.d.ts.map +1 -0
  133. package/dist/punycode-source.d.ts +3 -0
  134. package/dist/punycode-source.d.ts.map +1 -0
  135. package/dist/runtime-interface.d.ts +74 -0
  136. package/dist/runtime-interface.d.ts.map +1 -0
  137. package/dist/runtime.d.ts +144 -0
  138. package/dist/runtime.d.ts.map +1 -0
  139. package/dist/server-bridge.d.ts +147 -0
  140. package/dist/server-bridge.d.ts.map +1 -0
  141. package/dist/shims/async_hooks.d.ts +50 -0
  142. package/dist/shims/async_hooks.d.ts.map +1 -0
  143. package/dist/shims/child_process.d.ts +104 -0
  144. package/dist/shims/child_process.d.ts.map +1 -0
  145. package/dist/shims/cluster.d.ts +52 -0
  146. package/dist/shims/cluster.d.ts.map +1 -0
  147. package/dist/shims/command-line.d.ts +43 -0
  148. package/dist/shims/command-line.d.ts.map +1 -0
  149. package/dist/shims/constants.d.ts +222 -0
  150. package/dist/shims/constants.d.ts.map +1 -0
  151. package/dist/shims/crypto-constants.d.ts +12 -0
  152. package/dist/shims/crypto-constants.d.ts.map +1 -0
  153. package/dist/shims/crypto.d.ts +144 -0
  154. package/dist/shims/crypto.d.ts.map +1 -0
  155. package/dist/shims/dgram.d.ts +34 -0
  156. package/dist/shims/dgram.d.ts.map +1 -0
  157. package/dist/shims/dns.d.ts +91 -0
  158. package/dist/shims/dns.d.ts.map +1 -0
  159. package/dist/shims/domain.d.ts +25 -0
  160. package/dist/shims/domain.d.ts.map +1 -0
  161. package/dist/shims/esbuild.d.ts +205 -0
  162. package/dist/shims/esbuild.d.ts.map +1 -0
  163. package/dist/shims/fs.d.ts +25 -0
  164. package/dist/shims/fs.d.ts.map +1 -0
  165. package/dist/shims/http2.d.ts +81 -0
  166. package/dist/shims/http2.d.ts.map +1 -0
  167. package/dist/shims/inspector.d.ts +25 -0
  168. package/dist/shims/inspector.d.ts.map +1 -0
  169. package/dist/shims/module.d.ts +22 -0
  170. package/dist/shims/module.d.ts.map +1 -0
  171. package/dist/shims/os.d.ts +159 -0
  172. package/dist/shims/os.d.ts.map +1 -0
  173. package/dist/shims/path.d.ts +52 -0
  174. package/dist/shims/path.d.ts.map +1 -0
  175. package/dist/shims/perf_hooks.d.ts +50 -0
  176. package/dist/shims/perf_hooks.d.ts.map +1 -0
  177. package/dist/shims/process.d.ts +226 -0
  178. package/dist/shims/process.d.ts.map +1 -0
  179. package/dist/shims/rollup.d.ts +71 -0
  180. package/dist/shims/rollup.d.ts.map +1 -0
  181. package/dist/shims/string_decoder.d.ts +41 -0
  182. package/dist/shims/string_decoder.d.ts.map +1 -0
  183. package/dist/shims/sync-child.d.ts +64 -0
  184. package/dist/shims/sync-child.d.ts.map +1 -0
  185. package/dist/shims/tls.d.ts +53 -0
  186. package/dist/shims/tls.d.ts.map +1 -0
  187. package/dist/shims/url.d.ts +84 -0
  188. package/dist/shims/url.d.ts.map +1 -0
  189. package/dist/shims/v8.d.ts +73 -0
  190. package/dist/shims/v8.d.ts.map +1 -0
  191. package/dist/shims/vfs-adapter.d.ts +126 -0
  192. package/dist/shims/vfs-adapter.d.ts.map +1 -0
  193. package/dist/shims/vm.d.ts +52 -0
  194. package/dist/shims/vm.d.ts.map +1 -0
  195. package/dist/shims/wasi.d.ts +78 -0
  196. package/dist/shims/wasi.d.ts.map +1 -0
  197. package/dist/shims/worker_threads.d.ts +66 -0
  198. package/dist/shims/worker_threads.d.ts.map +1 -0
  199. package/dist/shims/zlib-constants.d.ts +66 -0
  200. package/dist/shims/zlib-constants.d.ts.map +1 -0
  201. package/dist/shims/zlib.d.ts +102 -0
  202. package/dist/shims/zlib.d.ts.map +1 -0
  203. package/dist/transform.d.ts +24 -0
  204. package/dist/transform.d.ts.map +1 -0
  205. package/dist/types/package-json.d.ts +18 -0
  206. package/dist/types/package-json.d.ts.map +1 -0
  207. package/dist/utils/binary-encoding.d.ts +13 -0
  208. package/dist/utils/binary-encoding.d.ts.map +1 -0
  209. package/dist/utils/glob.d.ts +19 -0
  210. package/dist/utils/glob.d.ts.map +1 -0
  211. package/dist/utils/hash.d.ts +6 -0
  212. package/dist/utils/hash.d.ts.map +1 -0
  213. package/dist/virtual-fs.d.ts +259 -0
  214. package/dist/virtual-fs.d.ts.map +1 -0
  215. package/dist/vite-plugin.cjs +50 -0
  216. package/dist/vite-plugin.cjs.map +1 -0
  217. package/dist/vite-plugin.d.ts +36 -0
  218. package/dist/vite-plugin.d.ts.map +1 -0
  219. package/dist/vite-plugin.mjs +31 -0
  220. package/dist/vite-plugin.mjs.map +1 -0
  221. package/dist/worker/runtime-worker.d.ts +8 -0
  222. package/dist/worker/runtime-worker.d.ts.map +1 -0
  223. package/dist/worker-runtime.d.ts +50 -0
  224. package/dist/worker-runtime.d.ts.map +1 -0
  225. package/package.json +88 -0
  226. package/src/code-transforms.ts +560 -0
  227. package/src/config/cdn.ts +13 -0
  228. package/src/create-runtime.ts +89 -0
  229. package/src/host-globals.ts +121 -0
  230. package/src/index.ts +235 -0
  231. package/src/node-internals.ts +283 -0
  232. package/src/node-lib/LICENSE +47 -0
  233. package/src/node-lib/_http_agent.js +547 -0
  234. package/src/node-lib/_http_client.js +996 -0
  235. package/src/node-lib/_http_common.js +269 -0
  236. package/src/node-lib/_http_incoming.js +453 -0
  237. package/src/node-lib/_http_outgoing.js +1262 -0
  238. package/src/node-lib/_http_server.js +1230 -0
  239. package/src/node-lib/assert/strict.js +3 -0
  240. package/src/node-lib/assert.js +844 -0
  241. package/src/node-lib/binding/blob.ts +35 -0
  242. package/src/node-lib/binding/buffer.ts +465 -0
  243. package/src/node-lib/binding/cares_wrap.ts +57 -0
  244. package/src/node-lib/binding/fds.ts +80 -0
  245. package/src/node-lib/binding/fs.ts +857 -0
  246. package/src/node-lib/binding/handles.ts +187 -0
  247. package/src/node-lib/binding/http_parser.ts +536 -0
  248. package/src/node-lib/binding/index.ts +77 -0
  249. package/src/node-lib/binding/llhttp-wasm.ts +670 -0
  250. package/src/node-lib/binding/misc.ts +252 -0
  251. package/src/node-lib/binding/pipe_wrap.ts +166 -0
  252. package/src/node-lib/binding/process_wrap.ts +371 -0
  253. package/src/node-lib/binding/spawn_sync.ts +141 -0
  254. package/src/node-lib/binding/stream_wrap.ts +413 -0
  255. package/src/node-lib/binding/stubs.ts +19 -0
  256. package/src/node-lib/binding/tcp_wrap.ts +254 -0
  257. package/src/node-lib/binding/tty_wrap.ts +56 -0
  258. package/src/node-lib/binding/util.ts +274 -0
  259. package/src/node-lib/binding/uv.ts +102 -0
  260. package/src/node-lib/binding/zlib-pako.ts +50 -0
  261. package/src/node-lib/binding/zlib.ts +259 -0
  262. package/src/node-lib/buffer-module.ts +70 -0
  263. package/src/node-lib/buffer.js +1373 -0
  264. package/src/node-lib/child-process-module.ts +58 -0
  265. package/src/node-lib/child_process.js +1046 -0
  266. package/src/node-lib/constants.js +41 -0
  267. package/src/node-lib/diagnostics_channel.js +438 -0
  268. package/src/node-lib/events-module.ts +80 -0
  269. package/src/node-lib/events.js +1223 -0
  270. package/src/node-lib/fs-module.ts +43 -0
  271. package/src/node-lib/fs.js +3377 -0
  272. package/src/node-lib/http-bridge.ts +299 -0
  273. package/src/node-lib/http-module.ts +53 -0
  274. package/src/node-lib/http.js +198 -0
  275. package/src/node-lib/https.js +429 -0
  276. package/src/node-lib/internal/assert/assertion_error.js +417 -0
  277. package/src/node-lib/internal/assert/calltracker.js +153 -0
  278. package/src/node-lib/internal/assert/myers_diff.js +177 -0
  279. package/src/node-lib/internal/assert/utils.js +278 -0
  280. package/src/node-lib/internal/buffer.js +1120 -0
  281. package/src/node-lib/internal/child_process/serialization.js +169 -0
  282. package/src/node-lib/internal/child_process.js +1135 -0
  283. package/src/node-lib/internal/constants.js +56 -0
  284. package/src/node-lib/internal/deps/minimatch/index.js +1628 -0
  285. package/src/node-lib/internal/errors.js +1912 -0
  286. package/src/node-lib/internal/events/abort_listener.js +54 -0
  287. package/src/node-lib/internal/events/symbols.js +11 -0
  288. package/src/node-lib/internal/fixed_queue.js +119 -0
  289. package/src/node-lib/internal/freelist.js +30 -0
  290. package/src/node-lib/internal/fs/cp/cp-sync.js +242 -0
  291. package/src/node-lib/internal/fs/cp/cp.js +382 -0
  292. package/src/node-lib/internal/fs/dir.js +369 -0
  293. package/src/node-lib/internal/fs/glob.js +763 -0
  294. package/src/node-lib/internal/fs/promises.js +1312 -0
  295. package/src/node-lib/internal/fs/read/context.js +129 -0
  296. package/src/node-lib/internal/fs/recursive_watch.js +275 -0
  297. package/src/node-lib/internal/fs/rimraf.js +311 -0
  298. package/src/node-lib/internal/fs/streams.js +571 -0
  299. package/src/node-lib/internal/fs/sync_write_stream.js +49 -0
  300. package/src/node-lib/internal/fs/utils.js +987 -0
  301. package/src/node-lib/internal/fs/watchers.js +418 -0
  302. package/src/node-lib/internal/http.js +62 -0
  303. package/src/node-lib/internal/mime.js +389 -0
  304. package/src/node-lib/internal/modules/customization_hooks.js +406 -0
  305. package/src/node-lib/internal/net.js +95 -0
  306. package/src/node-lib/internal/querystring.js +119 -0
  307. package/src/node-lib/internal/readline/callbacks.js +132 -0
  308. package/src/node-lib/internal/readline/emitKeypressEvents.js +99 -0
  309. package/src/node-lib/internal/readline/interface.js +1418 -0
  310. package/src/node-lib/internal/readline/promises.js +144 -0
  311. package/src/node-lib/internal/readline/utils.js +405 -0
  312. package/src/node-lib/internal/socket_list.js +108 -0
  313. package/src/node-lib/internal/stream_base_commons.js +280 -0
  314. package/src/node-lib/internal/streams/add-abort-signal.js +60 -0
  315. package/src/node-lib/internal/streams/compose.js +257 -0
  316. package/src/node-lib/internal/streams/destroy.js +361 -0
  317. package/src/node-lib/internal/streams/duplex.js +203 -0
  318. package/src/node-lib/internal/streams/duplexify.js +379 -0
  319. package/src/node-lib/internal/streams/duplexpair.js +62 -0
  320. package/src/node-lib/internal/streams/end-of-stream.js +331 -0
  321. package/src/node-lib/internal/streams/from.js +208 -0
  322. package/src/node-lib/internal/streams/lazy_transform.js +57 -0
  323. package/src/node-lib/internal/streams/legacy.js +125 -0
  324. package/src/node-lib/internal/streams/operators.js +436 -0
  325. package/src/node-lib/internal/streams/passthrough.js +47 -0
  326. package/src/node-lib/internal/streams/pipeline.js +465 -0
  327. package/src/node-lib/internal/streams/readable.js +1762 -0
  328. package/src/node-lib/internal/streams/state.js +51 -0
  329. package/src/node-lib/internal/streams/transform.js +204 -0
  330. package/src/node-lib/internal/streams/utils.js +363 -0
  331. package/src/node-lib/internal/streams/writable.js +1163 -0
  332. package/src/node-lib/internal/tty.js +260 -0
  333. package/src/node-lib/internal/util/colors.js +40 -0
  334. package/src/node-lib/internal/util/comparisons.js +1028 -0
  335. package/src/node-lib/internal/util/debuglog.js +524 -0
  336. package/src/node-lib/internal/util/inspect.js +2535 -0
  337. package/src/node-lib/internal/util/parse_args/parse_args.js +412 -0
  338. package/src/node-lib/internal/util/parse_args/utils.js +197 -0
  339. package/src/node-lib/internal/util.js +1003 -0
  340. package/src/node-lib/internal/validators.js +654 -0
  341. package/src/node-lib/internals/addresses.ts +159 -0
  342. package/src/node-lib/internals/buffer-and-streams.ts +224 -0
  343. package/src/node-lib/internals/child-process.ts +64 -0
  344. package/src/node-lib/internals/events-util.ts +105 -0
  345. package/src/node-lib/internals/index.ts +66 -0
  346. package/src/node-lib/internals/modules.ts +117 -0
  347. package/src/node-lib/internals/readline-access.ts +16 -0
  348. package/src/node-lib/internals/runtime.ts +277 -0
  349. package/src/node-lib/internals/util.ts +98 -0
  350. package/src/node-lib/lazy.ts +158 -0
  351. package/src/node-lib/load.ts +390 -0
  352. package/src/node-lib/module-hooks.ts +281 -0
  353. package/src/node-lib/net-module.ts +248 -0
  354. package/src/node-lib/net.js +2540 -0
  355. package/src/node-lib/node-versions.ts +34 -0
  356. package/src/node-lib/os.js +356 -0
  357. package/src/node-lib/path.js +1694 -0
  358. package/src/node-lib/primordials.js +743 -0
  359. package/src/node-lib/public-modules.ts +109 -0
  360. package/src/node-lib/punycode.js +455 -0
  361. package/src/node-lib/querystring.js +484 -0
  362. package/src/node-lib/readline/promises.js +73 -0
  363. package/src/node-lib/readline.js +523 -0
  364. package/src/node-lib/require-hook.ts +27 -0
  365. package/src/node-lib/small-modules.ts +35 -0
  366. package/src/node-lib/sources.ts +200 -0
  367. package/src/node-lib/stream/promises.js +44 -0
  368. package/src/node-lib/stream-module.ts +101 -0
  369. package/src/node-lib/stream.js +152 -0
  370. package/src/node-lib/timers.ts +33 -0
  371. package/src/node-lib/tty.js +168 -0
  372. package/src/node-lib/util-module.ts +104 -0
  373. package/src/node-lib/util.js +689 -0
  374. package/src/node-lib/wasi.js +179 -0
  375. package/src/node-lib/zlib.js +1036 -0
  376. package/src/node-resolution.ts +241 -0
  377. package/src/node-resolver.ts +33 -0
  378. package/src/npm/index.ts +425 -0
  379. package/src/npm/registry.ts +235 -0
  380. package/src/npm/resolver.ts +589 -0
  381. package/src/npm/tarball.ts +246 -0
  382. package/src/process-tokens.ts +156 -0
  383. package/src/punycode-source.ts +6 -0
  384. package/src/runtime-interface.ts +85 -0
  385. package/src/runtime.ts +3073 -0
  386. package/src/server-bridge.ts +971 -0
  387. package/src/shims/async_hooks.ts +181 -0
  388. package/src/shims/child_process.ts +1591 -0
  389. package/src/shims/cluster.ts +79 -0
  390. package/src/shims/command-line.ts +79 -0
  391. package/src/shims/constants.ts +68 -0
  392. package/src/shims/crypto-constants.ts +11 -0
  393. package/src/shims/crypto.ts +1061 -0
  394. package/src/shims/dgram.ts +47 -0
  395. package/src/shims/dns.ts +185 -0
  396. package/src/shims/domain.ts +58 -0
  397. package/src/shims/esbuild.ts +1638 -0
  398. package/src/shims/fs.ts +82 -0
  399. package/src/shims/http2.ts +96 -0
  400. package/src/shims/inspector.ts +30 -0
  401. package/src/shims/module.ts +86 -0
  402. package/src/shims/os.ts +195 -0
  403. package/src/shims/path.ts +246 -0
  404. package/src/shims/perf_hooks.ts +92 -0
  405. package/src/shims/process.ts +804 -0
  406. package/src/shims/rollup.ts +149 -0
  407. package/src/shims/string_decoder.ts +396 -0
  408. package/src/shims/sync-child.ts +469 -0
  409. package/src/shims/tls.ts +94 -0
  410. package/src/shims/url.ts +217 -0
  411. package/src/shims/v8.ts +113 -0
  412. package/src/shims/vfs-adapter.ts +408 -0
  413. package/src/shims/vm.ts +132 -0
  414. package/src/shims/wasi.ts +1440 -0
  415. package/src/shims/worker_threads.ts +114 -0
  416. package/src/shims/zlib-constants.ts +65 -0
  417. package/src/shims/zlib.ts +228 -0
  418. package/src/transform.ts +324 -0
  419. package/src/types/external.d.ts +55 -0
  420. package/src/types/package-json.ts +17 -0
  421. package/src/types/pako-zlib.d.ts +30 -0
  422. package/src/types/sha.js.d.ts +14 -0
  423. package/src/utils/binary-encoding.ts +43 -0
  424. package/src/utils/glob.ts +54 -0
  425. package/src/utils/hash.ts +12 -0
  426. package/src/virtual-fs.ts +1048 -0
  427. package/src/vite-plugin.ts +76 -0
  428. package/src/worker/runtime-worker.ts +128 -0
  429. package/src/worker-runtime.ts +145 -0
@@ -0,0 +1,177 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ ArrayPrototypePush,
5
+ Int32Array,
6
+ StringPrototypeEndsWith,
7
+ } = primordials;
8
+
9
+ const colors = require('internal/util/colors');
10
+
11
+ const kNopLinesToCollapse = 5;
12
+ const kOperations = {
13
+ DELETE: -1,
14
+ NOP: 0,
15
+ INSERT: 1,
16
+ };
17
+
18
+ function areLinesEqual(actual, expected, checkCommaDisparity) {
19
+ if (actual === expected) {
20
+ return true;
21
+ }
22
+ if (checkCommaDisparity) {
23
+ return (actual + ',') === expected || actual === (expected + ',');
24
+ }
25
+ return false;
26
+ }
27
+
28
+ function myersDiff(actual, expected, checkCommaDisparity = false) {
29
+ const actualLength = actual.length;
30
+ const expectedLength = expected.length;
31
+ const max = actualLength + expectedLength;
32
+ // TODO(BridgeAR): Cap the input in case the values go beyond the limit of 2^31 - 1.
33
+ const v = new Int32Array(2 * max + 1);
34
+ const trace = [];
35
+
36
+ for (let diffLevel = 0; diffLevel <= max; diffLevel++) {
37
+ ArrayPrototypePush(trace, new Int32Array(v)); // Clone the current state of `v`
38
+
39
+ for (let diagonalIndex = -diffLevel; diagonalIndex <= diffLevel; diagonalIndex += 2) {
40
+ const offset = diagonalIndex + max;
41
+ const previousOffset = v[offset - 1];
42
+ const nextOffset = v[offset + 1];
43
+ let x = diagonalIndex === -diffLevel || (diagonalIndex !== diffLevel && previousOffset < nextOffset) ?
44
+ nextOffset :
45
+ previousOffset + 1;
46
+ let y = x - diagonalIndex;
47
+
48
+ while (
49
+ x < actualLength &&
50
+ y < expectedLength &&
51
+ areLinesEqual(actual[x], expected[y], checkCommaDisparity)
52
+ ) {
53
+ x++;
54
+ y++;
55
+ }
56
+
57
+ v[offset] = x;
58
+
59
+ if (x >= actualLength && y >= expectedLength) {
60
+ return backtrack(trace, actual, expected, checkCommaDisparity);
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ function backtrack(trace, actual, expected, checkCommaDisparity) {
67
+ const actualLength = actual.length;
68
+ const expectedLength = expected.length;
69
+ const max = actualLength + expectedLength;
70
+
71
+ let x = actualLength;
72
+ let y = expectedLength;
73
+ const result = [];
74
+
75
+ for (let diffLevel = trace.length - 1; diffLevel >= 0; diffLevel--) {
76
+ const v = trace[diffLevel];
77
+ const diagonalIndex = x - y;
78
+ const offset = diagonalIndex + max;
79
+
80
+ let prevDiagonalIndex;
81
+ if (
82
+ diagonalIndex === -diffLevel ||
83
+ (diagonalIndex !== diffLevel && v[offset - 1] < v[offset + 1])
84
+ ) {
85
+ prevDiagonalIndex = diagonalIndex + 1;
86
+ } else {
87
+ prevDiagonalIndex = diagonalIndex - 1;
88
+ }
89
+
90
+ const prevX = v[prevDiagonalIndex + max];
91
+ const prevY = prevX - prevDiagonalIndex;
92
+
93
+ while (x > prevX && y > prevY) {
94
+ const actualItem = actual[x - 1];
95
+ const value = checkCommaDisparity && !StringPrototypeEndsWith(actualItem, ',') ? expected[y - 1] : actualItem;
96
+ ArrayPrototypePush(result, [ kOperations.NOP, value ]);
97
+ x--;
98
+ y--;
99
+ }
100
+
101
+ if (diffLevel > 0) {
102
+ if (x > prevX) {
103
+ ArrayPrototypePush(result, [ kOperations.INSERT, actual[--x] ]);
104
+ } else {
105
+ ArrayPrototypePush(result, [ kOperations.DELETE, expected[--y] ]);
106
+ }
107
+ }
108
+ }
109
+
110
+ return result;
111
+ }
112
+
113
+ function printSimpleMyersDiff(diff) {
114
+ let message = '';
115
+
116
+ for (let diffIdx = diff.length - 1; diffIdx >= 0; diffIdx--) {
117
+ const { 0: operation, 1: value } = diff[diffIdx];
118
+ let color = colors.white;
119
+
120
+ if (operation === kOperations.INSERT) {
121
+ color = colors.green;
122
+ } else if (operation === kOperations.DELETE) {
123
+ color = colors.red;
124
+ }
125
+
126
+ message += `${color}${value}${colors.white}`;
127
+ }
128
+
129
+ return `\n${message}`;
130
+ }
131
+
132
+ function printMyersDiff(diff, operator) {
133
+ let message = '';
134
+ let skipped = false;
135
+ let nopCount = 0;
136
+
137
+ for (let diffIdx = diff.length - 1; diffIdx >= 0; diffIdx--) {
138
+ const { 0: operation, 1: value } = diff[diffIdx];
139
+ const previousOperation = diffIdx < diff.length - 1 ? diff[diffIdx + 1][0] : null;
140
+
141
+ // Avoid grouping if only one line would have been grouped otherwise
142
+ if (previousOperation === kOperations.NOP && operation !== previousOperation) {
143
+ if (nopCount === kNopLinesToCollapse + 1) {
144
+ message += `${colors.white} ${diff[diffIdx + 1][1]}\n`;
145
+ } else if (nopCount === kNopLinesToCollapse + 2) {
146
+ message += `${colors.white} ${diff[diffIdx + 2][1]}\n`;
147
+ message += `${colors.white} ${diff[diffIdx + 1][1]}\n`;
148
+ } else if (nopCount >= kNopLinesToCollapse + 3) {
149
+ message += `${colors.blue}...${colors.white}\n`;
150
+ message += `${colors.white} ${diff[diffIdx + 1][1]}\n`;
151
+ skipped = true;
152
+ }
153
+ nopCount = 0;
154
+ }
155
+
156
+ if (operation === kOperations.INSERT) {
157
+ if (operator === 'partialDeepStrictEqual') {
158
+ message += `${colors.gray}${colors.hasColors ? ' ' : '+'} ${value}${colors.white}\n`;
159
+ } else {
160
+ message += `${colors.green}+${colors.white} ${value}\n`;
161
+ }
162
+ } else if (operation === kOperations.DELETE) {
163
+ message += `${colors.red}-${colors.white} ${value}\n`;
164
+ } else if (operation === kOperations.NOP) {
165
+ if (nopCount < kNopLinesToCollapse) {
166
+ message += `${colors.white} ${value}\n`;
167
+ }
168
+ nopCount++;
169
+ }
170
+ }
171
+
172
+ message = message.trimEnd();
173
+
174
+ return { message: `\n${message}`, skipped };
175
+ }
176
+
177
+ module.exports = { myersDiff, printMyersDiff, printSimpleMyersDiff };
@@ -0,0 +1,278 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ ArrayPrototypeShift,
5
+ Error,
6
+ ErrorCaptureStackTrace,
7
+ FunctionPrototypeBind,
8
+ RegExpPrototypeSymbolReplace,
9
+ SafeMap,
10
+ StringPrototypeCharCodeAt,
11
+ StringPrototypeIncludes,
12
+ StringPrototypeReplace,
13
+ StringPrototypeSlice,
14
+ StringPrototypeSplit,
15
+ StringPrototypeStartsWith,
16
+ } = primordials;
17
+
18
+ const { Buffer } = require('buffer');
19
+ const {
20
+ isErrorStackTraceLimitWritable,
21
+ overrideStackTrace,
22
+ } = require('internal/errors');
23
+ const AssertionError = require('internal/assert/assertion_error');
24
+ const { openSync, closeSync, readSync } = require('fs');
25
+ const { EOL } = require('internal/constants');
26
+ const { BuiltinModule } = require('internal/bootstrap/realm');
27
+ const { isError } = require('internal/util');
28
+
29
+ const errorCache = new SafeMap();
30
+ const { fileURLToPath } = require('internal/url');
31
+
32
+ let parseExpressionAt;
33
+ let findNodeAround;
34
+ let tokenizer;
35
+ let decoder;
36
+
37
+ // Escape control characters but not \n and \t to keep the line breaks and
38
+ // indentation intact.
39
+ // eslint-disable-next-line no-control-regex
40
+ const escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g;
41
+ const meta = [
42
+ '\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004',
43
+ '\\u0005', '\\u0006', '\\u0007', '\\b', '',
44
+ '', '\\u000b', '\\f', '', '\\u000e',
45
+ '\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
46
+ '\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018',
47
+ '\\u0019', '\\u001a', '\\u001b', '\\u001c', '\\u001d',
48
+ '\\u001e', '\\u001f',
49
+ ];
50
+
51
+ const escapeFn = (str) => meta[StringPrototypeCharCodeAt(str, 0)];
52
+
53
+ function findColumn(fd, column, code) {
54
+ if (code.length > column + 100) {
55
+ try {
56
+ return parseCode(code, column);
57
+ } catch {
58
+ // End recursion in case no code could be parsed. The expression should
59
+ // have been found after 2500 characters, so stop trying.
60
+ if (code.length - column > 2500) {
61
+ // eslint-disable-next-line no-throw-literal
62
+ throw null;
63
+ }
64
+ }
65
+ }
66
+ // Read up to 2500 bytes more than necessary in columns. That way we address
67
+ // multi byte characters and read enough data to parse the code.
68
+ const bytesToRead = column - code.length + 2500;
69
+ const buffer = Buffer.allocUnsafe(bytesToRead);
70
+ const bytesRead = readSync(fd, buffer, 0, bytesToRead);
71
+ code += decoder.write(buffer.slice(0, bytesRead));
72
+ // EOF: fast path.
73
+ if (bytesRead < bytesToRead) {
74
+ return parseCode(code, column);
75
+ }
76
+ // Read potentially missing code.
77
+ return findColumn(fd, column, code);
78
+ }
79
+
80
+ function getCode(fd, line, column) {
81
+ let bytesRead = 0;
82
+ if (line === 0) {
83
+ // Special handle line number one. This is more efficient and simplifies the
84
+ // rest of the algorithm. Read more than the regular column number in bytes
85
+ // to prevent multiple reads in case multi byte characters are used.
86
+ return findColumn(fd, column, '');
87
+ }
88
+ let lines = 0;
89
+ // Prevent blocking the event loop by limiting the maximum amount of
90
+ // data that may be read.
91
+ let maxReads = 32; // bytesPerRead * maxReads = 512 KiB
92
+ const bytesPerRead = 16384;
93
+ // Use a single buffer up front that is reused until the call site is found.
94
+ let buffer = Buffer.allocUnsafe(bytesPerRead);
95
+ while (maxReads-- !== 0) {
96
+ // Only allocate a new buffer in case the needed line is found. All data
97
+ // before that can be discarded.
98
+ buffer = lines < line ? buffer : Buffer.allocUnsafe(bytesPerRead);
99
+ bytesRead = readSync(fd, buffer, 0, bytesPerRead);
100
+ // Read the buffer until the required code line is found.
101
+ for (let i = 0; i < bytesRead; i++) {
102
+ if (buffer[i] === 10 && ++lines === line) {
103
+ // If the end of file is reached, directly parse the code and return.
104
+ if (bytesRead < bytesPerRead) {
105
+ return parseCode(buffer.toString('utf8', i + 1, bytesRead), column);
106
+ }
107
+ // Check if the read code is sufficient or read more until the whole
108
+ // expression is read. Make sure multi byte characters are preserved
109
+ // properly by using the decoder.
110
+ const code = decoder.write(buffer.slice(i + 1, bytesRead));
111
+ return findColumn(fd, column, code);
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ function parseCode(code, offset) {
118
+ // Lazy load acorn.
119
+ if (parseExpressionAt === undefined) {
120
+ const Parser = require('internal/deps/acorn/acorn/dist/acorn').Parser;
121
+ ({ findNodeAround } = require('internal/deps/acorn/acorn-walk/dist/walk'));
122
+
123
+ parseExpressionAt = FunctionPrototypeBind(Parser.parseExpressionAt, Parser);
124
+ tokenizer = FunctionPrototypeBind(Parser.tokenizer, Parser);
125
+ }
126
+ let node;
127
+ let start;
128
+ // Parse the read code until the correct expression is found.
129
+ for (const token of tokenizer(code, { ecmaVersion: 'latest' })) {
130
+ start = token.start;
131
+ if (start > offset) {
132
+ // No matching expression found. This could happen if the assert
133
+ // expression is bigger than the provided buffer.
134
+ break;
135
+ }
136
+ try {
137
+ node = parseExpressionAt(code, start, { ecmaVersion: 'latest' });
138
+ // Find the CallExpression in the tree.
139
+ node = findNodeAround(node, offset, 'CallExpression');
140
+ if (node?.node.end >= offset) {
141
+ return [
142
+ node.node.start,
143
+ StringPrototypeReplace(StringPrototypeSlice(code,
144
+ node.node.start, node.node.end),
145
+ escapeSequencesRegExp, escapeFn),
146
+ ];
147
+ }
148
+ // eslint-disable-next-line no-unused-vars
149
+ } catch (err) {
150
+ continue;
151
+ }
152
+ }
153
+ // eslint-disable-next-line no-throw-literal
154
+ throw null;
155
+ }
156
+
157
+ function getErrMessage(message, fn) {
158
+ const tmpLimit = Error.stackTraceLimit;
159
+ const errorStackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
160
+ // Make sure the limit is set to 1. Otherwise it could fail (<= 0) or it
161
+ // does to much work.
162
+ if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = 1;
163
+ // We only need the stack trace. To minimize the overhead use an object
164
+ // instead of an error.
165
+ const err = {};
166
+ ErrorCaptureStackTrace(err, fn);
167
+ if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit;
168
+
169
+ overrideStackTrace.set(err, (_, stack) => stack);
170
+ const call = err.stack[0];
171
+
172
+ let filename = call.getFileName();
173
+ const line = call.getLineNumber() - 1;
174
+ let column = call.getColumnNumber() - 1;
175
+ let identifier;
176
+
177
+ if (filename) {
178
+ identifier = `${filename}${line}${column}`;
179
+
180
+ // Skip Node.js modules!
181
+ if (StringPrototypeStartsWith(filename, 'node:') &&
182
+ BuiltinModule.exists(StringPrototypeSlice(filename, 5))) {
183
+ errorCache.set(identifier, undefined);
184
+ return;
185
+ }
186
+ } else {
187
+ return message;
188
+ }
189
+
190
+ if (errorCache.has(identifier)) {
191
+ return errorCache.get(identifier);
192
+ }
193
+
194
+ let fd;
195
+ try {
196
+ // Set the stack trace limit to zero. This makes sure unexpected token
197
+ // errors are handled faster.
198
+ if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = 0;
199
+
200
+ if (decoder === undefined) {
201
+ const { StringDecoder } = require('string_decoder');
202
+ decoder = new StringDecoder('utf8');
203
+ }
204
+
205
+ // ESM file prop is a file proto. Convert that to path.
206
+ // This ensure opensync will not throw ENOENT for ESM files.
207
+ const fileProtoPrefix = 'file://';
208
+ if (StringPrototypeStartsWith(filename, fileProtoPrefix)) {
209
+ filename = fileURLToPath(filename);
210
+ }
211
+
212
+ fd = openSync(filename, 'r', 0o666);
213
+ // Reset column and message.
214
+ ({ 0: column, 1: message } = getCode(fd, line, column));
215
+ // Flush unfinished multi byte characters.
216
+ decoder.end();
217
+
218
+ // Always normalize indentation, otherwise the message could look weird.
219
+ if (StringPrototypeIncludes(message, '\n')) {
220
+ if (EOL === '\r\n') {
221
+ message = RegExpPrototypeSymbolReplace(/\r\n/g, message, '\n');
222
+ }
223
+ const frames = StringPrototypeSplit(message, '\n');
224
+ message = ArrayPrototypeShift(frames);
225
+ for (const frame of frames) {
226
+ let pos = 0;
227
+ while (pos < column && (frame[pos] === ' ' || frame[pos] === '\t')) {
228
+ pos++;
229
+ }
230
+ message += `\n ${StringPrototypeSlice(frame, pos)}`;
231
+ }
232
+ }
233
+ message = `The expression evaluated to a falsy value:\n\n ${message}\n`;
234
+ // Make sure to always set the cache! No matter if the message is
235
+ // undefined or not
236
+ errorCache.set(identifier, message);
237
+
238
+ return message;
239
+ } catch {
240
+ // Invalidate cache to prevent trying to read this part again.
241
+ errorCache.set(identifier, undefined);
242
+ } finally {
243
+ // Reset limit.
244
+ if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit;
245
+ if (fd !== undefined)
246
+ closeSync(fd);
247
+ }
248
+ }
249
+
250
+ function innerOk(fn, argLen, value, message) {
251
+ if (!value) {
252
+ let generatedMessage = false;
253
+
254
+ if (argLen === 0) {
255
+ generatedMessage = true;
256
+ message = 'No value argument passed to `assert.ok()`';
257
+ } else if (message == null) {
258
+ generatedMessage = true;
259
+ message = getErrMessage(message, fn);
260
+ } else if (isError(message)) {
261
+ throw message;
262
+ }
263
+
264
+ const err = new AssertionError({
265
+ actual: value,
266
+ expected: true,
267
+ message,
268
+ operator: '==',
269
+ stackStartFn: fn,
270
+ });
271
+ err.generatedMessage = generatedMessage;
272
+ throw err;
273
+ }
274
+ }
275
+
276
+ module.exports = {
277
+ innerOk,
278
+ };