@netlify/plugin-nextjs 4.40.1 → 4.40.2

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 (161) hide show
  1. package/lib/helpers/edge.js +1 -0
  2. package/lib/templates/vendor.js +20 -0
  3. package/package.json +7 -4
  4. package/src/templates/edge/next-dev.js +3 -3
  5. package/src/templates/edge/shims.js +6 -6
  6. package/src/templates/edge-shared/next-utils.ts +3 -3
  7. package/src/templates/edge-shared/utils.ts +1 -1
  8. package/src/templates/vendor/deno.land/std@0.134.0/fmt/colors.ts +536 -0
  9. package/src/templates/vendor/deno.land/std@0.134.0/testing/_diff.ts +360 -0
  10. package/src/templates/vendor/deno.land/std@0.134.0/testing/asserts.ts +866 -0
  11. package/src/templates/vendor/deno.land/std@0.175.0/_util/asserts.ts +25 -0
  12. package/src/templates/vendor/deno.land/std@0.175.0/_util/os.ts +23 -0
  13. package/src/templates/vendor/deno.land/std@0.175.0/async/abortable.ts +149 -0
  14. package/src/templates/vendor/deno.land/std@0.175.0/async/deadline.ts +30 -0
  15. package/src/templates/vendor/deno.land/std@0.175.0/async/debounce.ts +79 -0
  16. package/src/templates/vendor/deno.land/std@0.175.0/async/deferred.ts +48 -0
  17. package/src/templates/vendor/deno.land/std@0.175.0/async/delay.ts +67 -0
  18. package/src/templates/vendor/deno.land/std@0.175.0/async/mod.ts +18 -0
  19. package/src/templates/vendor/deno.land/std@0.175.0/async/mux_async_iterator.ts +97 -0
  20. package/src/templates/vendor/deno.land/std@0.175.0/async/pool.ts +95 -0
  21. package/src/templates/vendor/deno.land/std@0.175.0/async/retry.ts +81 -0
  22. package/src/templates/vendor/deno.land/std@0.175.0/async/tee.ts +100 -0
  23. package/src/templates/vendor/deno.land/std@0.175.0/bytes/index_of_needle.ts +49 -0
  24. package/src/templates/vendor/deno.land/std@0.175.0/crypto/timing_safe_equal.ts +29 -0
  25. package/src/templates/vendor/deno.land/std@0.175.0/datetime/to_imf.ts +45 -0
  26. package/src/templates/vendor/deno.land/std@0.175.0/encoding/base64.ts +144 -0
  27. package/src/templates/vendor/deno.land/std@0.175.0/encoding/base64url.ts +70 -0
  28. package/src/templates/vendor/deno.land/std@0.175.0/flags/mod.ts +785 -0
  29. package/src/templates/vendor/deno.land/std@0.175.0/fmt/colors.ts +569 -0
  30. package/src/templates/vendor/deno.land/std@0.175.0/fmt/printf.ts +939 -0
  31. package/src/templates/vendor/deno.land/std@0.175.0/http/cookie.ts +403 -0
  32. package/src/templates/vendor/deno.land/std@0.175.0/node/_core.ts +77 -0
  33. package/src/templates/vendor/deno.land/std@0.175.0/node/_events.d.ts +848 -0
  34. package/src/templates/vendor/deno.land/std@0.175.0/node/_events.mjs +1033 -0
  35. package/src/templates/vendor/deno.land/std@0.175.0/node/_global.d.ts +66 -0
  36. package/src/templates/vendor/deno.land/std@0.175.0/node/_next_tick.ts +173 -0
  37. package/src/templates/vendor/deno.land/std@0.175.0/node/_process/exiting.ts +4 -0
  38. package/src/templates/vendor/deno.land/std@0.175.0/node/_process/process.ts +131 -0
  39. package/src/templates/vendor/deno.land/std@0.175.0/node/_process/stdio.mjs +7 -0
  40. package/src/templates/vendor/deno.land/std@0.175.0/node/_process/streams.mjs +146 -0
  41. package/src/templates/vendor/deno.land/std@0.175.0/node/_stream.d.ts +1488 -0
  42. package/src/templates/vendor/deno.land/std@0.175.0/node/_stream.mjs +746 -0
  43. package/src/templates/vendor/deno.land/std@0.175.0/node/_util/_util_callbackify.ts +129 -0
  44. package/src/templates/vendor/deno.land/std@0.175.0/node/_utils.ts +206 -0
  45. package/src/templates/vendor/deno.land/std@0.175.0/node/assert.ts +940 -0
  46. package/src/templates/vendor/deno.land/std@0.175.0/node/assertion_error.ts +579 -0
  47. package/src/templates/vendor/deno.land/std@0.175.0/node/async_hooks.ts +331 -0
  48. package/src/templates/vendor/deno.land/std@0.175.0/node/buffer.ts +13 -0
  49. package/src/templates/vendor/deno.land/std@0.175.0/node/events.ts +14 -0
  50. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/buffer.d.ts +2074 -0
  51. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/buffer.mjs +2607 -0
  52. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/crypto/_keys.ts +16 -0
  53. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/crypto/constants.ts +5 -0
  54. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/error_codes.ts +7 -0
  55. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/errors.ts +2867 -0
  56. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/fixed_queue.ts +123 -0
  57. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/hide_stack_frames.ts +16 -0
  58. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/net.ts +95 -0
  59. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/normalize_encoding.mjs +72 -0
  60. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/options.ts +45 -0
  61. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/primordials.mjs +30 -0
  62. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/process/per_thread.mjs +272 -0
  63. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/readline/callbacks.mjs +137 -0
  64. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/readline/utils.mjs +580 -0
  65. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/destroy.mjs +320 -0
  66. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/end-of-stream.mjs +229 -0
  67. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/utils.mjs +242 -0
  68. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/comparisons.ts +669 -0
  69. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/debuglog.ts +118 -0
  70. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/inspect.mjs +2237 -0
  71. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/types.ts +113 -0
  72. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util.mjs +143 -0
  73. package/src/templates/vendor/deno.land/std@0.175.0/node/internal/validators.mjs +317 -0
  74. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_libuv_winerror.ts +229 -0
  75. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_listen.ts +16 -0
  76. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_node.ts +18 -0
  77. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_timingSafeEqual.ts +12 -0
  78. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_utils.ts +86 -0
  79. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_winerror.ts +16873 -0
  80. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/ares.ts +66 -0
  81. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/async_wrap.ts +152 -0
  82. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/buffer.ts +130 -0
  83. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/cares_wrap.ts +541 -0
  84. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/config.ts +3 -0
  85. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/connection_wrap.ts +80 -0
  86. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/constants.ts +900 -0
  87. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/contextify.ts +3 -0
  88. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/credentials.ts +3 -0
  89. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/crypto.ts +14 -0
  90. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/errors.ts +3 -0
  91. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs.ts +3 -0
  92. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs_dir.ts +3 -0
  93. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs_event_wrap.ts +3 -0
  94. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/handle_wrap.ts +50 -0
  95. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/heap_utils.ts +3 -0
  96. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/http_parser.ts +3 -0
  97. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/icu.ts +3 -0
  98. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/inspector.ts +3 -0
  99. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/js_stream.ts +3 -0
  100. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/messaging.ts +3 -0
  101. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/mod.ts +108 -0
  102. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/module_wrap.ts +3 -0
  103. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/native_module.ts +3 -0
  104. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/natives.ts +3 -0
  105. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/node_file.ts +84 -0
  106. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/node_options.ts +39 -0
  107. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/options.ts +3 -0
  108. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/os.ts +3 -0
  109. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/performance.ts +3 -0
  110. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/pipe_wrap.ts +392 -0
  111. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/process_methods.ts +3 -0
  112. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/report.ts +3 -0
  113. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/serdes.ts +3 -0
  114. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/signal_wrap.ts +3 -0
  115. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/spawn_sync.ts +3 -0
  116. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/stream_wrap.ts +354 -0
  117. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/string_decoder.ts +15 -0
  118. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/symbols.ts +27 -0
  119. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/task_queue.ts +3 -0
  120. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tcp_wrap.ts +488 -0
  121. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/timers.ts +3 -0
  122. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tls_wrap.ts +3 -0
  123. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/trace_events.ts +3 -0
  124. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tty_wrap.ts +3 -0
  125. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/types.ts +186 -0
  126. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/udp_wrap.ts +496 -0
  127. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/url.ts +3 -0
  128. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/util.ts +126 -0
  129. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/uv.ts +437 -0
  130. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/v8.ts +3 -0
  131. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/worker.ts +3 -0
  132. package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/zlib.ts +3 -0
  133. package/src/templates/vendor/deno.land/std@0.175.0/node/process.ts +705 -0
  134. package/src/templates/vendor/deno.land/std@0.175.0/node/stream.ts +37 -0
  135. package/src/templates/vendor/deno.land/std@0.175.0/node/string_decoder.ts +337 -0
  136. package/src/templates/vendor/deno.land/std@0.175.0/node/util/types.ts +4 -0
  137. package/src/templates/vendor/deno.land/std@0.175.0/node/util.ts +289 -0
  138. package/src/templates/vendor/deno.land/std@0.175.0/path/_constants.ts +49 -0
  139. package/src/templates/vendor/deno.land/std@0.175.0/path/_interface.ts +30 -0
  140. package/src/templates/vendor/deno.land/std@0.175.0/path/_util.ts +194 -0
  141. package/src/templates/vendor/deno.land/std@0.175.0/path/common.ts +40 -0
  142. package/src/templates/vendor/deno.land/std@0.175.0/path/glob.ts +418 -0
  143. package/src/templates/vendor/deno.land/std@0.175.0/path/mod.ts +53 -0
  144. package/src/templates/vendor/deno.land/std@0.175.0/path/posix.ts +487 -0
  145. package/src/templates/vendor/deno.land/std@0.175.0/path/separator.ts +7 -0
  146. package/src/templates/vendor/deno.land/std@0.175.0/path/win32.ts +962 -0
  147. package/src/templates/vendor/deno.land/std@0.175.0/streams/write_all.ts +64 -0
  148. package/src/templates/vendor/deno.land/std@0.175.0/testing/_diff.ts +440 -0
  149. package/src/templates/vendor/deno.land/std@0.175.0/testing/_format.ts +23 -0
  150. package/src/templates/vendor/deno.land/std@0.175.0/testing/asserts.ts +906 -0
  151. package/src/templates/vendor/deno.land/std@0.175.0/types.d.ts +89 -0
  152. package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts +133 -0
  153. package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/asyncify.js +112 -0
  154. package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.d.ts +88 -0
  155. package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.js +974 -0
  156. package/src/templates/vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts +621 -0
  157. package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js +13 -0
  158. package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js +12 -0
  159. package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js +5 -0
  160. package/src/templates/vendor/import_map.json +13 -0
  161. package/src/templates/vendor/raw.githubusercontent.com/worker-tools/resolvable-promise/master/index.ts +50 -0
