@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,571 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ Array,
5
+ FunctionPrototypeBind,
6
+ MathMin,
7
+ ObjectDefineProperty,
8
+ ObjectSetPrototypeOf,
9
+ PromisePrototypeThen,
10
+ ReflectApply,
11
+ Symbol,
12
+ } = primordials;
13
+
14
+ const {
15
+ ERR_INVALID_ARG_TYPE,
16
+ ERR_METHOD_NOT_IMPLEMENTED,
17
+ ERR_OUT_OF_RANGE,
18
+ ERR_STREAM_DESTROYED,
19
+ ERR_SYSTEM_ERROR,
20
+ } = require('internal/errors').codes;
21
+ const {
22
+ deprecate,
23
+ kEmptyObject,
24
+ } = require('internal/util');
25
+ const {
26
+ validateBoolean,
27
+ validateFunction,
28
+ validateInteger,
29
+ validateThisInternalField,
30
+ } = require('internal/validators');
31
+ const { errorOrDestroy } = require('internal/streams/destroy');
32
+ const fs = require('fs');
33
+ const { kRef, kUnref, FileHandle } = require('internal/fs/promises');
34
+ const { Buffer } = require('buffer');
35
+ const {
36
+ copyObject,
37
+ getOptions,
38
+ getValidatedFd,
39
+ validatePath,
40
+ } = require('internal/fs/utils');
41
+ const { Readable, Writable, finished } = require('stream');
42
+ const { toPathIfFileURL } = require('internal/url');
43
+ const kIoDone = Symbol('kIoDone');
44
+ const kIsPerformingIO = Symbol('kIsPerformingIO');
45
+
46
+ const kFs = Symbol('kFs');
47
+ const kHandle = Symbol('kHandle');
48
+
49
+ function _construct(callback) {
50
+ const stream = this;
51
+ if (typeof stream.fd === 'number') {
52
+ callback();
53
+ return;
54
+ }
55
+
56
+ if (stream.open !== openWriteFs && stream.open !== openReadFs) {
57
+ // Backwards compat for monkey patching open().
58
+ const orgEmit = stream.emit;
59
+ stream.emit = function(...args) {
60
+ if (args[0] === 'open') {
61
+ this.emit = orgEmit;
62
+ callback();
63
+ ReflectApply(orgEmit, this, args);
64
+ } else if (args[0] === 'error') {
65
+ this.emit = orgEmit;
66
+ callback(args[1]);
67
+ } else {
68
+ ReflectApply(orgEmit, this, args);
69
+ }
70
+ };
71
+ stream.open();
72
+ } else {
73
+ stream[kFs].open(stream.path, stream.flags, stream.mode, (er, fd) => {
74
+ if (er) {
75
+ callback(er);
76
+ } else {
77
+ stream.fd = fd;
78
+ callback();
79
+ stream.emit('open', stream.fd);
80
+ stream.emit('ready');
81
+ }
82
+ });
83
+ }
84
+ }
85
+
86
+ // This generates an fs operations structure for a FileHandle
87
+ const FileHandleOperations = (handle) => {
88
+ return {
89
+ open: (path, flags, mode, cb) => {
90
+ throw new ERR_METHOD_NOT_IMPLEMENTED('open()');
91
+ },
92
+ close: (fd, cb) => {
93
+ handle[kUnref]();
94
+ PromisePrototypeThen(handle.close(),
95
+ () => cb(), cb);
96
+ },
97
+ fsync: (fd, cb) => {
98
+ PromisePrototypeThen(handle.sync(), () => cb(), cb);
99
+ },
100
+ read: (fd, buf, offset, length, pos, cb) => {
101
+ PromisePrototypeThen(handle.read(buf, offset, length, pos),
102
+ (r) => cb(null, r.bytesRead, r.buffer),
103
+ (err) => cb(err, 0, buf));
104
+ },
105
+ write: (fd, buf, offset, length, pos, cb) => {
106
+ PromisePrototypeThen(handle.write(buf, offset, length, pos),
107
+ (r) => cb(null, r.bytesWritten, r.buffer),
108
+ (err) => cb(err, 0, buf));
109
+ },
110
+ writev: (fd, buffers, pos, cb) => {
111
+ PromisePrototypeThen(handle.writev(buffers, pos),
112
+ (r) => cb(null, r.bytesWritten, r.buffers),
113
+ (err) => cb(err, 0, buffers));
114
+ },
115
+ };
116
+ };
117
+
118
+ function close(stream, err, cb) {
119
+ if (!stream.fd) {
120
+ cb(err);
121
+ } else if (stream.flush) {
122
+ stream[kFs].fsync(stream.fd, (flushErr) => {
123
+ _close(stream, err || flushErr, cb);
124
+ });
125
+ } else {
126
+ _close(stream, err, cb);
127
+ }
128
+ }
129
+
130
+ function _close(stream, err, cb) {
131
+ stream[kFs].close(stream.fd, (er) => {
132
+ cb(er || err);
133
+ });
134
+ stream.fd = null;
135
+ }
136
+
137
+ function importFd(stream, options) {
138
+ if (typeof options.fd === 'number') {
139
+ // When fd is a raw descriptor, we must keep our fingers crossed
140
+ // that the descriptor won't get closed, or worse, replaced with
141
+ // another one
142
+ // https://github.com/nodejs/node/issues/35862
143
+ stream[kFs] = options.fs || fs;
144
+ return options.fd;
145
+ } else if (typeof options.fd === 'object' &&
146
+ options.fd instanceof FileHandle) {
147
+ // When fd is a FileHandle we can listen for 'close' events
148
+ if (options.fs) {
149
+ // FileHandle is not supported with custom fs operations
150
+ throw new ERR_METHOD_NOT_IMPLEMENTED('FileHandle with fs');
151
+ }
152
+ stream[kHandle] = options.fd;
153
+ stream[kFs] = FileHandleOperations(stream[kHandle]);
154
+ stream[kHandle][kRef]();
155
+ options.fd.on('close', FunctionPrototypeBind(stream.close, stream));
156
+ return options.fd.fd;
157
+ }
158
+
159
+ throw new ERR_INVALID_ARG_TYPE('options.fd',
160
+ ['number', 'FileHandle'], options.fd);
161
+ }
162
+
163
+ function ReadStream(path, options) {
164
+ if (!(this instanceof ReadStream))
165
+ return new ReadStream(path, options);
166
+
167
+ // A little bit bigger buffer and water marks by default
168
+ options = copyObject(getOptions(options, kEmptyObject));
169
+ if (options.highWaterMark === undefined)
170
+ options.highWaterMark = 64 * 1024;
171
+
172
+ if (options.autoDestroy === undefined) {
173
+ options.autoDestroy = false;
174
+ }
175
+
176
+ if (options.fd == null) {
177
+ this.fd = null;
178
+ this[kFs] = options.fs || fs;
179
+ validateFunction(this[kFs].open, 'options.fs.open');
180
+
181
+ // Path will be ignored when fd is specified, so it can be falsy
182
+ this.path = toPathIfFileURL(path);
183
+ this.flags = options.flags === undefined ? 'r' : options.flags;
184
+ this.mode = options.mode === undefined ? 0o666 : options.mode;
185
+
186
+ validatePath(this.path);
187
+ } else {
188
+ this.fd = getValidatedFd(importFd(this, options));
189
+ }
190
+
191
+ options.autoDestroy = options.autoClose === undefined ?
192
+ true : options.autoClose;
193
+
194
+ validateFunction(this[kFs].read, 'options.fs.read');
195
+
196
+ if (options.autoDestroy) {
197
+ validateFunction(this[kFs].close, 'options.fs.close');
198
+ }
199
+
200
+ this.start = options.start;
201
+ this.end = options.end;
202
+ this.pos = undefined;
203
+ this.bytesRead = 0;
204
+ this[kIsPerformingIO] = false;
205
+
206
+ if (this.start !== undefined) {
207
+ validateInteger(this.start, 'start', 0);
208
+
209
+ this.pos = this.start;
210
+ }
211
+
212
+
213
+ if (this.end === undefined) {
214
+ this.end = Infinity;
215
+ } else if (this.end !== Infinity) {
216
+ validateInteger(this.end, 'end', 0);
217
+
218
+ if (this.start !== undefined && this.start > this.end) {
219
+ throw new ERR_OUT_OF_RANGE(
220
+ 'start',
221
+ `<= "end" (here: ${this.end})`,
222
+ this.start,
223
+ );
224
+ }
225
+ }
226
+
227
+ ReflectApply(Readable, this, [options]);
228
+ }
229
+ ObjectSetPrototypeOf(ReadStream.prototype, Readable.prototype);
230
+ ObjectSetPrototypeOf(ReadStream, Readable);
231
+
232
+ ObjectDefineProperty(ReadStream.prototype, 'autoClose', {
233
+ __proto__: null,
234
+ get() {
235
+ validateThisInternalField(this, kFs, 'ReadStream');
236
+ return this._readableState.autoDestroy;
237
+ },
238
+ set(val) {
239
+ validateThisInternalField(this, kFs, 'ReadStream');
240
+ this._readableState.autoDestroy = val;
241
+ },
242
+ });
243
+
244
+ const openReadFs = deprecate(function() {
245
+ // Noop.
246
+ }, 'ReadStream.prototype.open() is deprecated', 'DEP0135');
247
+ ReadStream.prototype.open = openReadFs;
248
+
249
+ ReadStream.prototype._construct = _construct;
250
+
251
+ ReadStream.prototype._read = function(n) {
252
+ n = this.pos !== undefined ?
253
+ MathMin(this.end - this.pos + 1, n) :
254
+ MathMin(this.end - this.bytesRead + 1, n);
255
+
256
+ if (n <= 0) {
257
+ this.push(null);
258
+ return;
259
+ }
260
+
261
+ const buf = Buffer.allocUnsafeSlow(n);
262
+
263
+ this[kIsPerformingIO] = true;
264
+ this[kFs]
265
+ .read(this.fd, buf, 0, n, this.pos, (er, bytesRead, buf) => {
266
+ this[kIsPerformingIO] = false;
267
+
268
+ // Tell ._destroy() that it's safe to close the fd now.
269
+ if (this.destroyed) {
270
+ this.emit(kIoDone, er);
271
+ return;
272
+ }
273
+
274
+ if (er) {
275
+ errorOrDestroy(this, er);
276
+ } else if (bytesRead > 0) {
277
+ if (this.pos !== undefined) {
278
+ this.pos += bytesRead;
279
+ }
280
+
281
+ this.bytesRead += bytesRead;
282
+
283
+ if (bytesRead !== buf.length) {
284
+ // Slow path. Shrink to fit.
285
+ // Copy instead of slice so that we don't retain
286
+ // large backing buffer for small reads.
287
+ const dst = Buffer.allocUnsafeSlow(bytesRead);
288
+ buf.copy(dst, 0, 0, bytesRead);
289
+ buf = dst;
290
+ }
291
+
292
+ this.push(buf);
293
+ } else {
294
+ this.push(null);
295
+ }
296
+ });
297
+ };
298
+
299
+ ReadStream.prototype._destroy = function(err, cb) {
300
+ // Usually for async IO it is safe to close a file descriptor
301
+ // even when there are pending operations. However, due to platform
302
+ // differences file IO is implemented using synchronous operations
303
+ // running in a thread pool. Therefore, file descriptors are not safe
304
+ // to close while used in a pending read or write operation. Wait for
305
+ // any pending IO (kIsPerformingIO) to complete (kIoDone).
306
+ if (this[kIsPerformingIO]) {
307
+ this.once(kIoDone, (er) => close(this, err || er, cb));
308
+ } else {
309
+ close(this, err, cb);
310
+ }
311
+ };
312
+
313
+ ReadStream.prototype.close = function(cb) {
314
+ if (typeof cb === 'function') finished(this, cb);
315
+ this.destroy();
316
+ };
317
+
318
+ ObjectDefineProperty(ReadStream.prototype, 'pending', {
319
+ __proto__: null,
320
+ get() { return this.fd === null; },
321
+ configurable: true,
322
+ });
323
+
324
+ function WriteStream(path, options) {
325
+ if (!(this instanceof WriteStream))
326
+ return new WriteStream(path, options);
327
+
328
+ options = copyObject(getOptions(options, kEmptyObject));
329
+
330
+ // Only buffers are supported.
331
+ options.decodeStrings = true;
332
+
333
+ if (options.fd == null) {
334
+ this.fd = null;
335
+ this[kFs] = options.fs || fs;
336
+ validateFunction(this[kFs].open, 'options.fs.open');
337
+
338
+ // Path will be ignored when fd is specified, so it can be falsy
339
+ this.path = toPathIfFileURL(path);
340
+ this.flags = options.flags === undefined ? 'w' : options.flags;
341
+ this.mode = options.mode === undefined ? 0o666 : options.mode;
342
+
343
+ validatePath(this.path);
344
+ } else {
345
+ this.fd = getValidatedFd(importFd(this, options));
346
+ }
347
+
348
+ options.autoDestroy = options.autoClose === undefined ?
349
+ true : options.autoClose;
350
+
351
+ if (!this[kFs].write && !this[kFs].writev) {
352
+ throw new ERR_INVALID_ARG_TYPE('options.fs.write', 'function',
353
+ this[kFs].write);
354
+ }
355
+
356
+ if (this[kFs].write) {
357
+ validateFunction(this[kFs].write, 'options.fs.write');
358
+ }
359
+
360
+ if (this[kFs].writev) {
361
+ validateFunction(this[kFs].writev, 'options.fs.writev');
362
+ }
363
+
364
+ if (options.autoDestroy) {
365
+ validateFunction(this[kFs].close, 'options.fs.close');
366
+ }
367
+
368
+ this.flush = options.flush;
369
+ if (this.flush == null) {
370
+ this.flush = false;
371
+ } else {
372
+ validateBoolean(this.flush, 'options.flush');
373
+ validateFunction(this[kFs].fsync, 'options.fs.fsync');
374
+ }
375
+
376
+ // It's enough to override either, in which case only one will be used.
377
+ if (!this[kFs].write) {
378
+ this._write = null;
379
+ }
380
+ if (!this[kFs].writev) {
381
+ this._writev = null;
382
+ }
383
+
384
+ this.start = options.start;
385
+ this.pos = undefined;
386
+ this.bytesWritten = 0;
387
+ this[kIsPerformingIO] = false;
388
+
389
+ if (this.start !== undefined) {
390
+ validateInteger(this.start, 'start', 0);
391
+
392
+ this.pos = this.start;
393
+ }
394
+
395
+ ReflectApply(Writable, this, [options]);
396
+
397
+ if (options.encoding)
398
+ this.setDefaultEncoding(options.encoding);
399
+ }
400
+ ObjectSetPrototypeOf(WriteStream.prototype, Writable.prototype);
401
+ ObjectSetPrototypeOf(WriteStream, Writable);
402
+
403
+ ObjectDefineProperty(WriteStream.prototype, 'autoClose', {
404
+ __proto__: null,
405
+ get() {
406
+ validateThisInternalField(this, kFs, 'WriteStream');
407
+ return this._writableState.autoDestroy;
408
+ },
409
+ set(val) {
410
+ validateThisInternalField(this, kFs, 'WriteStream');
411
+ this._writableState.autoDestroy = val;
412
+ },
413
+ });
414
+
415
+ const openWriteFs = deprecate(function() {
416
+ // Noop.
417
+ }, 'WriteStream.prototype.open() is deprecated', 'DEP0135');
418
+ WriteStream.prototype.open = openWriteFs;
419
+
420
+ WriteStream.prototype._construct = _construct;
421
+
422
+ function writeAll(data, size, pos, cb, retries = 0) {
423
+ this[kFs].write(this.fd, data, 0, size, pos, (er, bytesWritten, buffer) => {
424
+ // No data currently available and operation should be retried later.
425
+ if (er?.code === 'EAGAIN') {
426
+ er = null;
427
+ bytesWritten = 0;
428
+ }
429
+
430
+ if (this.destroyed || er) {
431
+ return cb(er || new ERR_STREAM_DESTROYED('write'));
432
+ }
433
+
434
+ this.bytesWritten += bytesWritten;
435
+
436
+ retries = bytesWritten ? 0 : retries + 1;
437
+ size -= bytesWritten;
438
+ pos += bytesWritten;
439
+
440
+ // Try writing non-zero number of bytes up to 5 times.
441
+ if (retries > 5) {
442
+ cb(new ERR_SYSTEM_ERROR('write failed'));
443
+ } else if (size) {
444
+ writeAll.call(this, buffer.slice(bytesWritten), size, pos, cb, retries);
445
+ } else {
446
+ cb();
447
+ }
448
+ });
449
+ }
450
+
451
+ function writevAll(chunks, size, pos, cb, retries = 0) {
452
+ this[kFs].writev(this.fd, chunks, this.pos, (er, bytesWritten, buffers) => {
453
+ // No data currently available and operation should be retried later.
454
+ if (er?.code === 'EAGAIN') {
455
+ er = null;
456
+ bytesWritten = 0;
457
+ }
458
+
459
+ if (this.destroyed || er) {
460
+ return cb(er || new ERR_STREAM_DESTROYED('writev'));
461
+ }
462
+
463
+ this.bytesWritten += bytesWritten;
464
+
465
+ retries = bytesWritten ? 0 : retries + 1;
466
+ size -= bytesWritten;
467
+ pos += bytesWritten;
468
+
469
+ // Try writing non-zero number of bytes up to 5 times.
470
+ if (retries > 5) {
471
+ cb(new ERR_SYSTEM_ERROR('writev failed'));
472
+ } else if (size) {
473
+ writevAll.call(this, [Buffer.concat(buffers).slice(bytesWritten)], size, pos, cb, retries);
474
+ } else {
475
+ cb();
476
+ }
477
+ });
478
+ }
479
+
480
+ WriteStream.prototype._write = function(data, encoding, cb) {
481
+ this[kIsPerformingIO] = true;
482
+ writeAll.call(this, data, data.length, this.pos, (er) => {
483
+ this[kIsPerformingIO] = false;
484
+ if (this.destroyed) {
485
+ // Tell ._destroy() that it's safe to close the fd now.
486
+ cb(er);
487
+ return this.emit(kIoDone, er);
488
+ }
489
+
490
+ cb(er);
491
+ });
492
+
493
+ if (this.pos !== undefined)
494
+ this.pos += data.length;
495
+ };
496
+
497
+ WriteStream.prototype._writev = function(data, cb) {
498
+ const len = data.length;
499
+ const chunks = new Array(len);
500
+ let size = 0;
501
+
502
+ for (let i = 0; i < len; i++) {
503
+ const chunk = data[i].chunk;
504
+
505
+ chunks[i] = chunk;
506
+ size += chunk.length;
507
+ }
508
+
509
+ this[kIsPerformingIO] = true;
510
+ writevAll.call(this, chunks, size, this.pos, (er) => {
511
+ this[kIsPerformingIO] = false;
512
+ if (this.destroyed) {
513
+ // Tell ._destroy() that it's safe to close the fd now.
514
+ cb(er);
515
+ return this.emit(kIoDone, er);
516
+ }
517
+
518
+ cb(er);
519
+ });
520
+
521
+ if (this.pos !== undefined)
522
+ this.pos += size;
523
+ };
524
+
525
+ WriteStream.prototype._destroy = function(err, cb) {
526
+ // Usually for async IO it is safe to close a file descriptor
527
+ // even when there are pending operations. However, due to platform
528
+ // differences file IO is implemented using synchronous operations
529
+ // running in a thread pool. Therefore, file descriptors are not safe
530
+ // to close while used in a pending read or write operation. Wait for
531
+ // any pending IO (kIsPerformingIO) to complete (kIoDone).
532
+ if (this[kIsPerformingIO]) {
533
+ this.once(kIoDone, (er) => close(this, err || er, cb));
534
+ } else {
535
+ close(this, err, cb);
536
+ }
537
+ };
538
+
539
+ WriteStream.prototype.close = function(cb) {
540
+ if (cb) {
541
+ if (this.closed) {
542
+ process.nextTick(cb);
543
+ return;
544
+ }
545
+ this.on('close', cb);
546
+ }
547
+
548
+ // If we are not autoClosing, we should call
549
+ // destroy on 'finish'.
550
+ if (!this.autoClose) {
551
+ this.on('finish', this.destroy);
552
+ }
553
+
554
+ // We use end() instead of destroy() because of
555
+ // https://github.com/nodejs/node/issues/2006
556
+ this.end();
557
+ };
558
+
559
+ // There is no shutdown() for files.
560
+ WriteStream.prototype.destroySoon = WriteStream.prototype.end;
561
+
562
+ ObjectDefineProperty(WriteStream.prototype, 'pending', {
563
+ __proto__: null,
564
+ get() { return this.fd === null; },
565
+ configurable: true,
566
+ });
567
+
568
+ module.exports = {
569
+ ReadStream,
570
+ WriteStream,
571
+ };
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ ObjectSetPrototypeOf,
5
+ ReflectApply,
6
+ } = primordials;
7
+ const { kEmptyObject } = require('internal/util');
8
+
9
+ const { Writable } = require('stream');
10
+ const { closeSync, writeSync } = require('fs');
11
+
12
+ function SyncWriteStream(fd, options) {
13
+ ReflectApply(Writable, this, [{ autoDestroy: true }]);
14
+
15
+ options ||= kEmptyObject;
16
+
17
+ this.fd = fd;
18
+ this.readable = false;
19
+ this.autoClose = options.autoClose === undefined ? true : options.autoClose;
20
+ }
21
+
22
+ ObjectSetPrototypeOf(SyncWriteStream.prototype, Writable.prototype);
23
+ ObjectSetPrototypeOf(SyncWriteStream, Writable);
24
+
25
+ SyncWriteStream.prototype._write = function(chunk, encoding, cb) {
26
+ try {
27
+ writeSync(this.fd, chunk, 0, chunk.length);
28
+ } catch (e) {
29
+ cb(e);
30
+ return;
31
+ }
32
+ cb();
33
+ };
34
+
35
+ SyncWriteStream.prototype._destroy = function(err, cb) {
36
+ if (this.fd === null) // already destroy()ed
37
+ return cb(err);
38
+
39
+ if (this.autoClose)
40
+ closeSync(this.fd);
41
+
42
+ this.fd = null;
43
+ cb(err);
44
+ };
45
+
46
+ SyncWriteStream.prototype.destroySoon =
47
+ SyncWriteStream.prototype.destroy;
48
+
49
+ module.exports = SyncWriteStream;