sfml.js 1.0.0-rc.1 → 1.0.0

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 (334) hide show
  1. package/README.ja.md +177 -0
  2. package/README.ko.md +177 -0
  3. package/README.md +119 -14
  4. package/README.zh-CN.md +177 -0
  5. package/assets/branding/sfml-js-symbol-pentagon.svg +24 -0
  6. package/assets/branding/sfml-js-wordmark-dark.svg +20 -0
  7. package/assets/branding/sfml-js-wordmark.svg +19 -0
  8. package/assets/breakout.png +0 -0
  9. package/dist/audio/effect-processor.d.ts +53 -8
  10. package/dist/audio/effect-processor.js +35 -5
  11. package/dist/audio/input-sound-file.d.ts +101 -15
  12. package/dist/audio/input-sound-file.js +101 -15
  13. package/dist/audio/listener.d.ts +74 -12
  14. package/dist/audio/listener.js +74 -12
  15. package/dist/audio/music.d.ts +172 -22
  16. package/dist/audio/music.js +185 -24
  17. package/dist/audio/output-sound-file.d.ts +36 -4
  18. package/dist/audio/output-sound-file.js +36 -4
  19. package/dist/audio/playback-device.d.ts +103 -17
  20. package/dist/audio/playback-device.js +97 -16
  21. package/dist/audio/sound-buffer-recorder.d.ts +89 -9
  22. package/dist/audio/sound-buffer-recorder.js +89 -9
  23. package/dist/audio/sound-buffer.d.ts +121 -16
  24. package/dist/audio/sound-buffer.js +98 -13
  25. package/dist/audio/sound-file-factory.d.ts +84 -11
  26. package/dist/audio/sound-file-factory.js +84 -11
  27. package/dist/audio/sound-file-reader.d.ts +155 -24
  28. package/dist/audio/sound-file-reader.js +84 -13
  29. package/dist/audio/sound-file-writer.d.ts +49 -7
  30. package/dist/audio/sound-file-writer.js +13 -2
  31. package/dist/audio/sound-recorder.d.ts +143 -19
  32. package/dist/audio/sound-recorder.js +142 -18
  33. package/dist/audio/sound-source.d.ts +273 -45
  34. package/dist/audio/sound-source.js +273 -45
  35. package/dist/audio/sound-stream.d.ts +57 -9
  36. package/dist/audio/sound-stream.js +43 -7
  37. package/dist/audio/sound.d.ts +32 -5
  38. package/dist/audio/sound.js +32 -5
  39. package/dist/audio/value.d.ts +291 -48
  40. package/dist/audio/value.js +235 -39
  41. package/dist/audio/worker.d.ts +256 -38
  42. package/dist/graphics/blend-mode.d.ts +199 -33
  43. package/dist/graphics/blend-mode.js +163 -27
  44. package/dist/graphics/boolean-vector.d.ts +102 -16
  45. package/dist/graphics/boolean-vector.js +102 -16
  46. package/dist/graphics/circle-shape.d.ts +68 -11
  47. package/dist/graphics/circle-shape.js +37 -6
  48. package/dist/graphics/color.d.ts +227 -42
  49. package/dist/graphics/color.js +177 -32
  50. package/dist/graphics/convex-shape.d.ts +45 -7
  51. package/dist/graphics/convex-shape.js +31 -5
  52. package/dist/graphics/drawable.d.ts +15 -2
  53. package/dist/graphics/drawable.js +6 -1
  54. package/dist/graphics/font.d.ts +153 -24
  55. package/dist/graphics/font.js +116 -18
  56. package/dist/graphics/glsl-matrix.d.ts +44 -7
  57. package/dist/graphics/glsl-matrix.js +44 -7
  58. package/dist/graphics/glsl.d.ts +129 -21
  59. package/dist/graphics/glsl.js +123 -20
  60. package/dist/graphics/glyph.d.ts +106 -17
  61. package/dist/graphics/glyph.js +76 -12
  62. package/dist/graphics/image.d.ts +159 -24
  63. package/dist/graphics/image.js +122 -18
  64. package/dist/graphics/primitive-type.d.ts +42 -7
  65. package/dist/graphics/primitive-type.js +42 -7
  66. package/dist/graphics/rect.d.ts +162 -26
  67. package/dist/graphics/rect.js +101 -16
  68. package/dist/graphics/rectangle-shape.d.ts +44 -7
  69. package/dist/graphics/rectangle-shape.js +31 -5
  70. package/dist/graphics/render-states.d.ts +153 -25
  71. package/dist/graphics/render-states.js +49 -8
  72. package/dist/graphics/render-target.d.ts +145 -22
  73. package/dist/graphics/render-target.js +110 -17
  74. package/dist/graphics/render-texture.d.ts +100 -16
  75. package/dist/graphics/render-texture.js +80 -13
  76. package/dist/graphics/render-window.d.ts +106 -17
  77. package/dist/graphics/render-window.js +57 -9
  78. package/dist/graphics/shader.d.ts +153 -24
  79. package/dist/graphics/shader.js +126 -20
  80. package/dist/graphics/shape.d.ts +133 -21
  81. package/dist/graphics/shape.js +115 -18
  82. package/dist/graphics/sprite.d.ts +71 -11
  83. package/dist/graphics/sprite.js +57 -9
  84. package/dist/graphics/stencil-mode.d.ts +193 -32
  85. package/dist/graphics/stencil-mode.js +121 -20
  86. package/dist/graphics/swap.d.ts +13 -2
  87. package/dist/graphics/text.d.ts +624 -103
  88. package/dist/graphics/text.js +443 -73
  89. package/dist/graphics/texture.d.ts +209 -32
  90. package/dist/graphics/texture.js +137 -21
  91. package/dist/graphics/transform.d.ts +93 -14
  92. package/dist/graphics/transform.js +93 -14
  93. package/dist/graphics/transformable.d.ts +13 -2
  94. package/dist/graphics/transformable.js +13 -2
  95. package/dist/graphics/vertex-array.d.ts +83 -14
  96. package/dist/graphics/vertex-array.js +70 -12
  97. package/dist/graphics/vertex-buffer.d.ts +162 -26
  98. package/dist/graphics/vertex-buffer.js +106 -17
  99. package/dist/graphics/vertex.d.ts +83 -14
  100. package/dist/graphics/vertex.js +43 -7
  101. package/dist/graphics/view.d.ts +140 -22
  102. package/dist/graphics/view.js +103 -16
  103. package/dist/internal/glsl-value.d.ts +30 -5
  104. package/dist/internal/glsl-value.js +30 -5
  105. package/dist/internal/scalar.d.ts +9 -1
  106. package/dist/internal/transformable.d.ts +84 -13
  107. package/dist/internal/value-storage.d.ts +8 -1
  108. package/dist/network/common.d.ts +6 -1
  109. package/dist/network/common.js +6 -1
  110. package/dist/network/dns.d.ts +103 -14
  111. package/dist/network/dns.js +55 -6
  112. package/dist/network/ftp.d.ts +217 -33
  113. package/dist/network/ftp.js +217 -33
  114. package/dist/network/gen/constants.d.ts +750 -124
  115. package/dist/network/gen/constants.js +750 -124
  116. package/dist/network/http.d.ts +365 -57
  117. package/dist/network/http.js +365 -57
  118. package/dist/network/ip-address.d.ts +179 -26
  119. package/dist/network/ip-address.js +164 -24
  120. package/dist/network/packet.d.ts +200 -29
  121. package/dist/network/packet.js +101 -13
  122. package/dist/network/sftp.d.ts +525 -84
  123. package/dist/network/sftp.js +322 -53
  124. package/dist/network/socket-selector.d.ts +109 -15
  125. package/dist/network/socket-selector.js +103 -14
  126. package/dist/network/socket.d.ts +245 -33
  127. package/dist/network/socket.js +205 -28
  128. package/dist/network/tcp-listener.d.ts +91 -13
  129. package/dist/network/tcp-listener.js +85 -12
  130. package/dist/network/tcp-socket.d.ts +232 -33
  131. package/dist/network/tcp-socket.js +153 -22
  132. package/dist/network/tls-material.d.ts +18 -2
  133. package/dist/network/tls-material.js +18 -2
  134. package/dist/network/udp-socket.d.ts +137 -19
  135. package/dist/network/udp-socket.js +101 -13
  136. package/dist/system/angle.d.ts +60 -10
  137. package/dist/system/angle.js +60 -10
  138. package/dist/system/clock.d.ts +51 -8
  139. package/dist/system/clock.js +51 -8
  140. package/dist/system/err.d.ts +14 -2
  141. package/dist/system/err.js +14 -2
  142. package/dist/system/error.d.ts +12 -2
  143. package/dist/system/error.js +12 -2
  144. package/dist/system/file-input-stream.d.ts +54 -7
  145. package/dist/system/file-input-stream.js +54 -7
  146. package/dist/system/input-stream.d.ts +97 -13
  147. package/dist/system/input-stream.js +60 -8
  148. package/dist/system/operators.d.ts +146 -19
  149. package/dist/system/operators.js +118 -15
  150. package/dist/system/sleep.d.ts +6 -1
  151. package/dist/system/sleep.js +6 -1
  152. package/dist/system/suspend-aware-clock.d.ts +18 -3
  153. package/dist/system/suspend-aware-clock.js +18 -3
  154. package/dist/system/time.d.ts +81 -12
  155. package/dist/system/time.js +63 -9
  156. package/dist/system/timeout-with-predicate.d.ts +48 -7
  157. package/dist/system/timeout-with-predicate.js +20 -3
  158. package/dist/system/unicode.d.ts +42 -6
  159. package/dist/system/unicode.js +42 -6
  160. package/dist/system/vector2.d.ts +240 -36
  161. package/dist/system/vector2.js +105 -16
  162. package/dist/system/vector3.d.ts +197 -31
  163. package/dist/system/vector3.js +104 -16
  164. package/dist/system/version.d.ts +43 -7
  165. package/dist/system/version.js +7 -1
  166. package/dist/window/clipboard.d.ts +12 -2
  167. package/dist/window/clipboard.js +12 -2
  168. package/dist/window/context-settings.d.ts +78 -13
  169. package/dist/window/context-settings.js +30 -5
  170. package/dist/window/context.d.ts +70 -10
  171. package/dist/window/context.js +52 -7
  172. package/dist/window/cursor.d.ts +44 -6
  173. package/dist/window/cursor.js +28 -4
  174. package/dist/window/event.d.ts +423 -70
  175. package/dist/window/event.js +36 -6
  176. package/dist/window/gen/constants.d.ts +1890 -314
  177. package/dist/window/gen/constants.js +1890 -314
  178. package/dist/window/joystick.d.ts +67 -11
  179. package/dist/window/joystick.js +43 -7
  180. package/dist/window/keyboard.d.ts +42 -6
  181. package/dist/window/keyboard.js +26 -4
  182. package/dist/window/mouse.d.ts +24 -3
  183. package/dist/window/mouse.js +24 -3
  184. package/dist/window/sensor.d.ts +20 -3
  185. package/dist/window/sensor.js +20 -3
  186. package/dist/window/touch.d.ts +19 -4
  187. package/dist/window/touch.js +19 -4
  188. package/dist/window/video-mode.d.ts +61 -10
  189. package/dist/window/video-mode.js +36 -6
  190. package/dist/window/vulkan.d.ts +26 -3
  191. package/dist/window/vulkan.js +26 -3
  192. package/dist/window/window.d.ts +296 -44
  193. package/dist/window/window.js +241 -34
  194. package/docs/README.ja.md +30 -0
  195. package/docs/README.ko.md +30 -0
  196. package/docs/README.md +30 -0
  197. package/docs/README.zh-CN.md +30 -0
  198. package/docs/api.ja.md +84 -0
  199. package/docs/api.ko.md +84 -0
  200. package/docs/api.md +48 -1080
  201. package/docs/api.zh-CN.md +81 -0
  202. package/docs/audio.ja.md +249 -0
  203. package/docs/audio.ko.md +251 -0
  204. package/docs/audio.md +132 -92
  205. package/docs/audio.zh-CN.md +252 -0
  206. package/docs/concepts.ja.md +130 -0
  207. package/docs/concepts.ko.md +130 -0
  208. package/docs/concepts.md +131 -0
  209. package/docs/concepts.zh-CN.md +131 -0
  210. package/docs/development.ja.md +144 -0
  211. package/docs/development.ko.md +144 -0
  212. package/docs/development.md +112 -43
  213. package/docs/development.zh-CN.md +146 -0
  214. package/docs/getting-started.ja.md +154 -0
  215. package/docs/getting-started.ko.md +154 -0
  216. package/docs/getting-started.md +156 -0
  217. package/docs/getting-started.zh-CN.md +156 -0
  218. package/docs/graphics.ja.md +256 -0
  219. package/docs/graphics.ko.md +254 -0
  220. package/docs/graphics.md +255 -0
  221. package/docs/graphics.zh-CN.md +257 -0
  222. package/docs/network.ja.md +214 -0
  223. package/docs/network.ko.md +216 -0
  224. package/docs/network.md +133 -84
  225. package/docs/network.zh-CN.md +218 -0
  226. package/docs/system.ja.md +169 -0
  227. package/docs/system.ko.md +171 -0
  228. package/docs/system.md +173 -0
  229. package/docs/system.zh-CN.md +173 -0
  230. package/docs/window.ja.md +138 -0
  231. package/docs/window.ko.md +140 -0
  232. package/docs/window.md +141 -0
  233. package/docs/window.zh-CN.md +141 -0
  234. package/native/shared-handle.h +41 -3
  235. package/package.json +17 -6
  236. package/src/audio/effect-processor.ts +53 -8
  237. package/src/audio/input-sound-file.ts +101 -15
  238. package/src/audio/listener.ts +74 -12
  239. package/src/audio/music.ts +191 -25
  240. package/src/audio/output-sound-file.ts +36 -4
  241. package/src/audio/playback-device.ts +103 -17
  242. package/src/audio/sound-buffer-recorder.ts +89 -9
  243. package/src/audio/sound-buffer.ts +121 -16
  244. package/src/audio/sound-file-factory.ts +84 -11
  245. package/src/audio/sound-file-reader.ts +155 -24
  246. package/src/audio/sound-file-writer.ts +49 -7
  247. package/src/audio/sound-recorder.ts +155 -20
  248. package/src/audio/sound-source.ts +273 -45
  249. package/src/audio/sound-stream.ts +57 -9
  250. package/src/audio/sound.ts +32 -5
  251. package/src/audio/value.ts +291 -48
  252. package/src/audio/worker.ts +256 -38
  253. package/src/graphics/blend-mode.ts +199 -33
  254. package/src/graphics/boolean-vector.ts +102 -16
  255. package/src/graphics/circle-shape.ts +68 -11
  256. package/src/graphics/color.ts +227 -42
  257. package/src/graphics/convex-shape.ts +45 -7
  258. package/src/graphics/drawable.ts +15 -2
  259. package/src/graphics/font.ts +153 -24
  260. package/src/graphics/glsl-matrix.ts +44 -7
  261. package/src/graphics/glsl.ts +129 -21
  262. package/src/graphics/glyph.ts +106 -17
  263. package/src/graphics/image.ts +159 -24
  264. package/src/graphics/primitive-type.ts +42 -7
  265. package/src/graphics/rect.ts +162 -26
  266. package/src/graphics/rectangle-shape.ts +44 -7
  267. package/src/graphics/render-states.ts +153 -25
  268. package/src/graphics/render-target.ts +145 -22
  269. package/src/graphics/render-texture.ts +100 -16
  270. package/src/graphics/render-window.ts +113 -18
  271. package/src/graphics/shader.ts +153 -24
  272. package/src/graphics/shape.ts +133 -21
  273. package/src/graphics/sprite.ts +71 -11
  274. package/src/graphics/stencil-mode.ts +193 -32
  275. package/src/graphics/swap.ts +13 -2
  276. package/src/graphics/text.ts +624 -103
  277. package/src/graphics/texture.ts +209 -32
  278. package/src/graphics/transform.ts +93 -14
  279. package/src/graphics/transformable.ts +13 -2
  280. package/src/graphics/vertex-array.ts +83 -14
  281. package/src/graphics/vertex-buffer.ts +162 -26
  282. package/src/graphics/vertex.ts +83 -14
  283. package/src/graphics/view.ts +140 -22
  284. package/src/internal/glsl-value.ts +30 -5
  285. package/src/internal/scalar.ts +9 -1
  286. package/src/internal/transformable.ts +84 -13
  287. package/src/internal/value-storage.ts +8 -1
  288. package/src/network/common.ts +6 -1
  289. package/src/network/dns.ts +103 -14
  290. package/src/network/ftp.ts +217 -33
  291. package/src/network/gen/constants.ts +750 -124
  292. package/src/network/http.ts +365 -57
  293. package/src/network/ip-address.ts +179 -26
  294. package/src/network/packet.ts +200 -29
  295. package/src/network/sftp.ts +525 -84
  296. package/src/network/socket-selector.ts +109 -15
  297. package/src/network/socket.ts +245 -33
  298. package/src/network/tcp-listener.ts +91 -13
  299. package/src/network/tcp-socket.ts +232 -33
  300. package/src/network/tls-material.ts +18 -2
  301. package/src/network/udp-socket.ts +137 -19
  302. package/src/system/angle.ts +60 -10
  303. package/src/system/clock.ts +51 -8
  304. package/src/system/err.ts +14 -2
  305. package/src/system/error.ts +12 -2
  306. package/src/system/file-input-stream.ts +54 -7
  307. package/src/system/input-stream.ts +97 -13
  308. package/src/system/operators.ts +146 -19
  309. package/src/system/sleep.ts +6 -1
  310. package/src/system/suspend-aware-clock.ts +18 -3
  311. package/src/system/time.ts +81 -12
  312. package/src/system/timeout-with-predicate.ts +48 -7
  313. package/src/system/unicode.ts +42 -6
  314. package/src/system/vector2.ts +240 -36
  315. package/src/system/vector3.ts +197 -31
  316. package/src/system/version.ts +43 -7
  317. package/src/window/clipboard.ts +12 -2
  318. package/src/window/context-settings.ts +78 -13
  319. package/src/window/context.ts +70 -10
  320. package/src/window/cursor.ts +44 -6
  321. package/src/window/event.ts +423 -70
  322. package/src/window/gen/constants.ts +1890 -314
  323. package/src/window/joystick.ts +67 -11
  324. package/src/window/keyboard.ts +42 -6
  325. package/src/window/mouse.ts +24 -3
  326. package/src/window/sensor.ts +20 -3
  327. package/src/window/touch.ts +19 -4
  328. package/src/window/video-mode.ts +61 -10
  329. package/src/window/vulkan.ts +26 -3
  330. package/src/window/window.ts +314 -46
  331. package/tools/constant-docs.cjs +109 -0
  332. package/tools/constant-docs.json +1318 -0
  333. package/tools/generate-network-constants.cjs +21 -9
  334. package/tools/generate-window-constants.cjs +26 -12
