imapflow 1.7.7 → 2.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 (296) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +8 -2
  3. package/dist/cjs/charsets.d.ts +1 -0
  4. package/dist/cjs/charsets.js +294 -0
  5. package/dist/cjs/commands/append.d.ts +22 -0
  6. package/dist/cjs/commands/append.js +151 -0
  7. package/dist/cjs/commands/authenticate.d.ts +24 -0
  8. package/dist/cjs/commands/authenticate.js +223 -0
  9. package/dist/cjs/commands/capability.d.ts +8 -0
  10. package/dist/cjs/commands/capability.js +32 -0
  11. package/dist/cjs/commands/close.d.ts +8 -0
  12. package/dist/cjs/commands/close.js +39 -0
  13. package/dist/cjs/commands/compress.d.ts +8 -0
  14. package/dist/cjs/commands/compress.js +56 -0
  15. package/dist/cjs/commands/copy.d.ts +13 -0
  16. package/dist/cjs/commands/copy.js +44 -0
  17. package/dist/cjs/commands/copyuid-parser.d.ts +11 -0
  18. package/dist/cjs/commands/copyuid-parser.js +32 -0
  19. package/dist/cjs/commands/create.d.ts +11 -0
  20. package/dist/cjs/commands/create.js +80 -0
  21. package/dist/cjs/commands/delete.d.ts +11 -0
  22. package/dist/cjs/commands/delete.js +40 -0
  23. package/dist/cjs/commands/enable.d.ts +9 -0
  24. package/dist/cjs/commands/enable.js +61 -0
  25. package/dist/cjs/commands/esearch-parser.d.ts +17 -0
  26. package/dist/cjs/commands/esearch-parser.js +91 -0
  27. package/dist/cjs/commands/expunge.d.ts +12 -0
  28. package/dist/cjs/commands/expunge.js +60 -0
  29. package/dist/cjs/commands/fetch.d.ts +30 -0
  30. package/dist/cjs/commands/fetch.js +241 -0
  31. package/dist/cjs/commands/id.d.ts +10 -0
  32. package/dist/cjs/commands/id.js +80 -0
  33. package/dist/cjs/commands/idle.d.ts +9 -0
  34. package/dist/cjs/commands/idle.js +347 -0
  35. package/dist/cjs/commands/list.d.ts +16 -0
  36. package/dist/cjs/commands/list.js +518 -0
  37. package/dist/cjs/commands/login.d.ts +11 -0
  38. package/dist/cjs/commands/login.js +42 -0
  39. package/dist/cjs/commands/logout.d.ts +8 -0
  40. package/dist/cjs/commands/logout.js +47 -0
  41. package/dist/cjs/commands/move.d.ts +13 -0
  42. package/dist/cjs/commands/move.js +57 -0
  43. package/dist/cjs/commands/namespace.d.ts +25 -0
  44. package/dist/cjs/commands/namespace.js +139 -0
  45. package/dist/cjs/commands/noop.d.ts +8 -0
  46. package/dist/cjs/commands/noop.js +22 -0
  47. package/dist/cjs/commands/quota.d.ts +10 -0
  48. package/dist/cjs/commands/quota.js +119 -0
  49. package/dist/cjs/commands/rename.d.ts +12 -0
  50. package/dist/cjs/commands/rename.js +48 -0
  51. package/dist/cjs/commands/search.d.ts +15 -0
  52. package/dist/cjs/commands/search.js +228 -0
  53. package/dist/cjs/commands/select.d.ts +25 -0
  54. package/dist/cjs/commands/select.js +250 -0
  55. package/dist/cjs/commands/starttls.d.ts +8 -0
  56. package/dist/cjs/commands/starttls.js +30 -0
  57. package/dist/cjs/commands/status-fields.d.ts +14 -0
  58. package/dist/cjs/commands/status-fields.js +61 -0
  59. package/dist/cjs/commands/status.d.ts +12 -0
  60. package/dist/cjs/commands/status.js +108 -0
  61. package/dist/cjs/commands/store.d.ts +19 -0
  62. package/dist/cjs/commands/store.js +93 -0
  63. package/dist/cjs/commands/subscribe.d.ts +9 -0
  64. package/dist/cjs/commands/subscribe.js +31 -0
  65. package/dist/cjs/commands/unsubscribe.d.ts +9 -0
  66. package/dist/cjs/commands/unsubscribe.js +31 -0
  67. package/dist/cjs/connection-deadline.d.ts +49 -0
  68. package/dist/cjs/connection-deadline.js +91 -0
  69. package/dist/cjs/errors.d.ts +83 -0
  70. package/dist/cjs/errors.js +13 -0
  71. package/dist/cjs/handler/imap-compiler.d.ts +24 -0
  72. package/dist/cjs/handler/imap-compiler.js +285 -0
  73. package/dist/cjs/handler/imap-formal-syntax.d.ts +28 -0
  74. package/dist/cjs/handler/imap-formal-syntax.js +121 -0
  75. package/dist/cjs/handler/imap-handler.d.ts +9 -0
  76. package/dist/cjs/handler/imap-handler.js +10 -0
  77. package/dist/cjs/handler/imap-parser.d.ts +16 -0
  78. package/dist/cjs/handler/imap-parser.js +90 -0
  79. package/dist/cjs/handler/imap-stream.d.ts +181 -0
  80. package/dist/cjs/handler/imap-stream.js +446 -0
  81. package/dist/cjs/handler/limits.d.ts +25 -0
  82. package/dist/cjs/handler/limits.js +51 -0
  83. package/dist/cjs/handler/parser-instance.d.ts +68 -0
  84. package/dist/cjs/handler/parser-instance.js +223 -0
  85. package/dist/cjs/handler/token-parser.d.ts +91 -0
  86. package/dist/cjs/handler/token-parser.js +673 -0
  87. package/dist/cjs/handler/types.d.ts +91 -0
  88. package/dist/cjs/handler/types.js +4 -0
  89. package/dist/cjs/imap-commands.d.ts +16 -0
  90. package/dist/cjs/imap-commands.js +74 -0
  91. package/dist/cjs/imap-flow.d.ts +676 -0
  92. package/dist/cjs/imap-flow.js +3949 -0
  93. package/dist/cjs/jp-decoder.d.ts +12 -0
  94. package/dist/cjs/jp-decoder.js +79 -0
  95. package/dist/cjs/limited-passthrough.d.ts +25 -0
  96. package/dist/cjs/limited-passthrough.js +54 -0
  97. package/dist/cjs/logger.d.ts +3 -0
  98. package/dist/cjs/logger.js +11 -0
  99. package/dist/cjs/package-info.d.ts +3 -0
  100. package/dist/cjs/package-info.js +7 -0
  101. package/dist/cjs/package.json +3 -0
  102. package/dist/cjs/proxy-connection.d.ts +33 -0
  103. package/dist/cjs/proxy-connection.js +392 -0
  104. package/dist/cjs/search-compiler.d.ts +34 -0
  105. package/dist/cjs/search-compiler.js +476 -0
  106. package/dist/cjs/special-use.d.ts +22 -0
  107. package/dist/cjs/special-use.js +911 -0
  108. package/dist/cjs/tools.d.ts +427 -0
  109. package/dist/cjs/tools.js +1496 -0
  110. package/{lib/imap-flow.d.ts → dist/cjs/types.d.ts} +386 -516
  111. package/dist/cjs/types.js +5 -0
  112. package/dist/esm/charsets.d.ts +1 -0
  113. package/{lib → dist/esm}/charsets.js +1 -6
  114. package/dist/esm/commands/append.d.ts +22 -0
  115. package/{lib → dist/esm}/commands/append.js +22 -52
  116. package/dist/esm/commands/authenticate.d.ts +24 -0
  117. package/{lib → dist/esm}/commands/authenticate.js +62 -87
  118. package/dist/esm/commands/capability.d.ts +8 -0
  119. package/{lib → dist/esm}/commands/capability.js +6 -9
  120. package/dist/esm/commands/close.d.ts +8 -0
  121. package/{lib → dist/esm}/commands/close.js +6 -10
  122. package/dist/esm/commands/compress.d.ts +8 -0
  123. package/{lib → dist/esm}/commands/compress.js +7 -11
  124. package/dist/esm/commands/copy.d.ts +13 -0
  125. package/{lib → dist/esm}/commands/copy.js +12 -20
  126. package/dist/esm/commands/copyuid-parser.d.ts +11 -0
  127. package/{lib → dist/esm}/commands/copyuid-parser.js +9 -15
  128. package/dist/esm/commands/create.d.ts +11 -0
  129. package/{lib → dist/esm}/commands/create.js +13 -27
  130. package/dist/esm/commands/delete.d.ts +11 -0
  131. package/{lib → dist/esm}/commands/delete.js +9 -14
  132. package/dist/esm/commands/enable.d.ts +9 -0
  133. package/{lib → dist/esm}/commands/enable.js +23 -30
  134. package/dist/esm/commands/esearch-parser.d.ts +17 -0
  135. package/dist/esm/commands/esearch-parser.js +88 -0
  136. package/dist/esm/commands/expunge.d.ts +12 -0
  137. package/{lib → dist/esm}/commands/expunge.js +17 -22
  138. package/dist/esm/commands/fetch.d.ts +30 -0
  139. package/{lib → dist/esm}/commands/fetch.js +32 -64
  140. package/dist/esm/commands/id.d.ts +10 -0
  141. package/{lib → dist/esm}/commands/id.js +17 -23
  142. package/dist/esm/commands/idle.d.ts +9 -0
  143. package/{lib → dist/esm}/commands/idle.js +47 -81
  144. package/dist/esm/commands/list.d.ts +16 -0
  145. package/{lib → dist/esm}/commands/list.js +56 -121
  146. package/dist/esm/commands/login.d.ts +11 -0
  147. package/{lib → dist/esm}/commands/login.js +10 -15
  148. package/dist/esm/commands/logout.d.ts +8 -0
  149. package/{lib → dist/esm}/commands/logout.js +9 -11
  150. package/dist/esm/commands/move.d.ts +13 -0
  151. package/{lib → dist/esm}/commands/move.js +13 -21
  152. package/dist/esm/commands/namespace.d.ts +25 -0
  153. package/{lib → dist/esm}/commands/namespace.js +34 -44
  154. package/dist/esm/commands/noop.d.ts +8 -0
  155. package/{lib → dist/esm}/commands/noop.js +6 -7
  156. package/dist/esm/commands/quota.d.ts +10 -0
  157. package/{lib → dist/esm}/commands/quota.js +18 -36
  158. package/dist/esm/commands/rename.d.ts +12 -0
  159. package/{lib → dist/esm}/commands/rename.js +10 -15
  160. package/dist/esm/commands/search.d.ts +15 -0
  161. package/{lib → dist/esm}/commands/search.js +36 -135
  162. package/dist/esm/commands/select.d.ts +25 -0
  163. package/{lib → dist/esm}/commands/select.js +33 -64
  164. package/dist/esm/commands/starttls.d.ts +8 -0
  165. package/{lib → dist/esm}/commands/starttls.js +6 -8
  166. package/dist/esm/commands/status-fields.d.ts +14 -0
  167. package/{lib → dist/esm}/commands/status-fields.js +5 -16
  168. package/dist/esm/commands/status.d.ts +12 -0
  169. package/{lib → dist/esm}/commands/status.js +18 -29
  170. package/dist/esm/commands/store.d.ts +19 -0
  171. package/{lib → dist/esm}/commands/store.js +24 -37
  172. package/dist/esm/commands/subscribe.d.ts +9 -0
  173. package/{lib → dist/esm}/commands/subscribe.js +8 -12
  174. package/dist/esm/commands/unsubscribe.d.ts +9 -0
  175. package/{lib → dist/esm}/commands/unsubscribe.js +8 -12
  176. package/dist/esm/connection-deadline.d.ts +49 -0
  177. package/{lib → dist/esm}/connection-deadline.js +14 -25
  178. package/dist/esm/errors.d.ts +83 -0
  179. package/dist/esm/errors.js +9 -0
  180. package/dist/esm/handler/imap-compiler.d.ts +24 -0
  181. package/{lib → dist/esm}/handler/imap-compiler.js +22 -80
  182. package/dist/esm/handler/imap-formal-syntax.d.ts +28 -0
  183. package/dist/esm/handler/imap-formal-syntax.js +117 -0
  184. package/dist/esm/handler/imap-handler.d.ts +9 -0
  185. package/dist/esm/handler/imap-handler.js +9 -0
  186. package/dist/esm/handler/imap-parser.d.ts +16 -0
  187. package/{lib → dist/esm}/handler/imap-parser.js +31 -44
  188. package/dist/esm/handler/imap-stream.d.ts +181 -0
  189. package/{lib → dist/esm}/handler/imap-stream.js +29 -121
  190. package/dist/esm/handler/limits.d.ts +25 -0
  191. package/{lib → dist/esm}/handler/limits.js +13 -22
  192. package/dist/esm/handler/parser-instance.d.ts +68 -0
  193. package/{lib → dist/esm}/handler/parser-instance.js +19 -47
  194. package/dist/esm/handler/token-parser.d.ts +91 -0
  195. package/{lib → dist/esm}/handler/token-parser.js +71 -155
  196. package/dist/esm/handler/types.d.ts +91 -0
  197. package/dist/esm/handler/types.js +3 -0
  198. package/dist/esm/imap-commands.d.ts +16 -0
  199. package/dist/esm/imap-commands.js +67 -0
  200. package/dist/esm/imap-flow.d.ts +676 -0
  201. package/{lib → dist/esm}/imap-flow.js +785 -1802
  202. package/dist/esm/jp-decoder.d.ts +12 -0
  203. package/{lib → dist/esm}/jp-decoder.js +6 -21
  204. package/dist/esm/limited-passthrough.d.ts +25 -0
  205. package/{lib → dist/esm}/limited-passthrough.js +7 -20
  206. package/dist/esm/logger.d.ts +3 -0
  207. package/dist/esm/logger.js +4 -0
  208. package/dist/esm/package-info.d.ts +3 -0
  209. package/dist/esm/package-info.js +4 -0
  210. package/dist/esm/package.json +3 -0
  211. package/dist/esm/proxy-connection.d.ts +33 -0
  212. package/{lib → dist/esm}/proxy-connection.js +56 -127
  213. package/dist/esm/search-compiler.d.ts +34 -0
  214. package/{lib → dist/esm}/search-compiler.js +54 -110
  215. package/dist/esm/special-use.d.ts +22 -0
  216. package/dist/esm/special-use.js +907 -0
  217. package/dist/esm/tools.d.ts +427 -0
  218. package/dist/esm/tools.js +1446 -0
  219. package/dist/esm/types.d.ts +828 -0
  220. package/dist/esm/types.js +4 -0
  221. package/package.json +60 -20
  222. package/.gitattributes +0 -1
  223. package/.github/CODE_OF_CONDUCT.md +0 -76
  224. package/.github/FUNDING.yml +0 -4
  225. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  226. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -19
  227. package/.github/contributing.md +0 -17
  228. package/.github/workflows/release.yaml +0 -36
  229. package/.github/workflows/stale.yml +0 -29
  230. package/.github/workflows/test.yml +0 -51
  231. package/.ncurc.js +0 -4
  232. package/.prettierignore +0 -4
  233. package/.prettierrc.js +0 -8
  234. package/.release-please-manifest.json +0 -3
  235. package/CLAUDE.md +0 -104
  236. package/Gruntfile.js +0 -23
  237. package/eslint.config.js +0 -45
  238. package/lib/handler/imap-formal-syntax.js +0 -189
  239. package/lib/handler/imap-handler.js +0 -17
  240. package/lib/imap-commands.js +0 -45
  241. package/lib/logger.js +0 -5
  242. package/lib/special-use.js +0 -923
  243. package/lib/tools.js +0 -1612
  244. package/release-please-config.json +0 -10
  245. package/test/authentication-test.js +0 -101
  246. package/test/auto-idle-test.js +0 -470
  247. package/test/bodystructure-test.js +0 -899
  248. package/test/charsets-test.js +0 -161
  249. package/test/commands-branches-test.js +0 -1095
  250. package/test/commands-integration-test.js +0 -11124
  251. package/test/commands-test.js +0 -73
  252. package/test/connection-edge-cases-test.js +0 -1828
  253. package/test/connection-test.js +0 -162
  254. package/test/copyuid-parser-test.js +0 -173
  255. package/test/fetch-generator-test.js +0 -218
  256. package/test/fixtures/fake-timers.js +0 -115
  257. package/test/fixtures/serialized-mimetorture.js +0 -2738
  258. package/test/fixtures/test-client.js +0 -57
  259. package/test/fixtures/test-tls.js +0 -8
  260. package/test/handler-branches-test.js +0 -310
  261. package/test/idle-polling-test.js +0 -518
  262. package/test/imap-compiler-test.js +0 -809
  263. package/test/imap-flow-compress-test.js +0 -166
  264. package/test/imap-flow-coverage-test.js +0 -612
  265. package/test/imap-flow-fetch-download-test.js +0 -873
  266. package/test/imap-flow-internals-test.js +0 -725
  267. package/test/imap-flow-methods-test.js +0 -889
  268. package/test/imap-flow-proxy-paths-test.js +0 -366
  269. package/test/imap-flow-secure-test.js +0 -573
  270. package/test/imap-flow-server-test.js +0 -1474
  271. package/test/imap-formal-syntax-test.js +0 -293
  272. package/test/imap-parser-test.js +0 -1474
  273. package/test/imap-stream-edge-cases-test.js +0 -666
  274. package/test/imap-stream-test.js +0 -177
  275. package/test/imapflow-test.js +0 -258
  276. package/test/integration/README.md +0 -52
  277. package/test/integration/dovecot-test.conf +0 -27
  278. package/test/integration/rev2-live-test.js +0 -431
  279. package/test/integration/run-rev2-tests.sh +0 -75
  280. package/test/integration-test.js +0 -83
  281. package/test/jp-decoder-test.js +0 -304
  282. package/test/limited-passthrough-test.js +0 -299
  283. package/test/memory-cleanup-test.js +0 -144
  284. package/test/memory-leak-test.js +0 -667
  285. package/test/parser-limits-test.js +0 -292
  286. package/test/proxy-connection-test.js +0 -738
  287. package/test/reliability-improvements-test.js +0 -548
  288. package/test/search-compiler-test.js +0 -1300
  289. package/test/search-test.js +0 -329
  290. package/test/special-use-test.js +0 -418
  291. package/test/starttls-injection-test.js +0 -181
  292. package/test/tag-correlation-test.js +0 -333
  293. package/test/timer-policy-test.js +0 -227
  294. package/test/token-parser-test.js +0 -456
  295. package/test/tools-test.js +0 -2013
  296. package/test/unhandled-rejection-test.js +0 -593