@@ -0,0 +1,437 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // Copyright Joyent, Inc. and other Node contributors.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a
5
+ // copy of this software and associated documentation files (the
6
+ // "Software"), to deal in the Software without restriction, including
7
+ // without limitation the rights to use, copy, modify, merge, publish,
8
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
9
+ // persons to whom the Software is furnished to do so, subject to the
10
+ // following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be included
13
+ // in all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
18
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ // This module ports:
24
+ // - https://github.com/nodejs/node/blob/master/src/uv.cc
25
+ // - https://github.com/nodejs/node/blob/master/deps/uv
26
+ //
27
+ // See also: http://docs.libuv.org/en/v1.x/errors.html#error-constants
28
+
29
+ import { unreachable } from "../../_util/asserts.ts";
30
+ import { osType } from "../../_util/os.ts";
31
+ import { uvTranslateSysError } from "./_libuv_winerror.ts";
32
+
33
+ // In Node these values are coming from libuv:
34
+ // Ref: https://github.com/libuv/libuv/blob/v1.x/include/uv/errno.h
35
+ // Ref: https://github.com/nodejs/node/blob/524123fbf064ff64bb6fcd83485cfc27db932f68/lib/internal/errors.js#L383
36
+ // Since there is no easy way to port code from libuv and these maps are
37
+ // changing very rarely, we simply extract them from Node and store here.
38
+
39
+ // Note
40
+ // Run the following to get the map:
41
+ // $ node -e "console.log(process.binding('uv').getErrorMap())"
42
+ // This setup automatically exports maps from both "win", "linux" & darwin:
43
+ // https://github.com/schwarzkopfb/node_errno_map
44
+
45
+ type ErrorMapData = Array<[number, [string, string]]>;
46
+ type CodeMapData = Array<[string, number]>;
47
+
48
+ const codeToErrorWindows: ErrorMapData = [
49
+ [-4093, ["E2BIG", "argument list too long"]],
50
+ [-4092, ["EACCES", "permission denied"]],
51
+ [-4091, ["EADDRINUSE", "address already in use"]],
52
+ [-4090, ["EADDRNOTAVAIL", "address not available"]],
53
+ [-4089, ["EAFNOSUPPORT", "address family not supported"]],
54
+ [-4088, ["EAGAIN", "resource temporarily unavailable"]],
55
+ [-3000, ["EAI_ADDRFAMILY", "address family not supported"]],
56
+ [-3001, ["EAI_AGAIN", "temporary failure"]],
57
+ [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]],
58
+ [-3013, ["EAI_BADHINTS", "invalid value for hints"]],
59
+ [-3003, ["EAI_CANCELED", "request canceled"]],
60
+ [-3004, ["EAI_FAIL", "permanent failure"]],
61
+ [-3005, ["EAI_FAMILY", "ai_family not supported"]],
62
+ [-3006, ["EAI_MEMORY", "out of memory"]],
63
+ [-3007, ["EAI_NODATA", "no address"]],
64
+ [-3008, ["EAI_NONAME", "unknown node or service"]],
65
+ [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]],
66
+ [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]],
67
+ [-3010, ["EAI_SERVICE", "service not available for socket type"]],
68
+ [-3011, ["EAI_SOCKTYPE", "socket type not supported"]],
69
+ [-4084, ["EALREADY", "connection already in progress"]],
70
+ [-4083, ["EBADF", "bad file descriptor"]],
71
+ [-4082, ["EBUSY", "resource busy or locked"]],
72
+ [-4081, ["ECANCELED", "operation canceled"]],
73
+ [-4080, ["ECHARSET", "invalid Unicode character"]],
74
+ [-4079, ["ECONNABORTED", "software caused connection abort"]],
75
+ [-4078, ["ECONNREFUSED", "connection refused"]],
76
+ [-4077, ["ECONNRESET", "connection reset by peer"]],
77
+ [-4076, ["EDESTADDRREQ", "destination address required"]],
78
+ [-4075, ["EEXIST", "file already exists"]],
79
+ [-4074, ["EFAULT", "bad address in system call argument"]],
80
+ [-4036, ["EFBIG", "file too large"]],
81
+ [-4073, ["EHOSTUNREACH", "host is unreachable"]],
82
+ [-4072, ["EINTR", "interrupted system call"]],
83
+ [-4071, ["EINVAL", "invalid argument"]],
84
+ [-4070, ["EIO", "i/o error"]],
85
+ [-4069, ["EISCONN", "socket is already connected"]],
86
+ [-4068, ["EISDIR", "illegal operation on a directory"]],
87
+ [-4067, ["ELOOP", "too many symbolic links encountered"]],
88
+ [-4066, ["EMFILE", "too many open files"]],
89
+ [-4065, ["EMSGSIZE", "message too long"]],
90
+ [-4064, ["ENAMETOOLONG", "name too long"]],
91
+ [-4063, ["ENETDOWN", "network is down"]],
92
+ [-4062, ["ENETUNREACH", "network is unreachable"]],
93
+ [-4061, ["ENFILE", "file table overflow"]],
94
+ [-4060, ["ENOBUFS", "no buffer space available"]],
95
+ [-4059, ["ENODEV", "no such device"]],
96
+ [-4058, ["ENOENT", "no such file or directory"]],
97
+ [-4057, ["ENOMEM", "not enough memory"]],
98
+ [-4056, ["ENONET", "machine is not on the network"]],
99
+ [-4035, ["ENOPROTOOPT", "protocol not available"]],
100
+ [-4055, ["ENOSPC", "no space left on device"]],
101
+ [-4054, ["ENOSYS", "function not implemented"]],
102
+ [-4053, ["ENOTCONN", "socket is not connected"]],
103
+ [-4052, ["ENOTDIR", "not a directory"]],
104
+ [-4051, ["ENOTEMPTY", "directory not empty"]],
105
+ [-4050, ["ENOTSOCK", "socket operation on non-socket"]],
106
+ [-4049, ["ENOTSUP", "operation not supported on socket"]],
107
+ [-4048, ["EPERM", "operation not permitted"]],
108
+ [-4047, ["EPIPE", "broken pipe"]],
109
+ [-4046, ["EPROTO", "protocol error"]],
110
+ [-4045, ["EPROTONOSUPPORT", "protocol not supported"]],
111
+ [-4044, ["EPROTOTYPE", "protocol wrong type for socket"]],
112
+ [-4034, ["ERANGE", "result too large"]],
113
+ [-4043, ["EROFS", "read-only file system"]],
114
+ [-4042, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]],
115
+ [-4041, ["ESPIPE", "invalid seek"]],
116
+ [-4040, ["ESRCH", "no such process"]],
117
+ [-4039, ["ETIMEDOUT", "connection timed out"]],
118
+ [-4038, ["ETXTBSY", "text file is busy"]],
119
+ [-4037, ["EXDEV", "cross-device link not permitted"]],
120
+ [-4094, ["UNKNOWN", "unknown error"]],
121
+ [-4095, ["EOF", "end of file"]],
122
+ [-4033, ["ENXIO", "no such device or address"]],
123
+ [-4032, ["EMLINK", "too many links"]],
124
+ [-4031, ["EHOSTDOWN", "host is down"]],
125
+ [-4030, ["EREMOTEIO", "remote I/O error"]],
126
+ [-4029, ["ENOTTY", "inappropriate ioctl for device"]],
127
+ [-4028, ["EFTYPE", "inappropriate file type or format"]],
128
+ [-4027, ["EILSEQ", "illegal byte sequence"]],
129
+ ];
130
+
131
+ const errorToCodeWindows: CodeMapData = codeToErrorWindows.map((
132
+ [status, [error]],
133
+ ) => [error, status]);
134
+
135
+ const codeToErrorDarwin: ErrorMapData = [
136
+ [-7, ["E2BIG", "argument list too long"]],
137
+ [-13, ["EACCES", "permission denied"]],
138
+ [-48, ["EADDRINUSE", "address already in use"]],
139
+ [-49, ["EADDRNOTAVAIL", "address not available"]],
140
+ [-47, ["EAFNOSUPPORT", "address family not supported"]],
141
+ [-35, ["EAGAIN", "resource temporarily unavailable"]],
142
+ [-3000, ["EAI_ADDRFAMILY", "address family not supported"]],
143
+ [-3001, ["EAI_AGAIN", "temporary failure"]],
144
+ [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]],
145
+ [-3013, ["EAI_BADHINTS", "invalid value for hints"]],
146
+ [-3003, ["EAI_CANCELED", "request canceled"]],
147
+ [-3004, ["EAI_FAIL", "permanent failure"]],
148
+ [-3005, ["EAI_FAMILY", "ai_family not supported"]],
149
+ [-3006, ["EAI_MEMORY", "out of memory"]],
150
+ [-3007, ["EAI_NODATA", "no address"]],
151
+ [-3008, ["EAI_NONAME", "unknown node or service"]],
152
+ [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]],
153
+ [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]],
154
+ [-3010, ["EAI_SERVICE", "service not available for socket type"]],
155
+ [-3011, ["EAI_SOCKTYPE", "socket type not supported"]],
156
+ [-37, ["EALREADY", "connection already in progress"]],
157
+ [-9, ["EBADF", "bad file descriptor"]],
158
+ [-16, ["EBUSY", "resource busy or locked"]],
159
+ [-89, ["ECANCELED", "operation canceled"]],
160
+ [-4080, ["ECHARSET", "invalid Unicode character"]],
161
+ [-53, ["ECONNABORTED", "software caused connection abort"]],
162
+ [-61, ["ECONNREFUSED", "connection refused"]],
163
+ [-54, ["ECONNRESET", "connection reset by peer"]],
164
+ [-39, ["EDESTADDRREQ", "destination address required"]],
165
+ [-17, ["EEXIST", "file already exists"]],
166
+ [-14, ["EFAULT", "bad address in system call argument"]],
167
+ [-27, ["EFBIG", "file too large"]],
168
+ [-65, ["EHOSTUNREACH", "host is unreachable"]],
169
+ [-4, ["EINTR", "interrupted system call"]],
170
+ [-22, ["EINVAL", "invalid argument"]],
171
+ [-5, ["EIO", "i/o error"]],
172
+ [-56, ["EISCONN", "socket is already connected"]],
173
+ [-21, ["EISDIR", "illegal operation on a directory"]],
174
+ [-62, ["ELOOP", "too many symbolic links encountered"]],
175
+ [-24, ["EMFILE", "too many open files"]],
176
+ [-40, ["EMSGSIZE", "message too long"]],
177
+ [-63, ["ENAMETOOLONG", "name too long"]],
178
+ [-50, ["ENETDOWN", "network is down"]],
179
+ [-51, ["ENETUNREACH", "network is unreachable"]],
180
+ [-23, ["ENFILE", "file table overflow"]],
181
+ [-55, ["ENOBUFS", "no buffer space available"]],
182
+ [-19, ["ENODEV", "no such device"]],
183
+ [-2, ["ENOENT", "no such file or directory"]],
184
+ [-12, ["ENOMEM", "not enough memory"]],
185
+ [-4056, ["ENONET", "machine is not on the network"]],
186
+ [-42, ["ENOPROTOOPT", "protocol not available"]],
187
+ [-28, ["ENOSPC", "no space left on device"]],
188
+ [-78, ["ENOSYS", "function not implemented"]],
189
+ [-57, ["ENOTCONN", "socket is not connected"]],
190
+ [-20, ["ENOTDIR", "not a directory"]],
191
+ [-66, ["ENOTEMPTY", "directory not empty"]],
192
+ [-38, ["ENOTSOCK", "socket operation on non-socket"]],
193
+ [-45, ["ENOTSUP", "operation not supported on socket"]],
194
+ [-1, ["EPERM", "operation not permitted"]],
195
+ [-32, ["EPIPE", "broken pipe"]],
196
+ [-100, ["EPROTO", "protocol error"]],
197
+ [-43, ["EPROTONOSUPPORT", "protocol not supported"]],
198
+ [-41, ["EPROTOTYPE", "protocol wrong type for socket"]],
199
+ [-34, ["ERANGE", "result too large"]],
200
+ [-30, ["EROFS", "read-only file system"]],
201
+ [-58, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]],
202
+ [-29, ["ESPIPE", "invalid seek"]],
203
+ [-3, ["ESRCH", "no such process"]],
204
+ [-60, ["ETIMEDOUT", "connection timed out"]],
205
+ [-26, ["ETXTBSY", "text file is busy"]],
206
+ [-18, ["EXDEV", "cross-device link not permitted"]],
207
+ [-4094, ["UNKNOWN", "unknown error"]],
208
+ [-4095, ["EOF", "end of file"]],
209
+ [-6, ["ENXIO", "no such device or address"]],
210
+ [-31, ["EMLINK", "too many links"]],
211
+ [-64, ["EHOSTDOWN", "host is down"]],
212
+ [-4030, ["EREMOTEIO", "remote I/O error"]],
213
+ [-25, ["ENOTTY", "inappropriate ioctl for device"]],
214
+ [-79, ["EFTYPE", "inappropriate file type or format"]],
215
+ [-92, ["EILSEQ", "illegal byte sequence"]],
216
+ ];
217
+
218
+ const errorToCodeDarwin: CodeMapData = codeToErrorDarwin.map((
219
+ [status, [code]],
220
+ ) => [code, status]);
221
+
222
+ const codeToErrorLinux: ErrorMapData = [
223
+ [-7, ["E2BIG", "argument list too long"]],
224
+ [-13, ["EACCES", "permission denied"]],
225
+ [-98, ["EADDRINUSE", "address already in use"]],
226
+ [-99, ["EADDRNOTAVAIL", "address not available"]],
227
+ [-97, ["EAFNOSUPPORT", "address family not supported"]],
228
+ [-11, ["EAGAIN", "resource temporarily unavailable"]],
229
+ [-3000, ["EAI_ADDRFAMILY", "address family not supported"]],
230
+ [-3001, ["EAI_AGAIN", "temporary failure"]],
231
+ [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]],
232
+ [-3013, ["EAI_BADHINTS", "invalid value for hints"]],
233
+ [-3003, ["EAI_CANCELED", "request canceled"]],
234
+ [-3004, ["EAI_FAIL", "permanent failure"]],
235
+ [-3005, ["EAI_FAMILY", "ai_family not supported"]],
236
+ [-3006, ["EAI_MEMORY", "out of memory"]],
237
+ [-3007, ["EAI_NODATA", "no address"]],
238
+ [-3008, ["EAI_NONAME", "unknown node or service"]],
239
+ [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]],
240
+ [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]],
241
+ [-3010, ["EAI_SERVICE", "service not available for socket type"]],
242
+ [-3011, ["EAI_SOCKTYPE", "socket type not supported"]],
243
+ [-114, ["EALREADY", "connection already in progress"]],
244
+ [-9, ["EBADF", "bad file descriptor"]],
245
+ [-16, ["EBUSY", "resource busy or locked"]],
246
+ [-125, ["ECANCELED", "operation canceled"]],
247
+ [-4080, ["ECHARSET", "invalid Unicode character"]],
248
+ [-103, ["ECONNABORTED", "software caused connection abort"]],
249
+ [-111, ["ECONNREFUSED", "connection refused"]],
250
+ [-104, ["ECONNRESET", "connection reset by peer"]],
251
+ [-89, ["EDESTADDRREQ", "destination address required"]],
252
+ [-17, ["EEXIST", "file already exists"]],
253
+ [-14, ["EFAULT", "bad address in system call argument"]],
254
+ [-27, ["EFBIG", "file too large"]],
255
+ [-113, ["EHOSTUNREACH", "host is unreachable"]],
256
+ [-4, ["EINTR", "interrupted system call"]],
257
+ [-22, ["EINVAL", "invalid argument"]],
258
+ [-5, ["EIO", "i/o error"]],
259
+ [-106, ["EISCONN", "socket is already connected"]],
260
+ [-21, ["EISDIR", "illegal operation on a directory"]],
261
+ [-40, ["ELOOP", "too many symbolic links encountered"]],
262
+ [-24, ["EMFILE", "too many open files"]],
263
+ [-90, ["EMSGSIZE", "message too long"]],
264
+ [-36, ["ENAMETOOLONG", "name too long"]],
265
+ [-100, ["ENETDOWN", "network is down"]],
266
+ [-101, ["ENETUNREACH", "network is unreachable"]],
267
+ [-23, ["ENFILE", "file table overflow"]],
268
+ [-105, ["ENOBUFS", "no buffer space available"]],
269
+ [-19, ["ENODEV", "no such device"]],
270
+ [-2, ["ENOENT", "no such file or directory"]],
271
+ [-12, ["ENOMEM", "not enough memory"]],
272
+ [-64, ["ENONET", "machine is not on the network"]],
273
+ [-92, ["ENOPROTOOPT", "protocol not available"]],
274
+ [-28, ["ENOSPC", "no space left on device"]],
275
+ [-38, ["ENOSYS", "function not implemented"]],
276
+ [-107, ["ENOTCONN", "socket is not connected"]],
277
+ [-20, ["ENOTDIR", "not a directory"]],
278
+ [-39, ["ENOTEMPTY", "directory not empty"]],
279
+ [-88, ["ENOTSOCK", "socket operation on non-socket"]],
280
+ [-95, ["ENOTSUP", "operation not supported on socket"]],
281
+ [-1, ["EPERM", "operation not permitted"]],
282
+ [-32, ["EPIPE", "broken pipe"]],
283
+ [-71, ["EPROTO", "protocol error"]],
284
+ [-93, ["EPROTONOSUPPORT", "protocol not supported"]],
285
+ [-91, ["EPROTOTYPE", "protocol wrong type for socket"]],
286
+ [-34, ["ERANGE", "result too large"]],
287
+ [-30, ["EROFS", "read-only file system"]],
288
+ [-108, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]],
289
+ [-29, ["ESPIPE", "invalid seek"]],
290
+ [-3, ["ESRCH", "no such process"]],
291
+ [-110, ["ETIMEDOUT", "connection timed out"]],
292
+ [-26, ["ETXTBSY", "text file is busy"]],
293
+ [-18, ["EXDEV", "cross-device link not permitted"]],
294
+ [-4094, ["UNKNOWN", "unknown error"]],
295
+ [-4095, ["EOF", "end of file"]],
296
+ [-6, ["ENXIO", "no such device or address"]],
297
+ [-31, ["EMLINK", "too many links"]],
298
+ [-112, ["EHOSTDOWN", "host is down"]],
299
+ [-121, ["EREMOTEIO", "remote I/O error"]],
300
+ [-25, ["ENOTTY", "inappropriate ioctl for device"]],
301
+ [-4028, ["EFTYPE", "inappropriate file type or format"]],
302
+ [-84, ["EILSEQ", "illegal byte sequence"]],
303
+ ];
304
+
305
+ const errorToCodeLinux: CodeMapData = codeToErrorLinux.map((
306
+ [status, [code]],
307
+ ) => [code, status]);
308
+
309
+ const codeToErrorFreebsd: ErrorMapData = [
310
+ [-7, ["E2BIG", "argument list too long"]],
311
+ [-13, ["EACCES", "permission denied"]],
312
+ [-48, ["EADDRINUSE", "address already in use"]],
313
+ [-49, ["EADDRNOTAVAIL", "address not available"]],
314
+ [-47, ["EAFNOSUPPORT", "address family not supported"]],
315
+ [-35, ["EAGAIN", "resource temporarily unavailable"]],
316
+ [-3000, ["EAI_ADDRFAMILY", "address family not supported"]],
317
+ [-3001, ["EAI_AGAIN", "temporary failure"]],
318
+ [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]],
319
+ [-3013, ["EAI_BADHINTS", "invalid value for hints"]],
320
+ [-3003, ["EAI_CANCELED", "request canceled"]],
321
+ [-3004, ["EAI_FAIL", "permanent failure"]],
322
+ [-3005, ["EAI_FAMILY", "ai_family not supported"]],
323
+ [-3006, ["EAI_MEMORY", "out of memory"]],
324
+ [-3007, ["EAI_NODATA", "no address"]],
325
+ [-3008, ["EAI_NONAME", "unknown node or service"]],
326
+ [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]],
327
+ [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]],
328
+ [-3010, ["EAI_SERVICE", "service not available for socket type"]],
329
+ [-3011, ["EAI_SOCKTYPE", "socket type not supported"]],
330
+ [-37, ["EALREADY", "connection already in progress"]],
331
+ [-9, ["EBADF", "bad file descriptor"]],
332
+ [-16, ["EBUSY", "resource busy or locked"]],
333
+ [-85, ["ECANCELED", "operation canceled"]],
334
+ [-4080, ["ECHARSET", "invalid Unicode character"]],
335
+ [-53, ["ECONNABORTED", "software caused connection abort"]],
336
+ [-61, ["ECONNREFUSED", "connection refused"]],
337
+ [-54, ["ECONNRESET", "connection reset by peer"]],
338
+ [-39, ["EDESTADDRREQ", "destination address required"]],
339
+ [-17, ["EEXIST", "file already exists"]],
340
+ [-14, ["EFAULT", "bad address in system call argument"]],
341
+ [-27, ["EFBIG", "file too large"]],
342
+ [-65, ["EHOSTUNREACH", "host is unreachable"]],
343
+ [-4, ["EINTR", "interrupted system call"]],
344
+ [-22, ["EINVAL", "invalid argument"]],
345
+ [-5, ["EIO", "i/o error"]],
346
+ [-56, ["EISCONN", "socket is already connected"]],
347
+ [-21, ["EISDIR", "illegal operation on a directory"]],
348
+ [-62, ["ELOOP", "too many symbolic links encountered"]],
349
+ [-24, ["EMFILE", "too many open files"]],
350
+ [-40, ["EMSGSIZE", "message too long"]],
351
+ [-63, ["ENAMETOOLONG", "name too long"]],
352
+ [-50, ["ENETDOWN", "network is down"]],
353
+ [-51, ["ENETUNREACH", "network is unreachable"]],
354
+ [-23, ["ENFILE", "file table overflow"]],
355
+ [-55, ["ENOBUFS", "no buffer space available"]],
356
+ [-19, ["ENODEV", "no such device"]],
357
+ [-2, ["ENOENT", "no such file or directory"]],
358
+ [-12, ["ENOMEM", "not enough memory"]],
359
+ [-4056, ["ENONET", "machine is not on the network"]],
360
+ [-42, ["ENOPROTOOPT", "protocol not available"]],
361
+ [-28, ["ENOSPC", "no space left on device"]],
362
+ [-78, ["ENOSYS", "function not implemented"]],
363
+ [-57, ["ENOTCONN", "socket is not connected"]],
364
+ [-20, ["ENOTDIR", "not a directory"]],
365
+ [-66, ["ENOTEMPTY", "directory not empty"]],
366
+ [-38, ["ENOTSOCK", "socket operation on non-socket"]],
367
+ [-45, ["ENOTSUP", "operation not supported on socket"]],
368
+ [-84, ["EOVERFLOW", "value too large for defined data type"]],
369
+ [-1, ["EPERM", "operation not permitted"]],
370
+ [-32, ["EPIPE", "broken pipe"]],
371
+ [-92, ["EPROTO", "protocol error"]],
372
+ [-43, ["EPROTONOSUPPORT", "protocol not supported"]],
373
+ [-41, ["EPROTOTYPE", "protocol wrong type for socket"]],
374
+ [-34, ["ERANGE", "result too large"]],
375
+ [-30, ["EROFS", "read-only file system"]],
376
+ [-58, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]],
377
+ [-29, ["ESPIPE", "invalid seek"]],
378
+ [-3, ["ESRCH", "no such process"]],
379
+ [-60, ["ETIMEDOUT", "connection timed out"]],
380
+ [-26, ["ETXTBSY", "text file is busy"]],
381
+ [-18, ["EXDEV", "cross-device link not permitted"]],
382
+ [-4094, ["UNKNOWN", "unknown error"]],
383
+ [-4095, ["EOF", "end of file"]],
384
+ [-6, ["ENXIO", "no such device or address"]],
385
+ [-31, ["EMLINK", "too many links"]],
386
+ [-64, ["EHOSTDOWN", "host is down"]],
387
+ [-4030, ["EREMOTEIO", "remote I/O error"]],
388
+ [-25, ["ENOTTY", "inappropriate ioctl for device"]],
389
+ [-79, ["EFTYPE", "inappropriate file type or format"]],
390
+ [-86, ["EILSEQ", "illegal byte sequence"]],
391
+ [-44, ["ESOCKTNOSUPPORT", "socket type not supported"]],
392
+ ];
393
+
394
+ const errorToCodeFreebsd: CodeMapData = codeToErrorFreebsd.map((
395
+ [status, [code]],
396
+ ) => [code, status]);
397
+
398
+ export const errorMap = new Map<number, [string, string]>(
399
+ osType === "windows"
400
+ ? codeToErrorWindows
401
+ : osType === "darwin"
402
+ ? codeToErrorDarwin
403
+ : osType === "linux"
404
+ ? codeToErrorLinux
405
+ : osType === "freebsd"
406
+ ? codeToErrorFreebsd
407
+ : unreachable(),
408
+ );
409
+
410
+ export const codeMap = new Map<string, number>(
411
+ osType === "windows"
412
+ ? errorToCodeWindows
413
+ : osType === "darwin"
414
+ ? errorToCodeDarwin
415
+ : osType === "linux"
416
+ ? errorToCodeLinux
417
+ : osType === "freebsd"
418
+ ? errorToCodeFreebsd
419
+ : unreachable(),
420
+ );
421
+
422
+ export function mapSysErrnoToUvErrno(sysErrno: number): number {
423
+ if (osType === "windows") {
424
+ const code = uvTranslateSysError(sysErrno);
425
+ return codeMap.get(code) ?? -sysErrno;
426
+ } else {
427
+ return -sysErrno;
428
+ }
429
+ }
430
+
431
+ export const UV_EAI_MEMORY = codeMap.get("EAI_MEMORY")!;
432
+ export const UV_EBADF = codeMap.get("EBADF")!;
433
+ export const UV_EEXIST = codeMap.get("EEXIST");
434
+ export const UV_EINVAL = codeMap.get("EINVAL")!;
435
+ export const UV_ENOENT = codeMap.get("ENOENT");
436
+ export const UV_ENOTSOCK = codeMap.get("ENOTSOCK")!;
437
+ export const UV_UNKNOWN = codeMap.get("UNKNOWN")!;
@@ -0,0 +1,3 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+
3
+ export {};
@@ -0,0 +1,3 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+
3
+ export {};
@@ -0,0 +1,3 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+
3
+ export {};