@@ -13,43 +13,106 @@ const constants_1 = require("./gen/constants");
13
13
  var constants_2 = require("./gen/constants");
14
14
  Object.defineProperty(exports, "FtpStatus", { enumerable: true, get: function () { return constants_2.FtpStatus; } });
15
15
  Object.defineProperty(exports, "TransferMode", { enumerable: true, get: function () { return constants_2.TransferMode; } });
16
- /** FTP 状态码和服务端消息。 */
16
+ /**
17
+ * FTP status code and server message.
18
+ * @zh FTP 状态码和服务端消息。
19
+ * @ja FTP 状態コードとサーバーメッセージ。
20
+ * @ko FTP 상태 코드와 서버 메시지.
21
+ */
17
22
  class FtpResponse {
18
- /** 创建响应,默认状态为 InvalidResponse。 */
23
+ /**
24
+ * Create a response with InvalidResponse as the default status.
25
+ * @zh 创建响应,默认状态为 InvalidResponse。
26
+ * @ja レスポンスを作成します。既定の状態は InvalidResponse です。
27
+ * @ko 응답을 생성하며 기본 상태는 InvalidResponse입니다.
28
+ */
19
29
  constructor(status = constants_1.FtpStatus.InvalidResponse, message = '') {
20
30
  this.status = status;
21
31
  this.message = message;
22
32
  }
23
- /** 返回状态码是否小于 400,包含成功和需后续操作的响应。 */
33
+ /**
34
+ * Return whether the status code is below 400, including success
35
+ * and responses requiring further action.
36
+ * @zh 返回状态码是否小于 400,包含成功和需后续操作的响应。
37
+ * @ja 状態コードが 400 未満かどうかを返します。
38
+ * 成功と追加操作が必要なレスポンスを含みます。
39
+ * @ko 상태 코드가 400 미만인지 반환하며,
40
+ * 성공 및 추가 작업이 필요한 응답을 포함합니다.
41
+ */
24
42
  isOk() { return this.status < 400; }
25
- /** 返回响应状态码。 */
43
+ /**
44
+ * Return the response status code.
45
+ * @zh 返回响应状态码。
46
+ * @ja レスポンスの状態コードを返します。
47
+ * @ko 응답 상태 코드를 반환합니다.
48
+ */
26
49
  getStatus() { return this.status; }
27
- /** 返回服务端或客户端错误消息。 */
50
+ /**
51
+ * Return the server or client error message.
52
+ * @zh 返回服务端或客户端错误消息。
53
+ * @ja サーバーまたはクライアントのエラーメッセージを返します。
54
+ * @ko 서버 또는 클라이언트 오류 메시지를 반환합니다.
55
+ */
28
56
  getMessage() { return this.message; }
29
57
  }