@@ -0,0 +1,4 @@
1
+ // Public data shapes of the ImapFlow API. Every optional property is declared with an
2
+ // explicit `| undefined` so that a consumer compiling with exactOptionalPropertyTypes
3
+ // can still pass a value that may be undefined.
4
+ export {};
package/package.json CHANGED
@@ -1,17 +1,56 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.7.7",
3
+ "version": "2.0.0",
4
4
  "description": "IMAP Client for Node",
5
- "main": "lib/imap-flow.js",
6
- "types": "lib/imap-flow.d.ts",
5
+ "type": "module",
6
+ "main": "./dist/cjs/imap-flow.js",
7
+ "types": "./dist/cjs/imap-flow.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "lib/*": [
11
+ "dist/cjs/*.d.ts"
12
+ ]
13
+ }
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/esm/imap-flow.js",
18
+ "require": "./dist/cjs/imap-flow.js"
19
+ },
20
+ "./lib/*.js": {
21
+ "import": "./dist/esm/*.js",
22
+ "require": "./dist/cjs/*.js"
23
+ },
24
+ "./lib/*": {
25
+ "import": "./dist/esm/*.js",
26
+ "require": "./dist/cjs/*.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "CHANGELOG.md",
33
+ "SECURITY.md",
34
+ "SECURITY.txt"
35
+ ],
7
36
  "scripts": {
8
- "test": "grunt",
9
- "coverage": "c8 --reporter=text --reporter=html npx nodeunit test/*-test.js",
37
+ "build": "node scripts/build.js",
38
+ "typecheck": "node scripts/build.js --generate-only && tsc -p tsconfig.json",
39
+ "pretest": "npm run build",
40
+ "test": "node --import tsx --test --test-force-exit --test-concurrency=1 $(find test -name '*-test.ts' -not -path '*/integration/*' -not -path '*/cloudflare/*')",
41
+ "pretest:coverage": "npm run build",
42
+ "test:coverage": "c8 node --import tsx --test --test-force-exit --test-concurrency=1 $(find test -name '*-test.ts' -not -path '*/integration/*' -not -path '*/cloudflare/*')",
43
+ "pretest:bun": "npm run build",
44
+ "test:bun": "bun test --timeout 60000 $(find ./test -name '*-test.ts' -not -path '*/integration/*' -not -path '*/cloudflare/*')",
45
+ "pretest:workers": "npm run build",
46
+ "test:workers": "node --import tsx --test test/cloudflare/cloudflare-test.ts",
10
47
  "test:rev2": "bash test/integration/run-rev2-tests.sh",
11
- "update": "rm -rf node_modules package-lock.json && ncu -u && npm install",
12
- "format": "prettier --write \"**/*.{js,json,md,yml,yaml}\" --ignore-path .prettierignore",
13
- "format:check": "prettier --check \"**/*.{js,json,md,yml,yaml}\" --ignore-path .prettierignore",
14
- "lint": "eslint ."
48
+ "format": "prettier --write \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
49
+ "format:check": "prettier --check \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
50
+ "lint": "eslint . && npm run typecheck",
51
+ "lint:fix": "eslint . --fix",
52
+ "prepare": "npm run build",
53
+ "update": "rm -rf node_modules package-lock.json && ncu -u && npm install"
15
54
  },
