@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,109 @@
1
+ /**
2
+ * The public modules a vendored Node file names.
3
+ *
4
+ * Node's own files `require('dns')`, `require('timers')` and the rest as any
5
+ * program does, and get the runtime's modules. Here they get the engine's
6
+ * shims — the same objects the engine's module table hands a guest — so a
7
+ * `net.Socket` is a `stream.Duplex` of the same `stream` the guest imports,
8
+ * and an `instanceof` across the two holds. A name that is itself a vendored
9
+ * file — `events`, `util`, `buffer`, `stream` — is never asked of this table:
10
+ * the loader finds the file first.
11
+ *
12
+ * Each entry is a thunk: the shim is read when a vendored file asks, not when
13
+ * this module is loaded, so a cycle between a shim and the loader settles
14
+ * before either is used.
15
+ */
16
+ import * as dnsShim from '../shims/dns';
17
+ import * as clusterShim from '../shims/cluster';
18
+ import * as dgramShim from '../shims/dgram';
19
+ import asyncHooksShim from '../shims/async_hooks';
20
+ import stringDecoderShim from '../shims/string_decoder';
21
+ import v8Shim from '../shims/v8';
22
+ import * as pathShim from '../shims/path';
23
+ import * as tlsShim from '../shims/tls';
24
+ import * as cryptoShim from '../shims/crypto';
25
+ import * as vmShim from '../shims/vm';
26
+ import * as workerThreadsShim from '../shims/worker_threads';
27
+ import * as http2Shim from '../shims/http2';
28
+ import * as inspectorShim from '../shims/inspector';
29
+ import * as perfHooksShim from '../shims/perf_hooks';
30
+ import { nodeLibInternalRequire } from './load';
31
+ import { nodeTimeout, timerHandleOf } from './timers';
32
+ import { AsyncResource } from './internals/runtime';
33
+
34
+ /**
35
+ * `timers`: the realm's own, called on the realm and answering Node's shape.
36
+ *
37
+ * This is the module Node's own files take their timers from --
38
+ * `_http_server.js` opens with `const { setInterval, clearInterval } =
39
+ * require('timers')` and then writes `setInterval(...).unref()` the moment a
40
+ * server listens -- so what it answers has to be Node's `Timeout`
41
+ * ({@link nodeTimeout}), not a browser's number. It handed back the realm's
42
+ * raw function, and in the tab every guest that called `listen` died with
43
+ * `setInterval(...).unref is not a function`, openvscode-server among them.
44
+ * The function is also called on the realm here: a worker's `setInterval`
45
+ * invoked with this module as its receiver throws `Illegal invocation`, which
46
+ * is what a guest's own `require('timers').setInterval` did.
47
+ *
48
+ * A guest's global timers are the same shape, built per run in
49
+ * `src/runtime.ts` where they are counted against that run's loop; a timer
50
+ * made through either is cleared through either, which is why the shape has
51
+ * one home.
52
+ */
53
+ const timersModule = {
54
+ setTimeout(fn: (...a: unknown[]) => void, ms?: number, ...rest: unknown[]) {
55
+ return nodeTimeout(globalThis.setTimeout(fn as () => void, ms, ...rest));
56
+ },
57
+ clearTimeout(id: unknown) { return globalThis.clearTimeout(timerHandleOf(id) as number); },
58
+ setInterval(fn: (...a: unknown[]) => void, ms?: number, ...rest: unknown[]) {
59
+ return nodeTimeout(globalThis.setInterval(fn as () => void, ms, ...rest));
60
+ },
61
+ clearInterval(id: unknown) { return globalThis.clearInterval(timerHandleOf(id) as number); },
62
+ setImmediate(fn: (...a: unknown[]) => void, ...args: unknown[]) {
63
+ const realm = globalThis as unknown as { setImmediate?: (fn: (...a: unknown[]) => void, ...args: unknown[]) => unknown };
64
+ return nodeTimeout(realm.setImmediate
65
+ ? realm.setImmediate(fn, ...args)
66
+ : globalThis.setTimeout(fn as () => void, 0, ...args));
67
+ },
68
+ clearImmediate(id: unknown) {
69
+ const realm = globalThis as unknown as { clearImmediate?: (id: unknown) => void };
70
+ const handle = timerHandleOf(id);
71
+ return realm.clearImmediate ? realm.clearImmediate(handle) : globalThis.clearTimeout(handle as number);
72
+ },
73
+ };
74
+
75
+ /** Built on the first ask, for the reason `./binding/index.ts` gives. */
76
+ // eslint-disable-next-line no-var, vars-on-top
77
+ var __table: Record<string, () => unknown> | undefined;
78
+ export function nodeLibPublic(name: string): (() => unknown) | undefined {
79
+ __table ??= {
80
+ timers: () => timersModule,
81
+ dns: () => dnsShim,
82
+ cluster: () => clusterShim,
83
+ string_decoder: () => stringDecoderShim,
84
+ v8: () => v8Shim,
85
+ dgram: () => dgramShim,
86
+ // Node's `events.js` builds `EventEmitterAsyncResource` by extending this
87
+ // binding's `AsyncResource`. The shim's class answers `asyncId` 0, which
88
+ // is not an id a resource has.
89
+ async_hooks: () => ({ ...asyncHooksShim, AsyncResource }),
90
+ tls: () => tlsShim,
91
+ crypto: () => cryptoShim,
92
+ vm: () => vmShim,
93
+ worker_threads: () => workerThreadsShim,
94
+ http2: () => http2Shim,
95
+ inspector: () => inspectorShim,
96
+ perf_hooks: () => perfHooksShim,
97
+ // `internal/fs/cp/cp.js` requires the public alias; it is the same object
98
+ // as `internal/util/types`, which is `util.types`.
99
+ 'util/types': () => nodeLibInternalRequire('internal/util/types'),
100
+ // The same object a guest's `require("path")` answers with: Node's own
101
+ // `path.posix`, out of the vendored `path.js` the engine's shim evaluates.
102
+ path: () => pathShim.posix,
103
+ // `internal/fs/promises.js` exports `{ exports, FileHandle }`; the public
104
+ // `fs/promises` module is the inner `exports` object, as `fs.js` reads it.
105
+ 'fs/promises': () => (nodeLibInternalRequire('internal/fs/promises') as { exports: unknown }).exports,
106
+ };
107
+
108
+ return __table[name];
109
+ }
@@ -0,0 +1,455 @@
1
+ 'use strict';
2
+ const {
3
+ isInsideNodeModules,
4
+ } = internalBinding('util');
5
+
6
+ if (!isInsideNodeModules(100, true)) {
7
+ process.emitWarning(
8
+ 'The `punycode` module is deprecated. Please use a userland ' +
9
+ 'alternative instead.',
10
+ 'DeprecationWarning',
11
+ 'DEP0040',
12
+ );
13
+ }
14
+
15
+ /** Highest positive signed 32-bit float value */
16
+ const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
17
+
18
+ /** Bootstring parameters */
19
+ const base = 36;
20
+ const tMin = 1;
21
+ const tMax = 26;
22
+ const skew = 38;
23
+ const damp = 700;
24
+ const initialBias = 72;
25
+ const initialN = 128; // 0x80
26
+ const delimiter = '-'; // '\x2D'
27
+
28
+ /** Regular expressions */
29
+ const regexPunycode = /^xn--/;
30
+ const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
31
+ const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
32
+
33
+ /** Error messages */
34
+ const errors = {
35
+ 'overflow': 'Overflow: input needs wider integers to process',
36
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
37
+ 'invalid-input': 'Invalid input'
38
+ };
39
+
40
+ /** Convenience shortcuts */
41
+ const baseMinusTMin = base - tMin;
42
+ const floor = Math.floor;
43
+ const stringFromCharCode = String.fromCharCode;
44
+
45
+ /*--------------------------------------------------------------------------*/
46
+
47
+ /**
48
+ * A generic error utility function.
49
+ * @private
50
+ * @param {String} type The error type.
51
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
52
+ */
53
+ function error(type) {
54
+ throw new RangeError(errors[type]);
55
+ }
56
+
57
+ /**
58
+ * A generic `Array#map` utility function.
59
+ * @private
60
+ * @param {Array} array The array to iterate over.
61
+ * @param {Function} callback The function that gets called for every array
62
+ * item.
63
+ * @returns {Array} A new array of values returned by the callback function.
64
+ */
65
+ function map(array, callback) {
66
+ const result = [];
67
+ let length = array.length;
68
+ while (length--) {
69
+ result[length] = callback(array[length]);
70
+ }
71
+ return result;
72
+ }
73
+
74
+ /**
75
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
76
+ * addresses.
77
+ * @private
78
+ * @param {String} domain The domain name or email address.
79
+ * @param {Function} callback The function that gets called for every
80
+ * character.
81
+ * @returns {String} A new string of characters returned by the callback
82
+ * function.
83
+ */
84
+ function mapDomain(domain, callback) {
85
+ const parts = domain.split('@');
86
+ let result = '';
87
+ if (parts.length > 1) {
88
+ // In email addresses, only the domain name should be punycoded. Leave
89
+ // the local part (i.e. everything up to `@`) intact.
90
+ result = parts[0] + '@';
91
+ domain = parts[1];
92
+ }
93
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
94
+ domain = domain.replace(regexSeparators, '\x2E');
95
+ const labels = domain.split('.');
96
+ const encoded = map(labels, callback).join('.');
97
+ return result + encoded;
98
+ }
99
+
100
+ /**
101
+ * Creates an array containing the numeric code points of each Unicode
102
+ * character in the string. While JavaScript uses UCS-2 internally,
103
+ * this function will convert a pair of surrogate halves (each of which
104
+ * UCS-2 exposes as separate characters) into a single code point,
105
+ * matching UTF-16.
106
+ * @see `punycode.ucs2.encode`
107
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
108
+ * @memberOf punycode.ucs2
109
+ * @name decode
110
+ * @param {String} string The Unicode input string (UCS-2).
111
+ * @returns {Array} The new array of code points.
112
+ */
113
+ function ucs2decode(string) {
114
+ const output = [];
115
+ let counter = 0;
116
+ const length = string.length;
117
+ while (counter < length) {
118
+ const value = string.charCodeAt(counter++);
119
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
120
+ // It's a high surrogate, and there is a next character.
121
+ const extra = string.charCodeAt(counter++);
122
+ if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
123
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
124
+ } else {
125
+ // It's an unmatched surrogate; only append this code unit, in case the
126
+ // next code unit is the high surrogate of a surrogate pair.
127
+ output.push(value);
128
+ counter--;
129
+ }
130
+ } else {
131
+ output.push(value);
132
+ }
133
+ }
134
+ return output;
135
+ }
136
+
137
+ /**
138
+ * Creates a string based on an array of numeric code points.
139
+ * @see `punycode.ucs2.decode`
140
+ * @memberOf punycode.ucs2
141
+ * @name encode
142
+ * @param {Array} codePoints The array of numeric code points.
143
+ * @returns {String} The new Unicode string (UCS-2).
144
+ */
145
+ const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
146
+
147
+ /**
148
+ * Converts a basic code point into a digit/integer.
149
+ * @see `digitToBasic()`
150
+ * @private
151
+ * @param {Number} codePoint The basic numeric code point value.
152
+ * @returns {Number} The numeric value of a basic code point (for use in
153
+ * representing integers) in the range `0` to `base - 1`, or `base` if
154
+ * the code point does not represent a value.
155
+ */
156
+ const basicToDigit = function(codePoint) {
157
+ if (codePoint >= 0x30 && codePoint < 0x3A) {
158
+ return 26 + (codePoint - 0x30);
159
+ }
160
+ if (codePoint >= 0x41 && codePoint < 0x5B) {
161
+ return codePoint - 0x41;
162
+ }
163
+ if (codePoint >= 0x61 && codePoint < 0x7B) {
164
+ return codePoint - 0x61;
165
+ }
166
+ return base;
167
+ };
168
+
169
+ /**
170
+ * Converts a digit/integer into a basic code point.
171
+ * @see `basicToDigit()`
172
+ * @private
173
+ * @param {Number} digit The numeric value of a basic code point.
174
+ * @returns {Number} The basic code point whose value (when used for
175
+ * representing integers) is `digit`, which needs to be in the range
176
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
177
+ * used; else, the lowercase form is used. The behavior is undefined
178
+ * if `flag` is non-zero and `digit` has no uppercase form.
179
+ */
180
+ const digitToBasic = function(digit, flag) {
181
+ // 0..25 map to ASCII a..z or A..Z
182
+ // 26..35 map to ASCII 0..9
183
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
184
+ };
185
+
186
+ /**
187
+ * Bias adaptation function as per section 3.4 of RFC 3492.
188
+ * https://tools.ietf.org/html/rfc3492#section-3.4
189
+ * @private
190
+ */
191
+ const adapt = function(delta, numPoints, firstTime) {
192
+ let k = 0;
193
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
194
+ delta += floor(delta / numPoints);
195
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
196
+ delta = floor(delta / baseMinusTMin);
197
+ }
198
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
199
+ };
200
+
201
+ /**
202
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
203
+ * symbols.
204
+ * @memberOf punycode
205
+ * @param {String} input The Punycode string of ASCII-only symbols.
206
+ * @returns {String} The resulting string of Unicode symbols.
207
+ */
208
+ const decode = function(input) {
209
+ // Don't use UCS-2.
210
+ const output = [];
211
+ const inputLength = input.length;
212
+ let i = 0;
213
+ let n = initialN;
214
+ let bias = initialBias;
215
+
216
+ // Handle the basic code points: let `basic` be the number of input code
217
+ // points before the last delimiter, or `0` if there is none, then copy
218
+ // the first basic code points to the output.
219
+
220
+ let basic = input.lastIndexOf(delimiter);
221
+ if (basic < 0) {
222
+ basic = 0;
223
+ }
224
+
225
+ for (let j = 0; j < basic; ++j) {
226
+ // if it's not a basic code point
227
+ if (input.charCodeAt(j) >= 0x80) {
228
+ error('not-basic');
229
+ }
230
+ output.push(input.charCodeAt(j));
231
+ }
232
+
233
+ // Main decoding loop: start just after the last delimiter if any basic code
234
+ // points were copied; start at the beginning otherwise.
235
+
236
+ for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
237
+
238
+ // `index` is the index of the next character to be consumed.
239
+ // Decode a generalized variable-length integer into `delta`,
240
+ // which gets added to `i`. The overflow checking is easier
241
+ // if we increase `i` as we go, then subtract off its starting
242
+ // value at the end to obtain `delta`.
243
+ const oldi = i;
244
+ for (let w = 1, k = base; /* no condition */; k += base) {
245
+
246
+ if (index >= inputLength) {
247
+ error('invalid-input');
248
+ }
249
+
250
+ const digit = basicToDigit(input.charCodeAt(index++));
251
+
252
+ if (digit >= base) {
253
+ error('invalid-input');
254
+ }
255
+ if (digit > floor((maxInt - i) / w)) {
256
+ error('overflow');
257
+ }
258
+
259
+ i += digit * w;
260
+ const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
261
+
262
+ if (digit < t) {
263
+ break;
264
+ }
265
+
266
+ const baseMinusT = base - t;
267
+ if (w > floor(maxInt / baseMinusT)) {
268
+ error('overflow');
269
+ }
270
+
271
+ w *= baseMinusT;
272
+
273
+ }
274
+
275
+ const out = output.length + 1;
276
+ bias = adapt(i - oldi, out, oldi == 0);
277
+
278
+ // `i` was supposed to wrap around from `out` to `0`,
279
+ // incrementing `n` each time, so we'll fix that now:
280
+ if (floor(i / out) > maxInt - n) {
281
+ error('overflow');
282
+ }
283
+
284
+ n += floor(i / out);
285
+ i %= out;
286
+
287
+ // Insert `n` at position `i` of the output.
288
+ output.splice(i++, 0, n);
289
+
290
+ }
291
+
292
+ return String.fromCodePoint(...output);
293
+ };
294
+
295
+ /**
296
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
297
+ * Punycode string of ASCII-only symbols.
298
+ * @memberOf punycode
299
+ * @param {String} input The string of Unicode symbols.
300
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
301
+ */
302
+ const encode = function(input) {
303
+ const output = [];
304
+
305
+ // Convert the input in UCS-2 to an array of Unicode code points.
306
+ input = ucs2decode(input);
307
+
308
+ // Cache the length.
309
+ const inputLength = input.length;
310
+
311
+ // Initialize the state.
312
+ let n = initialN;
313
+ let delta = 0;
314
+ let bias = initialBias;
315
+
316
+ // Handle the basic code points.
317
+ for (const currentValue of input) {
318
+ if (currentValue < 0x80) {
319
+ output.push(stringFromCharCode(currentValue));
320
+ }
321
+ }
322
+
323
+ const basicLength = output.length;
324
+ let handledCPCount = basicLength;
325
+
326
+ // `handledCPCount` is the number of code points that have been handled;
327
+ // `basicLength` is the number of basic code points.
328
+
329
+ // Finish the basic string with a delimiter unless it's empty.
330
+ if (basicLength) {
331
+ output.push(delimiter);
332
+ }
333
+
334
+ // Main encoding loop:
335
+ while (handledCPCount < inputLength) {
336
+
337
+ // All non-basic code points < n have been handled already. Find the next
338
+ // larger one:
339
+ let m = maxInt;
340
+ for (const currentValue of input) {
341
+ if (currentValue >= n && currentValue < m) {
342
+ m = currentValue;
343
+ }
344
+ }
345
+
346
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
347
+ // but guard against overflow.
348
+ const handledCPCountPlusOne = handledCPCount + 1;
349
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
350
+ error('overflow');
351
+ }
352
+
353
+ delta += (m - n) * handledCPCountPlusOne;
354
+ n = m;
355
+
356
+ for (const currentValue of input) {
357
+ if (currentValue < n && ++delta > maxInt) {
358
+ error('overflow');
359
+ }
360
+ if (currentValue === n) {
361
+ // Represent delta as a generalized variable-length integer.
362
+ let q = delta;
363
+ for (let k = base; /* no condition */; k += base) {
364
+ const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
365
+ if (q < t) {
366
+ break;
367
+ }
368
+ const qMinusT = q - t;
369
+ const baseMinusT = base - t;
370
+ output.push(
371
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
372
+ );
373
+ q = floor(qMinusT / baseMinusT);
374
+ }
375
+
376
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
377
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
378
+ delta = 0;
379
+ ++handledCPCount;
380
+ }
381
+ }
382
+
383
+ ++delta;
384
+ ++n;
385
+
386
+ }
387
+ return output.join('');
388
+ };
389
+
390
+ /**
391
+ * Converts a Punycode string representing a domain name or an email address
392
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
393
+ * it doesn't matter if you call it on a string that has already been
394
+ * converted to Unicode.
395
+ * @memberOf punycode
396
+ * @param {String} input The Punycoded domain name or email address to
397
+ * convert to Unicode.
398
+ * @returns {String} The Unicode representation of the given Punycode
399
+ * string.
400
+ */
401
+ const toUnicode = function(input) {
402
+ return mapDomain(input, function(string) {
403
+ return regexPunycode.test(string)
404
+ ? decode(string.slice(4).toLowerCase())
405
+ : string;
406
+ });
407
+ };
408
+
409
+ /**
410
+ * Converts a Unicode string representing a domain name or an email address to
411
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
412
+ * i.e. it doesn't matter if you call it with a domain that's already in
413
+ * ASCII.
414
+ * @memberOf punycode
415
+ * @param {String} input The domain name or email address to convert, as a
416
+ * Unicode string.
417
+ * @returns {String} The Punycode representation of the given domain name or
418
+ * email address.
419
+ */
420
+ const toASCII = function(input) {
421
+ return mapDomain(input, function(string) {
422
+ return regexNonASCII.test(string)
423
+ ? 'xn--' + encode(string)
424
+ : string;
425
+ });
426
+ };
427
+
428
+ /*--------------------------------------------------------------------------*/
429
+
430
+ /** Define the public API */
431
+ const punycode = {
432
+ /**
433
+ * A string representing the current Punycode.js version number.
434
+ * @memberOf punycode
435
+ * @type String
436
+ */
437
+ 'version': '2.1.0',
438
+ /**
439
+ * An object of methods to convert from JavaScript's internal character
440
+ * representation (UCS-2) to Unicode code points, and back.
441
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
442
+ * @memberOf punycode
443
+ * @type Object
444
+ */
445
+ 'ucs2': {
446
+ 'decode': ucs2decode,
447
+ 'encode': ucs2encode
448
+ },
449
+ 'decode': decode,
450
+ 'encode': encode,
451
+ 'toASCII': toASCII,
452
+ 'toUnicode': toUnicode
453
+ };
454
+
455
+ module.exports = punycode;