30
- /** FTP 状态码枚举。 */
58
+ /**
59
+ * FTP status code enumeration.
60
+ * @zh FTP 状态码枚举。
61
+ * @ja FTP 状態コードの列挙型。
62
+ * @ko FTP 상태 코드 열거형.
63
+ */
31
64
  FtpResponse.Status = constants_1.FtpStatus;
32
65
  exports.FtpResponse = FtpResponse;
33
- /** 带工作目录路径的 FTP 响应。 */
66
+ /**
67
+ * FTP response containing a working directory path.
68
+ * @zh 带工作目录路径的 FTP 响应。
69
+ * @ja 作業ディレクトリのパスを含む FTP レスポンス。
70
+ * @ko 작업 디렉터리 경로를 포함하는 FTP 응답.
71
+ */
34
72
  class FtpDirectoryResponse extends FtpResponse {
35
- /** 从响应消息中解析双引号包围的目录路径。 */
73
+ /**
74
+ * Parse a double-quoted directory path from the response message.
75
+ * @zh 从响应消息中解析双引号包围的目录路径。
76
+ * @ja レスポンスメッセージから二重引用符で囲まれたディレクトリパスを解析します。
77
+ * @ko 응답 메시지에서 큰따옴표로 둘러싸인 디렉터리 경로를 파싱합니다.
78
+ */
36
79
  constructor(response) {
37
80
  super(response.getStatus(), response.getMessage());
38
81
  this.directory = response.getMessage().match(/"((?:[^"]|"")*)"/)?.[1]