16
55
  "repository": {
17
56
  "type": "git",
@@ -29,19 +68,17 @@
29
68
  },
30
69
  "homepage": "https://imapflow.com/",
31
70
  "devDependencies": {
32
- "@eslint/js": "10.0.1",
33
- "@types/node": "26.4.0",
71
+ "@types/node": "20.19.43",
34
72
  "c8": "12.0.0",
35
- "eslint": "10.9.1",
36
- "eslint-config-nodemailer": "1.2.0",
73
+ "eslint": "10.10.0",
37
74
  "eslint-config-prettier": "10.1.8",
38
- "grunt": "1.6.3",
39
- "grunt-cli": "1.5.0",
40
- "grunt-contrib-nodeunit": "5.0.0",
41
- "grunt-eslint": "26.0.0",
75
+ "globals": "17.12.0",
42
76
  "prettier": "3.9.6",
43
- "proxyquire": "^2.1.3",
44
- "typescript": "7.0.2"
77
+ "tsx": "4.23.13",
78
+ "types-node-legacy": "npm:@types/node@20.0.0",
79
+ "typescript": "6.0.3",
80
+ "typescript-eslint": "8.69.0",
81
+ "wrangler": "4.129.0"
45
82
  },
46
83
  "dependencies": {
47
84
  "@zone-eu/mailsplit": "5.4.16",
@@ -51,6 +88,9 @@
51
88
  "libmime": "5.4.3",
52
89
  "libqp": "2.1.1",
53
90
  "pino": "10.3.1",
54
- "socks": "2.8.9"
91
+ "socks": "2.8.10"
92
+ },
93
+ "engines": {
94
+ "node": ">=20.0.0"
55
95
  }