39
82
  .replace(/""/g, '"') ?? '';
40
83
  }
41
- /** 返回解析到的目录路径,未解析到时为空字符串。 */
84
+ /**
85
+ * Return the parsed directory path, or an empty string if none was parsed.
86
+ * @zh 返回解析到的目录路径,未解析到时为空字符串。
87
+ * @ja 解析したディレクトリパスを返します。解析できなければ空文字列です。
88
+ * @ko 파싱한 디렉터리 경로를 반환하며 파싱하지 못했으면 빈 문자열입니다.
89
+ */
42
90
  getDirectory() { return this.directory; }
43
91
  }
44
92
  exports.FtpDirectoryResponse = FtpDirectoryResponse;
45
- /** 带目录条目名称的 FTP 响应。 */
93
+ /**
94
+ * FTP response containing directory entry names.
95
+ * @zh 带目录条目名称的 FTP 响应。
96
+ * @ja ディレクトリエントリー名を含む FTP レスポンス。
97
+ * @ko 디렉터리 항목 이름을 포함하는 FTP 응답.
98
+ */
46
99
  class FtpListingResponse extends FtpResponse {
47
- /** 从 FTP 响应和换行分隔的 NLST 内容创建列表。 */
100
+ /**
101
+ * Create a listing from an FTP response and newline-separated NLST contents.
102
+ * @zh 从 FTP 响应和换行分隔的 NLST 内容创建列表。
103
+ * @ja FTP レスポンスと改行区切りの NLST 内容から一覧を作成します。
104
+ * @ko FTP 응답과 줄바꿈으로 구분된 NLST 내용으로 목록을 생성합니다.
105
+ */
48
106
  constructor(response, data = '') {
49
107
  super(response.getStatus(), response.getMessage());
50
108
  this.listing = data.split(/\r?\n/).filter(Boolean);
51
109
  }
52
- /** 返回目录条目名称的只读类型数组。 */
110
+ /**
111
+ * Return an array of directory entry names with a readonly type.
112
+ * @zh 返回目录条目名称的只读类型数组。
113
+ * @ja ディレクトリエントリー名の読み取り専用型の配列を返します。
114
+ * @ko 디렉터리 항목 이름을 읽기 전용 타입의 배열로 반환합니다.
115
+ */
53
116
  getListing() { return this.listing; }
54
117
  }
55
118
  exports.FtpListingResponse = FtpListingResponse;
@@ -70,13 +133,27 @@ function failure(error) {
70
133
  return new FtpResponse(localFile ? constants_1.FtpStatus.InvalidFile
71
134
  : constants_1.FtpStatus.ConnectionClosed, value.message ?? String(error));
72
135
  }
73
- /** 基于 basic-ftp 的 FTP 客户端,操作通过队列按调用顺序执行。 */
136
+ /**
137
+ * FTP client based on basic-ftp; queued operations run in call order.
138
+ * @zh 基于 basic-ftp 的 FTP 客户端,操作通过队列按调用顺序执行。
139
+ * @ja basic-ftp ベースの FTP クライアント。キューで操作を呼び出し順に実行します。
140
+ * @ko basic-ftp 기반 FTP 클라이언트. 작업은 큐를 통해 호출 순서대로 실행됩니다.
141
+ */
74
142
  class Ftp {
75
143
  constructor() {
76
144
  this.client = new basic_ftp_1.Client(0);
77
145
  this.queue = new common_1.SerialQueue();
78
146
  }
79
- /** 异步连接 FTP 服务器,默认端口 21;Time.Zero 不设连接超时,连接后另行 login。 */
147
+ /**
148
+ * Connect to an FTP server asynchronously on port 21 by default.
149
+ * Time.Zero disables the connection timeout; call login separately afterward.
150
+ * @zh 异步连接 FTP 服务器,默认端口 21;Time.Zero 不设连接超时,
151
+ * 连接后另行 login。
152
+ * @ja FTP サーバーに非同期に接続します。既定のポートは 21 です。
153
+ * Time.Zero は接続タイムアウトなしで、接続後に別途 login が必要です。
154
+ * @ko FTP 서버에 비동기로 연결하며 기본 포트는 21입니다.
155
+ * Time.Zero는 연결 제한 시간이 없으며 연결 후 별도로 login해야 합니다.
156
+ */
80
157
  connect(server, port = 21, timeout = time_1.Time.Zero) {
81
158
  if (!(server instanceof ip_address_1.IpAddress))
82
159
  throw new TypeError('Expected IpAddress');
@@ -100,7 +177,12 @@ class Ftp {
100
177
  }
101
178
  });