56
96
  }
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- *.js text eol=lf
@@ -1,76 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- - Using welcoming and inclusive language
18
- - Being respectful of differing viewpoints and experiences
19
- - Gracefully accepting constructive criticism
20
- - Focusing on what is best for the community
21
- - Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- - The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- - Trolling, insulting/derogatory comments, and personal or political attacks
28
- - Public or private harassment
29
- - Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- - Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at andris@postalsys.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
-
73
- [homepage]: https://www.contributor-covenant.org
74
-
75
- For answers to common questions about this code of conduct, see
76
- https://www.contributor-covenant.org/faq
@@ -1,4 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [andris9] # enable once enrolled
4
- custom: ['https://www.paypal.me/nodemailer']
@@ -1,40 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
- ---
8
-
9
- **Describe the bug**
10
- A clear and concise description of what the bug is.
11
-
12
- **To Reproduce**
13
- Steps to reproduce the behavior:
14
-
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
-
28
- - OS: [e.g. iOS]
29
- - Browser [e.g. chrome, safari]
30
- - Version [e.g. 22]
31
-
32
- **Smartphone (please complete the following information):**
33
-
34
- - Device: [e.g. iPhone6]
35
- - OS: [e.g. iOS8.1]
36
- - Browser [e.g. stock browser, safari]
37
- - Version [e.g. 22]
38
-
39
- **Additional context**
40
- Add any other context about the problem here.
@@ -1,19 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
- ---
8
-
9
- **Is your feature request related to a problem? Please describe.**
10
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11
-
12
- **Describe the solution you'd like**
13
- A clear and concise description of what you want to happen.
14
-
15
- **Describe alternatives you've considered**
16
- A clear and concise description of any alternative solutions or features you've considered.
17
-
18
- **Additional context**
19
- Add any other context or screenshots about the feature request here.
@@ -1,17 +0,0 @@
1
- # Contributing
2
-
3
- ## Legal
4
-
5
- (agreement below borrowed from [Sidekiq Legal](https://github.com/mperham/sidekiq/blob/master/.github/contributing.md))
6
-
7
- By submitting a Pull Request, you disavow any rights or claims to any changes
8
- submitted to the ImapFlow project and assign the copyright of
9
- those changes to Postal Systems OÜ.
10
-
11
- If you cannot or do not want to reassign those rights (your employment
12
- contract for your employer may not allow this), you should not submit a PR.
13
- Open an issue and someone else can do the work.
14
-
15
- This is a legal way of saying "If you submit a PR to us, that code becomes ours".
16
- 99.9% of the time that's what you intend anyways; we hope it doesn't scare you
17
- away from contributing.
@@ -1,36 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - master
5
-
6
- permissions:
7
- contents: write
8
- pull-requests: write
9
- issues: write
10
- id-token: write
11
-
12
- name: release
13
- jobs:
14
- release-please:
15
- runs-on: ubuntu-latest
16
- outputs:
17
- release_created: ${{ steps.release.outputs.release_created }}
18
- steps:
19
- - uses: googleapis/release-please-action@v4
20
- id: release
21
-
22
- publish:
23
- needs: release-please
24
- if: ${{ needs.release-please.outputs.release_created }}
25
- runs-on: ubuntu-latest
26
- permissions:
27
- contents: read
28
- id-token: write
29
- steps:
30
- - uses: actions/checkout@v6
31
- - uses: actions/setup-node@v6
32
- with:
33
- node-version: 24
34
- registry-url: 'https://registry.npmjs.org'
35
- - run: npm ci
36
- - run: npm publish --provenance --access public
@@ -1,29 +0,0 @@
1
- name: 'Close stale issues and PRs'
2
- on:
3
- schedule:
4
- - cron: '30 1 * * *'
5
-
6
- permissions:
7
- contents: read
8
- issues: write
9
- pull-requests: write
10
-
11
- jobs:
12
- stale:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/stale@v10
16
- with:
17
- stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
18
- stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
19
- close-issue-message: 'This issue was closed because it has been stalled for 15 days with no activity.'
20
- close-pr-message: 'This PR was closed because it has been stalled for 20 days with no activity.'
21
- days-before-issue-stale: 30
22
- days-before-pr-stale: 45
23
- days-before-issue-close: 15
24
- days-before-pr-close: 20
25
- stale-issue-label: 'no-issue-activity'
26
- exempt-issue-labels: 'pending,work-in-progress'
27
- stale-pr-label: 'no-pr-activity'
28
- exempt-pr-labels: 'awaiting-approval,work-in-progress'
29
- repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,51 +0,0 @@
1
- name: Run tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
-
7
- permissions:
8
- contents: read
9
-
10
- concurrency:
11
- group: ${{ github.workflow }}-${{ github.ref }}
12
- cancel-in-progress: true
13
-
14
- jobs:
15
- test:
16
- name: Test (Node ${{ matrix.node }})
17
- timeout-minutes: 10
18
- strategy:
19
- matrix:
20
- node: [22.x, 24.x]
21
- os: [ubuntu-latest]
22
- runs-on: ${{ matrix.os }}
23
- steps:
24
- - uses: actions/checkout@v6
25
- - name: Use Node.js ${{ matrix.node }}
26
- uses: actions/setup-node@v6
27
- with:
28
- node-version: ${{ matrix.node }}
29
- cache: npm
30
- - run: npm install
31
- - run: npm test
32
-
33
- test-rev2:
34
- # Live IMAP4rev2 integration tests against a real Dovecot 2.4 server in
35
- # Docker on linux/amd64 (ubuntu runners are amd64 with Docker preinstalled).
36
- # This is the only place the suite runs on amd64 - Apple Silicon dev
37
- # machines cannot run the amd64 image under Rosetta.
38
- name: Live IMAP4rev2 tests (Dovecot, linux/amd64)
39
- timeout-minutes: 15
40
- runs-on: ubuntu-latest
41
- steps:
42
- - uses: actions/checkout@v6
43
- - name: Use Node.js 24.x
44
- uses: actions/setup-node@v6
45
- with:
46
- node-version: 24.x
47
- cache: npm
48
- - run: npm install
49
- - run: npm run test:rev2
50
- env:
51
- IMAPFLOW_DOVECOT_PLATFORM: linux/amd64
package/.ncurc.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- upgrade: true,
3
- reject: ['grunt-eslint']
4
- };
package/.prettierignore DELETED
@@ -1,4 +0,0 @@
1
- node_modules
2
- package-lock.json
3
- CHANGELOG.md
4
- docs/
package/.prettierrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- printWidth: 160,
3
- tabWidth: 4,
4
- singleQuote: true,
5
- endOfLine: 'lf',
6
- trailingComma: 'none',
7
- arrowParens: 'avoid'
8
- };
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.7.7"
3
- }
package/CLAUDE.md DELETED
@@ -1,104 +0,0 @@
1
- # Claude Development Guidelines
2
-
3
- ## Project Overview
4
-
5
- ImapFlow is a modern, promise-based IMAP client library for Node.js. It opens
6
- TLS/cleartext connections to IMAP servers, authenticates, and parses untrusted
7
- protocol responses from those servers into a friendly API. It is published to
8
- npm as `imapflow` and ships TypeScript type definitions.
9
-
10
- ## Project Structure
11
-
12
- - `lib/imap-flow.js` - Main `ImapFlow` client class (connection lifecycle, command dispatch, public API)
13
- - `lib/imap-flow.d.ts` - TypeScript type definitions (published as `types`)
14
- - `lib/imap-commands.js` - Registry wiring individual command implementations
15
- - `lib/commands/` - Per-command implementations (login, fetch, search, append, etc.)
16
- - `lib/handler/` - IMAP response stream parser and command compiler (tokenizer, literals, line handling)
17
- - `lib/search-compiler.js` - Translates the search query object into IMAP SEARCH terms
18
- - `lib/charsets.js`, `lib/jp-decoder.js` - Charset/encoding helpers
19
- - `lib/special-use.js` - SPECIAL-USE mailbox detection
20
- - `lib/proxy-connection.js` - SOCKS/HTTP proxy connection support
21
- - `lib/limited-passthrough.js`, `lib/tools.js`, `lib/logger.js` - Internal utilities
22
- - `test/` - Unit tests (`*-test.js`), run with nodeunit via Grunt
23
- - `examples/` - Standalone usage examples (not production code)
24
-
25
- ## Technology Stack
26
-
27
- - **Runtime**: Node.js (CI tests on 22.x and 24.x)
28
- - **Module system**: CommonJS (see Packaging Constraints below)
29
- - **Testing**: Grunt + grunt-contrib-nodeunit, ESLint via grunt-eslint
30
- - **Lint/format**: ESLint (`eslint.config.js`, flat config) + Prettier
31
- - **Key dependencies**: `@zone-eu/mailsplit`, `libmime`, `libqp`, `libbase64`, `iconv-lite`, `encoding-japanese`, `pino`, `socks`
32
-
33
- ## Development Commands
34
-
35
- ```
36
- npm test # Run full suite via Grunt (ESLint + nodeunit tests)
37
- npm run coverage # Run tests under c8 coverage (text + html reports)
38
- npm run lint # Lint with ESLint
39
- npm run format # Format with Prettier (js, json, md, yml, yaml)
40
- npm run update # Refresh deps: remove node_modules + lockfile, ncu -u, npm install
41
- npm run test:rev2 # Live IMAP4rev2 tests against Dovecot in Docker (see test/integration/)
42
- ```
43
-
44
- ## Testing
45
-
46
- - Tests live in `test/` and are named `*-test.js`; the Grunt nodeunit glob only matches that pattern, so helpers/fixtures are never run as tests. Exception: `test/integration/` is excluded from the glob - those tests need Docker and run only via `npm run test:rev2`.
47
- - `npm test` runs `grunt`, which runs ESLint first, then the nodeunit suite. Keep the suite green and lint-clean before committing.
48
- - New tests go in `test/` as `*-test.js`. The parser, command compiler, and search compiler are the most security-sensitive areas - add hostile/malformed-input cases there.
49
- - `npm run test:rev2` starts a Dovecot 2.4 container (real IMAP4rev2 server) and runs `test/integration/rev2-live-test.js` against it - use it to verify rev2-facing changes end to end, mocks alone are not enough.
50
-
51
- ## Packaging Constraints (IMPORTANT)
52
-
53
- EmailEngine (see "Relationship to EmailEngine" below) bundles ImapFlow and all
54
- of its transitive dependencies into a single self-contained executable using
55
- [`@yao-pkg/pkg`](https://github.com/yao-pkg/pkg). `pkg` works by snapshotting a
56
- CommonJS `require()` graph, so it **cannot bundle pure-ESM packages**.
57
-
58
- Therefore ImapFlow itself and every dependency it pulls in must stay
59
- CommonJS-compatible:
60
-
61
- - ImapFlow source stays CommonJS (`require`/`module.exports`). Do not convert the library to ESM.
62
- - Do not add a dependency that is pure ESM (`"type": "module"` with only an `import`/ESM entry and no CommonJS export). It must be `require()`-able.
63
- - When `npm run update` or a new dependency would pull in a pure-ESM package (a common outcome of major-version bumps), pin to the last CommonJS-compatible version instead, or find a CommonJS alternative. Verify with a quick `require()` of the package after updating.
64
- - After every `npm run update`, run this check to confirm all production dependencies are still CommonJS (it must print `CJS OK` for every dependency and report no pure-ESM packages), then run `npm test`:
65
-
66
- ```
67
- node -e "Object.keys(require('./package.json').dependencies).forEach(d => { require(d); console.log('CJS OK:', d); })"
68
- node -e "const fs=require('fs');const bad=Object.keys(require('./package.json').dependencies).filter(d=>JSON.parse(fs.readFileSync(require.resolve(d+'/package.json'),'utf8')).type==='module');console.log(bad.length?'PURE-ESM DEPS FOUND: '+bad.join(', '):'No pure-ESM production dependencies')"
69
- ```
70
-
71
- - Keep dynamic `require()` paths static enough for `pkg` to detect; avoid building module paths at runtime in ways the bundler can't trace.
72
-
73
- ## Code Style Rules
74
-
75
- - Never use emojis in code or documentation, only printable ASCII characters.
76
- - Use a single hyphen-minus (`-`) as a dash in user-facing strings and docs. Never use double hyphens (`--`), em dashes, or en dashes.
77
- - When composing git commit messages, do not include Claude as a co-contributor.
78
- - Use Conventional Commit prefixes (`feat:`, `fix:`, `chore:`, `docs:`, `test:`, `ci:`, ...). Versioning and the changelog are driven by these prefixes via release-please.
79
- - For commits that do not change published runtime behavior (docs, comments, CI/workflow tweaks, formatting), append `[skip ci]` to the commit message to avoid triggering the GitHub Actions workflows. Exception: do not add `[skip ci]` to commits using a `fix:` or `feat:` prefix - those must run so the release action is triggered.
80
- - After making code changes:
81
- 1. Run `npm run format` and `npm run lint`
82
- 2. Run `npm test` and keep it green
83
- 3. For non-trivial changes, run `/simplify` to review changed code and `/security-review` to check for security issues before committing
84
- - After pushing, check the GitHub Actions runs for the push (e.g. `gh run list --branch master`) and report their status. If a run fails for a strange or unrelated reason (for example a checkout step reporting "account suspended", HTTP 403, or other auth/infrastructure errors that have nothing to do with the change), check <https://www.githubstatus.com/> for an active GitHub incident before assuming the failure is caused by the change.
85
-
86
- ## Relationship to EmailEngine
87
-
88
- ImapFlow is developed and maintained primarily as the IMAP client used by
89
- [EmailEngine](https://github.com/postalsys/emailengine). The local development
90
- copy of EmailEngine lives at `../emailengine` relative to this project root. When
91
- EmailEngine hits a bug or unhandled promise rejection that originates in
92
- ImapFlow, the fix belongs here in the ImapFlow source rather than as a
93
- workaround in EmailEngine. Because EmailEngine packages this library with
94
- `@yao-pkg/pkg`, never make a change here that breaks CommonJS packaging (see
95
- Packaging Constraints).
96
-
97
- ## Security
98
-
99
- Security policy and private reporting channels are documented in
100
- [`SECURITY.md`](SECURITY.md) / [`SECURITY.txt`](SECURITY.txt).
101
-
102
- ## Release Process
103
-
104
- Changelog and version numbers are managed automatically by the release-please GitHub Action. Do not check for or suggest CHANGELOG entries or version bumps during code reviews.
package/Gruntfile.js DELETED
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = function (grunt) {
4
- // Project configuration.
5
- grunt.initConfig({
6
- eslint: {
7
- all: ['lib/**/*.js', 'test/**/*.js', 'Gruntfile.js']
8
- },
9
-
10
- nodeunit: {
11
- // test/integration is excluded: those tests need a live Docker server
12
- // and run via `npm run test:rev2` instead
13
- all: ['test/**/*-test.js', '!test/integration/**']
14
- }
15
- });
16
-
17
- // Load the plugin(s)
18
- grunt.loadNpmTasks('grunt-eslint');
19
- grunt.loadNpmTasks('grunt-contrib-nodeunit');
20
-
21
- // Tasks
22
- grunt.registerTask('default', ['eslint', 'nodeunit']);
23
- };
package/eslint.config.js DELETED
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- const js = require('@eslint/js');
4
- const globals = require('globals');
5
- const prettierConfig = require('eslint-config-prettier/flat');
6
- const nodemailerConfig = require('eslint-config-nodemailer');
7
-
8
- module.exports = [
9
- {
10
- ignores: ['node_modules/**', 'examples/**', 'docs/**']
11
- },
12
- js.configs.recommended,
13
- {
14
- languageOptions: {
15
- ecmaVersion: 2022,
16
- sourceType: 'script',
17
- parserOptions: {
18
- ecmaFeatures: {
19
- globalReturn: true
20
- }
21
- },
22
- globals: {
23
- ...globals.node,
24
- ...globals.es2021,
25
- it: 'readonly',
26
- describe: 'readonly',
27
- beforeEach: 'readonly',
28
- afterEach: 'readonly'
29
- }
30
- },
31
- rules: {
32
- ...nodemailerConfig.rules,
33
- 'no-await-in-loop': 0,
34
- 'require-atomic-updates': 0
35
- }
36
- },
37
- prettierConfig,
38
- {
39
- files: ['eslint.config.js', '.prettierrc.js', '.ncurc.js'],
40
- rules: {
41
- 'global-require': 0,
42
- strict: 0
43
- }
44
- }
45
- ];