102
179
  }
103
- /** 按队列顺序发送 QUIT 并关闭连接。 */
180
+ /**
181
+ * Send QUIT in queue order and close the connection.
182
+ * @zh 按队列顺序发送 QUIT 并关闭连接。
183
+ * @ja キューの順序で QUIT を送信し、接続を閉じます。
184
+ * @ko 큐 순서대로 QUIT를 보내고 연결을 닫습니다.
185
+ */
104
186
  disconnect() {
105
187
  return this.queue.run(async () => {
106
188
  try {
@@ -114,21 +196,49 @@ class Ftp {
114
196
  }
115
197
  });
116
198
  }
117
- /** Abort any outstanding operation and release both connections. */
199
+ /**
200
+ * Abort any outstanding operation and release both connections.
201
+ * @zh 中止所有未完成操作并释放两条连接。
202
+ * @ja 未完了の操作を中止し、両方の接続を解放します。
203
+ * @ko 미완료 작업을 중단하고 두 연결을 모두 해제합니다.
204
+ */
118
205
  close() { this.client.close(); }
119
- /** 异步登录,省略参数时使用匿名账号。 */
206
+ /**
207
+ * Log in asynchronously; omitted arguments use an anonymous account.
208
+ * @zh 异步登录,省略参数时使用匿名账号。
209
+ * @ja 非同期にログインします。引数を省略すると匿名アカウントを使います。
210
+ * @ko 비동기로 로그인하며 인수를 생략하면 익명 계정을 사용합니다.
211
+ */
120
212
  login(name = 'anonymous', password = 'user@sfml-dev.org') {
121
213
  commandPart(name);
122
214
  commandPart(password);
123
215
  return this.run(() => this.client.login(name, password));
124
216
  }
125
- /** 发送 NOOP 保持连接活跃。 */
217
+ /**
218
+ * Send NOOP to keep the connection alive.
219
+ * @zh 发送 NOOP 保持连接活跃。
220
+ * @ja NOOP を送信して接続を維持します。
221
+ * @ko NOOP를 보내 연결을 유지합니다.
222
+ */
126
223
  keepAlive() { return this.sendCommand('NOOP'); }
127
- /** 查询服务器当前工作目录。 */
224
+ /**
225
+ * Query the server's current working directory.
226
+ * @zh 查询服务器当前工作目录。
227
+ * @ja サーバーの現在の作業ディレクトリを照会します。
228
+ * @ko 서버의 현재 작업 디렉터리를 조회합니다.
229
+ */
128
230
  async getWorkingDirectory() {
129
231
  return new FtpDirectoryResponse(await this.sendCommand('PWD'));
130
232
  }
131
- /** 通过 NLST 获取目录名称列表,默认当前目录,列表数据上限为 8 MiB。 */
233
+ /**
234
+ * Retrieve directory entry names using NLST, defaulting to the current
235
+ * directory; listing data is limited to 8 MiB.
236
+ * @zh 通过 NLST 获取目录名称列表,默认当前目录,列表数据上限为 8 MiB。
237
+ * @ja NLST で名前の一覧を取得します。既定は現在のディレクトリで、
238
+ * 一覧データの上限は 8 MiB です。
239
+ * @ko NLST로 디렉터리 항목 이름 목록을 가져옵니다. 기본값은 현재 디렉터리이며,
240
+ * 목록 데이터 제한은 8 MiB입니다.
241
+ */
132
242
  getDirectoryListing(directory = '') {
133
243
  commandPart(directory);
134
244
  return this.queue.run(async () => {
@@ -161,31 +271,69 @@ class Ftp {
161
271
  }
162
272
  });
163
273
  }
164
- /** 切换服务器当前工作目录。 */
274
+ /**
275
+ * Change the server's current working directory.
276
+ * @zh 切换服务器当前工作目录。
277
+ * @ja サーバーの現在の作業ディレクトリを変更します。
278
+ * @ko 서버의 현재 작업 디렉터리를 변경합니다.
279
+ */
165
280
  changeDirectory(path) {
166
281
  return this.sendCommand('CWD', path);
167
282
  }
168
- /** 切换到服务器当前目录的上一级。 */
283
+ /**
284
+ * Change to the parent of the server's current directory.
285
+ * @zh 切换到服务器当前目录的上一级。
286
+ * @ja サーバーの現在のディレクトリの親に移動します。
287
+ * @ko 서버의 현재 디렉터리에서 상위 디렉터리로 이동합니다.
288
+ */
169
289
  parentDirectory() { return this.sendCommand('CDUP'); }
170
- /** 创建远端目录。 */
290
+ /**
291
+ * Create a remote directory.
292
+ * @zh 创建远端目录。
293
+ * @ja リモートディレクトリを作成します。
294
+ * @ko 원격 디렉터리를 생성합니다.
295
+ */
171
296
  createDirectory(path) {
172
297
  return this.sendCommand('MKD', path);
173
298
  }
174
- /** 删除远端目录,通常要求目录为空。 */
299
+ /**
300
+ * Delete a remote directory, which usually must be empty.
301
+ * @zh 删除远端目录,通常要求目录为空。
302
+ * @ja リモートディレクトリを削除します。通常は空である必要があります。
303
+ * @ko 원격 디렉터리를 삭제하며 일반적으로 비어 있어야 합니다.
304
+ */
175
305
  deleteDirectory(path) {
176
306
  return this.sendCommand('RMD', path);
177
307
  }
178
- /** 将远端文件或目录从 path 重命名为 newPath。 */
308
+ /**
309
+ * Rename a remote file or directory from path to newPath.
310
+ * @zh 将远端文件或目录从 path 重命名为 newPath。
311
+ * @ja リモートファイルまたはディレクトリを path から newPath に改名します。
312
+ * @ko 원격 파일 또는 디렉터리 이름을 path에서 newPath로 변경합니다.
313
+ */
179
314
  renameFile(path, newPath) {
180
315
  commandPart(path);
181
316
  commandPart(newPath);
182
317
  return this.run(() => this.client.rename(path, newPath));
183
318
  }
184
- /** 删除远端文件。 */
319
+ /**
320
+ * Delete a remote file.
321
+ * @zh 删除远端文件。
322
+ * @ja リモートファイルを削除します。
323
+ * @ko 원격 파일을 삭제합니다.
324
+ */
185
325
  deleteFile(path) {
186
326
  return this.sendCommand('DELE', path);
187
327
  }
188
- /** 下载远端文件到本地目录 localPath,保留源文件名,默认二进制传输。 */
328
+ /**
329
+ * Download a remote file to local directory localPath, retaining the source
330
+ * filename; use binary transfer by default.
331
+ * @zh 下载远端文件到本地目录 localPath,保留源文件名,默认二进制传输。
332
+ * @ja 元のファイル名を保ち、リモートファイルをローカルディレクトリ localPath に
333
+ * ダウンロードします。既定ではバイナリ転送です。
334
+ * @ko 원본 파일 이름을 유지하여 원격 파일을 로컬 디렉터리 localPath에
335
+ * 다운로드합니다. 기본적으로 바이너리 전송을 사용합니다.
336
+ */
189
337
  download(remoteFile, localPath, mode = constants_1.TransferMode.Binary) {
190
338
  commandPart(remoteFile);
191
339
  (0, common_1.uint)(mode, 2);
@@ -194,7 +342,15 @@ class Ftp {
194
342
  return this.client.downloadTo((0, node_path_1.join)(localPath, node_path_1.posix.basename(remoteFile)), remoteFile);
195
343
  });
196
344
  }
197
- /** 上传本地文件到远端目录,保留文件名;append 为 true 时追加,默认覆盖。 */
345
+ /**
346
+ * Upload a local file to a remote directory, retaining its filename;
347
+ * append when append is true, otherwise overwrite by default.
348
+ * @zh 上传本地文件到远端目录,保留文件名;append 为 true 时追加,默认覆盖。
349
+ * @ja ファイル名を保ち、ローカルファイルをリモートディレクトリにアップロードします。
350
+ * append が true なら追記し、既定では上書きします。
351
+ * @ko 파일 이름을 유지하여 로컬 파일을 원격 디렉터리에 업로드합니다.
352
+ * append가 true이면 추가하며 기본적으로 덮어씁니다.
353
+ */
198
354
  upload(localFile, remotePath, mode = constants_1.TransferMode.Binary, append = false) {
199
355
  commandPart(remotePath);
200
356
  (0, common_1.uint)(mode, 2);
@@ -205,7 +361,15 @@ class Ftp {
205
361
  : this.client.uploadFrom(localFile, target);
206
362
  });
207
363
  }
208
- /** 按队列顺序发送原始 FTP 命令及参数,参数不得含换行或空字节。 */
364
+ /**
365
+ * Send raw FTP commands and arguments in queue order;
366
+ * arguments must not contain newlines or null bytes.
367
+ * @zh 按队列顺序发送原始 FTP 命令及参数,参数不得含换行或空字节。
368
+ * @ja 生の FTP コマンドと引数をキュー順に送信します。
369
+ * 引数に改行やヌルバイトを含めてはなりません。
370
+ * @ko 원시 FTP 명령과 인수를 큐 순서대로 보냅니다.
371
+ * 인수에 줄바꿈이나 널 바이트가 포함되면 안 됩니다.
372
+ */
209
373
  sendCommand(command, parameter = '') {
210
374
  commandPart(command);
211
375
  commandPart(parameter);
@@ -222,12 +386,32 @@ class Ftp {
222
386
  });
223
387
  }
224
388
  }
225
- /** 基本 FTP 响应类型。 */
389
+ /**
390
+ * Basic FTP response type.
391
+ * @zh 基本 FTP 响应类型。
392
+ * @ja 基本 FTP レスポンス型。
393
+ * @ko 기본 FTP 응답 타입.
394
+ */
226
395
  Ftp.Response = FtpResponse;
227
- /** 工作目录响应类型。 */
396
+ /**
397
+ * Working directory response type.
398
+ * @zh 工作目录响应类型。
399
+ * @ja 作業ディレクトリレスポンス型。
400
+ * @ko 작업 디렉터리 응답 타입.
401
+ */
228
402
  Ftp.DirectoryResponse = FtpDirectoryResponse;
229
- /** 目录列表响应类型。 */
403
+ /**
404
+ * Directory listing response type.
405
+ * @zh 目录列表响应类型。
406
+ * @ja ディレクトリ一覧レスポンス型。
407
+ * @ko 디렉터리 목록 응답 타입.
408
+ */
230
409
  Ftp.ListingResponse = FtpListingResponse;
231
- /** 文件传输模式枚举。 */
410
+ /**
411
+ * File transfer mode enumeration.
412
+ * @zh 文件传输模式枚举。
413
+ * @ja ファイル転送モードの列挙型。
414
+ * @ko 파일 전송 모드 열거형.
415
+ */
232
416
  Ftp.TransferMode = constants_1.TransferMode;
233
417
  exports.Ftp = Ftp;