@marktrue/dsh-mobile-remote 3.2.4-alpha.1 → 3.2.4-alpha.2-app

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 (352) hide show
  1. package/DSH-Remote-v3.2.4.apk +4 -0
  2. package/README.md +6 -254
  3. package/manifest.json +21 -0
  4. package/package.json +12 -65
  5. package/CHANGELOG.md +0 -1410
  6. package/CONTRIBUTING.md +0 -59
  7. package/FAQ.md +0 -111
  8. package/cordis.patch.yml +0 -14
  9. package/docs/00-/345/274/200/345/217/221/346/200/273/347/272/262.md +0 -125
  10. package/docs/01-PRD.md +0 -148
  11. package/docs/02-architecture.md +0 -249
  12. package/docs/03-api.md +0 -1154
  13. package/docs/04-security.md +0 -100
  14. package/docs/05-test-cases.md +0 -405
  15. package/docs/06-install-run.md +0 -372
  16. package/docs/07-user-manual.md +0 -70
  17. package/docs/08-/346/211/251/345/261/225/345/274/200/345/217/221/346/214/207/345/215/227.md +0 -86
  18. package/docs/09-compatibility.md +0 -227
  19. package/docs/10-release.md +0 -1067
  20. package/docs/screenshots/01-home.png +0 -0
  21. package/docs/screenshots/02-notifications.png +0 -0
  22. package/docs/screenshots/03-sessions.png +0 -0
  23. package/docs/screenshots/04-chat.png +0 -0
  24. package/docs/screenshots/05-settings.png +0 -0
  25. package/docs/screenshots/06-new-session.png +0 -0
  26. package/docs/screenshots/pgy-appstore.jpg +0 -0
  27. package/docs/screenshots/pgy-mobile-app.jpg +0 -0
  28. package/docs/screenshots/pgy-pc-client.jpg +0 -0
  29. package/lib/account-usage.js +0 -145
  30. package/lib/app-alignment.js +0 -112
  31. package/lib/app-carrier-store.js +0 -1972
  32. package/lib/app-carrier.js +0 -609
  33. package/lib/client.js +0 -1174
  34. package/lib/desktop-form.js +0 -738
  35. package/lib/endpoint-registry.js +0 -167
  36. package/lib/git-read-bundled-provider.js +0 -450
  37. package/lib/git-read-service.js +0 -601
  38. package/lib/index.js +0 -9622
  39. package/lib/npm-update-source.js +0 -226
  40. package/lib/plugin-content-digest.js +0 -80
  41. package/lib/plugin-self-update.js +0 -997
  42. package/lib/plugin-update-controller.js +0 -274
  43. package/lib/plugin-update-log.js +0 -164
  44. package/lib/plugin-update-transaction.js +0 -322
  45. package/lib/plugin-update.js +0 -309
  46. package/lib/runtime-dependency-snapshot.js +0 -345
  47. package/lib/session-title-cache.js +0 -123
  48. package/lib/session-title-refresh.js +0 -261
  49. package/lib/tool-process.js +0 -20
  50. package/lib/update-fetch.js +0 -24
  51. package/lib/update-lock-arbiter.js +0 -170
  52. package/lib/update-supervisor.js +0 -346
  53. package/node_modules/ansi-regex/index.d.ts +0 -37
  54. package/node_modules/ansi-regex/index.js +0 -10
  55. package/node_modules/ansi-regex/license +0 -9
  56. package/node_modules/ansi-regex/package.json +0 -55
  57. package/node_modules/ansi-regex/readme.md +0 -78
  58. package/node_modules/ansi-styles/index.d.ts +0 -345
  59. package/node_modules/ansi-styles/index.js +0 -163
  60. package/node_modules/ansi-styles/license +0 -9
  61. package/node_modules/ansi-styles/package.json +0 -56
  62. package/node_modules/ansi-styles/readme.md +0 -152
  63. package/node_modules/camelcase/index.d.ts +0 -63
  64. package/node_modules/camelcase/index.js +0 -76
  65. package/node_modules/camelcase/license +0 -9
  66. package/node_modules/camelcase/package.json +0 -43
  67. package/node_modules/camelcase/readme.md +0 -99
  68. package/node_modules/cliui/CHANGELOG.md +0 -76
  69. package/node_modules/cliui/LICENSE.txt +0 -14
  70. package/node_modules/cliui/README.md +0 -115
  71. package/node_modules/cliui/index.js +0 -354
  72. package/node_modules/cliui/package.json +0 -65
  73. package/node_modules/color-convert/CHANGELOG.md +0 -54
  74. package/node_modules/color-convert/LICENSE +0 -21
  75. package/node_modules/color-convert/README.md +0 -68
  76. package/node_modules/color-convert/conversions.js +0 -839
  77. package/node_modules/color-convert/index.js +0 -81
  78. package/node_modules/color-convert/package.json +0 -48
  79. package/node_modules/color-convert/route.js +0 -97
  80. package/node_modules/color-name/LICENSE +0 -8
  81. package/node_modules/color-name/README.md +0 -11
  82. package/node_modules/color-name/index.js +0 -152
  83. package/node_modules/color-name/package.json +0 -28
  84. package/node_modules/decamelize/index.js +0 -13
  85. package/node_modules/decamelize/license +0 -21
  86. package/node_modules/decamelize/package.json +0 -38
  87. package/node_modules/decamelize/readme.md +0 -48
  88. package/node_modules/dijkstrajs/.travis.yml +0 -4
  89. package/node_modules/dijkstrajs/CONTRIBUTING.md +0 -8
  90. package/node_modules/dijkstrajs/LICENSE.md +0 -19
  91. package/node_modules/dijkstrajs/README.md +0 -18
  92. package/node_modules/dijkstrajs/dijkstra.js +0 -165
  93. package/node_modules/dijkstrajs/package.json +0 -60
  94. package/node_modules/dijkstrajs/test/dijkstra.test.js +0 -96
  95. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  96. package/node_modules/emoji-regex/README.md +0 -73
  97. package/node_modules/emoji-regex/es2015/index.js +0 -6
  98. package/node_modules/emoji-regex/es2015/text.js +0 -6
  99. package/node_modules/emoji-regex/index.d.ts +0 -23
  100. package/node_modules/emoji-regex/index.js +0 -6
  101. package/node_modules/emoji-regex/package.json +0 -50
  102. package/node_modules/emoji-regex/text.js +0 -6
  103. package/node_modules/find-up/index.d.ts +0 -137
  104. package/node_modules/find-up/index.js +0 -89
  105. package/node_modules/find-up/license +0 -9
  106. package/node_modules/find-up/package.json +0 -53
  107. package/node_modules/find-up/readme.md +0 -156
  108. package/node_modules/get-caller-file/LICENSE.md +0 -6
  109. package/node_modules/get-caller-file/README.md +0 -41
  110. package/node_modules/get-caller-file/index.d.ts +0 -2
  111. package/node_modules/get-caller-file/index.js +0 -22
  112. package/node_modules/get-caller-file/index.js.map +0 -1
  113. package/node_modules/get-caller-file/package.json +0 -42
  114. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  115. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  116. package/node_modules/is-fullwidth-code-point/license +0 -9
  117. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  118. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  119. package/node_modules/locate-path/index.d.ts +0 -83
  120. package/node_modules/locate-path/index.js +0 -65
  121. package/node_modules/locate-path/license +0 -9
  122. package/node_modules/locate-path/package.json +0 -45
  123. package/node_modules/locate-path/readme.md +0 -122
  124. package/node_modules/p-limit/index.d.ts +0 -38
  125. package/node_modules/p-limit/index.js +0 -57
  126. package/node_modules/p-limit/license +0 -9
  127. package/node_modules/p-limit/package.json +0 -52
  128. package/node_modules/p-limit/readme.md +0 -101
  129. package/node_modules/p-locate/index.d.ts +0 -64
  130. package/node_modules/p-locate/index.js +0 -52
  131. package/node_modules/p-locate/license +0 -9
  132. package/node_modules/p-locate/package.json +0 -53
  133. package/node_modules/p-locate/readme.md +0 -90
  134. package/node_modules/p-try/index.d.ts +0 -39
  135. package/node_modules/p-try/index.js +0 -9
  136. package/node_modules/p-try/license +0 -9
  137. package/node_modules/p-try/package.json +0 -42
  138. package/node_modules/p-try/readme.md +0 -58
  139. package/node_modules/path-exists/index.d.ts +0 -28
  140. package/node_modules/path-exists/index.js +0 -23
  141. package/node_modules/path-exists/license +0 -9
  142. package/node_modules/path-exists/package.json +0 -39
  143. package/node_modules/path-exists/readme.md +0 -52
  144. package/node_modules/pngjs/.eslintignore +0 -2
  145. package/node_modules/pngjs/.eslintrc.json +0 -19
  146. package/node_modules/pngjs/.prettierignore +0 -3
  147. package/node_modules/pngjs/LICENSE +0 -20
  148. package/node_modules/pngjs/README.md +0 -429
  149. package/node_modules/pngjs/browser.js +0 -16096
  150. package/node_modules/pngjs/coverage/lcov-report/base.css +0 -354
  151. package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +0 -881
  152. package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +0 -554
  153. package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +0 -77
  154. package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +0 -647
  155. package/node_modules/pngjs/coverage/lcov-report/constants.js.html +0 -176
  156. package/node_modules/pngjs/coverage/lcov-report/crc.js.html +0 -200
  157. package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
  158. package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +0 -593
  159. package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +0 -152
  160. package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +0 -143
  161. package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +0 -611
  162. package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +0 -359
  163. package/node_modules/pngjs/coverage/lcov-report/index.html +0 -426
  164. package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +0 -365
  165. package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +0 -230
  166. package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +0 -248
  167. package/node_modules/pngjs/coverage/lcov-report/packer.js.html +0 -467
  168. package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +0 -128
  169. package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +0 -575
  170. package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +0 -404
  171. package/node_modules/pngjs/coverage/lcov-report/parser.js.html +0 -950
  172. package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +0 -116
  173. package/node_modules/pngjs/coverage/lcov-report/png.js.html +0 -662
  174. package/node_modules/pngjs/coverage/lcov-report/prettify.css +0 -101
  175. package/node_modules/pngjs/coverage/lcov-report/prettify.js +0 -1007
  176. package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  177. package/node_modules/pngjs/coverage/lcov-report/sorter.js +0 -169
  178. package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +0 -584
  179. package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +0 -215
  180. package/node_modules/pngjs/coverage/lcov.info +0 -2177
  181. package/node_modules/pngjs/lib/bitmapper.js +0 -267
  182. package/node_modules/pngjs/lib/bitpacker.js +0 -158
  183. package/node_modules/pngjs/lib/chunkstream.js +0 -189
  184. package/node_modules/pngjs/lib/constants.js +0 -32
  185. package/node_modules/pngjs/lib/crc.js +0 -40
  186. package/node_modules/pngjs/lib/filter-pack.js +0 -171
  187. package/node_modules/pngjs/lib/filter-parse-async.js +0 -24
  188. package/node_modules/pngjs/lib/filter-parse-sync.js +0 -21
  189. package/node_modules/pngjs/lib/filter-parse.js +0 -177
  190. package/node_modules/pngjs/lib/format-normaliser.js +0 -93
  191. package/node_modules/pngjs/lib/interlace.js +0 -95
  192. package/node_modules/pngjs/lib/packer-async.js +0 -50
  193. package/node_modules/pngjs/lib/packer-sync.js +0 -56
  194. package/node_modules/pngjs/lib/packer.js +0 -129
  195. package/node_modules/pngjs/lib/paeth-predictor.js +0 -16
  196. package/node_modules/pngjs/lib/parser-async.js +0 -165
  197. package/node_modules/pngjs/lib/parser-sync.js +0 -108
  198. package/node_modules/pngjs/lib/parser.js +0 -290
  199. package/node_modules/pngjs/lib/png-sync.js +0 -12
  200. package/node_modules/pngjs/lib/png.js +0 -194
  201. package/node_modules/pngjs/lib/sync-inflate.js +0 -168
  202. package/node_modules/pngjs/lib/sync-reader.js +0 -45
  203. package/node_modules/pngjs/package.json +0 -73
  204. package/node_modules/qrcode/README.md +0 -770
  205. package/node_modules/qrcode/bin/qrcode +0 -159
  206. package/node_modules/qrcode/helper/to-sjis-browser.js +0 -2
  207. package/node_modules/qrcode/helper/to-sjis.js +0 -105
  208. package/node_modules/qrcode/lib/browser.js +0 -76
  209. package/node_modules/qrcode/lib/can-promise.js +0 -7
  210. package/node_modules/qrcode/lib/core/alignment-pattern.js +0 -83
  211. package/node_modules/qrcode/lib/core/alphanumeric-data.js +0 -59
  212. package/node_modules/qrcode/lib/core/bit-buffer.js +0 -37
  213. package/node_modules/qrcode/lib/core/bit-matrix.js +0 -65
  214. package/node_modules/qrcode/lib/core/byte-data.js +0 -30
  215. package/node_modules/qrcode/lib/core/error-correction-code.js +0 -135
  216. package/node_modules/qrcode/lib/core/error-correction-level.js +0 -50
  217. package/node_modules/qrcode/lib/core/finder-pattern.js +0 -22
  218. package/node_modules/qrcode/lib/core/format-info.js +0 -29
  219. package/node_modules/qrcode/lib/core/galois-field.js +0 -69
  220. package/node_modules/qrcode/lib/core/kanji-data.js +0 -54
  221. package/node_modules/qrcode/lib/core/mask-pattern.js +0 -234
  222. package/node_modules/qrcode/lib/core/mode.js +0 -167
  223. package/node_modules/qrcode/lib/core/numeric-data.js +0 -43
  224. package/node_modules/qrcode/lib/core/polynomial.js +0 -62
  225. package/node_modules/qrcode/lib/core/qrcode.js +0 -495
  226. package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +0 -56
  227. package/node_modules/qrcode/lib/core/regex.js +0 -31
  228. package/node_modules/qrcode/lib/core/segments.js +0 -330
  229. package/node_modules/qrcode/lib/core/utils.js +0 -63
  230. package/node_modules/qrcode/lib/core/version-check.js +0 -9
  231. package/node_modules/qrcode/lib/core/version.js +0 -163
  232. package/node_modules/qrcode/lib/index.js +0 -12
  233. package/node_modules/qrcode/lib/renderer/canvas.js +0 -63
  234. package/node_modules/qrcode/lib/renderer/png.js +0 -78
  235. package/node_modules/qrcode/lib/renderer/svg-tag.js +0 -81
  236. package/node_modules/qrcode/lib/renderer/svg.js +0 -19
  237. package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +0 -85
  238. package/node_modules/qrcode/lib/renderer/terminal/terminal.js +0 -49
  239. package/node_modules/qrcode/lib/renderer/terminal.js +0 -9
  240. package/node_modules/qrcode/lib/renderer/utf8.js +0 -71
  241. package/node_modules/qrcode/lib/renderer/utils.js +0 -99
  242. package/node_modules/qrcode/lib/server.js +0 -138
  243. package/node_modules/qrcode/license +0 -10
  244. package/node_modules/qrcode/package.json +0 -77
  245. package/node_modules/require-directory/.jshintrc +0 -67
  246. package/node_modules/require-directory/.npmignore +0 -1
  247. package/node_modules/require-directory/.travis.yml +0 -3
  248. package/node_modules/require-directory/LICENSE +0 -22
  249. package/node_modules/require-directory/README.markdown +0 -184
  250. package/node_modules/require-directory/index.js +0 -86
  251. package/node_modules/require-directory/package.json +0 -40
  252. package/node_modules/require-main-filename/CHANGELOG.md +0 -26
  253. package/node_modules/require-main-filename/LICENSE.txt +0 -14
  254. package/node_modules/require-main-filename/README.md +0 -26
  255. package/node_modules/require-main-filename/index.js +0 -18
  256. package/node_modules/require-main-filename/package.json +0 -35
  257. package/node_modules/set-blocking/CHANGELOG.md +0 -26
  258. package/node_modules/set-blocking/LICENSE.txt +0 -14
  259. package/node_modules/set-blocking/README.md +0 -31
  260. package/node_modules/set-blocking/index.js +0 -7
  261. package/node_modules/set-blocking/package.json +0 -42
  262. package/node_modules/string-width/index.d.ts +0 -29
  263. package/node_modules/string-width/index.js +0 -47
  264. package/node_modules/string-width/license +0 -9
  265. package/node_modules/string-width/package.json +0 -56
  266. package/node_modules/string-width/readme.md +0 -50
  267. package/node_modules/strip-ansi/index.d.ts +0 -17
  268. package/node_modules/strip-ansi/index.js +0 -4
  269. package/node_modules/strip-ansi/license +0 -9
  270. package/node_modules/strip-ansi/package.json +0 -54
  271. package/node_modules/strip-ansi/readme.md +0 -46
  272. package/node_modules/which-module/LICENSE +0 -13
  273. package/node_modules/which-module/README.md +0 -58
  274. package/node_modules/which-module/index.js +0 -9
  275. package/node_modules/which-module/package.json +0 -41
  276. package/node_modules/wrap-ansi/index.js +0 -186
  277. package/node_modules/wrap-ansi/license +0 -9
  278. package/node_modules/wrap-ansi/package.json +0 -61
  279. package/node_modules/wrap-ansi/readme.md +0 -97
  280. package/node_modules/y18n/CHANGELOG.md +0 -35
  281. package/node_modules/y18n/LICENSE +0 -13
  282. package/node_modules/y18n/README.md +0 -109
  283. package/node_modules/y18n/index.js +0 -188
  284. package/node_modules/y18n/package.json +0 -39
  285. package/node_modules/yargs/CHANGELOG.md +0 -420
  286. package/node_modules/yargs/LICENSE +0 -21
  287. package/node_modules/yargs/README.md +0 -140
  288. package/node_modules/yargs/build/lib/apply-extends.d.ts +0 -2
  289. package/node_modules/yargs/build/lib/apply-extends.js +0 -65
  290. package/node_modules/yargs/build/lib/argsert.d.ts +0 -2
  291. package/node_modules/yargs/build/lib/argsert.js +0 -65
  292. package/node_modules/yargs/build/lib/command.d.ts +0 -64
  293. package/node_modules/yargs/build/lib/command.js +0 -416
  294. package/node_modules/yargs/build/lib/common-types.d.ts +0 -36
  295. package/node_modules/yargs/build/lib/common-types.js +0 -25
  296. package/node_modules/yargs/build/lib/completion-templates.d.ts +0 -2
  297. package/node_modules/yargs/build/lib/completion-templates.js +0 -50
  298. package/node_modules/yargs/build/lib/completion.d.ts +0 -21
  299. package/node_modules/yargs/build/lib/completion.js +0 -135
  300. package/node_modules/yargs/build/lib/is-promise.d.ts +0 -1
  301. package/node_modules/yargs/build/lib/is-promise.js +0 -9
  302. package/node_modules/yargs/build/lib/levenshtein.d.ts +0 -1
  303. package/node_modules/yargs/build/lib/levenshtein.js +0 -58
  304. package/node_modules/yargs/build/lib/middleware.d.ts +0 -10
  305. package/node_modules/yargs/build/lib/middleware.js +0 -57
  306. package/node_modules/yargs/build/lib/obj-filter.d.ts +0 -1
  307. package/node_modules/yargs/build/lib/obj-filter.js +0 -14
  308. package/node_modules/yargs/build/lib/parse-command.d.ts +0 -11
  309. package/node_modules/yargs/build/lib/parse-command.js +0 -36
  310. package/node_modules/yargs/build/lib/process-argv.d.ts +0 -2
  311. package/node_modules/yargs/build/lib/process-argv.js +0 -31
  312. package/node_modules/yargs/build/lib/usage.d.ts +0 -49
  313. package/node_modules/yargs/build/lib/usage.js +0 -540
  314. package/node_modules/yargs/build/lib/validation.d.ts +0 -34
  315. package/node_modules/yargs/build/lib/validation.js +0 -330
  316. package/node_modules/yargs/build/lib/yargs.d.ts +0 -274
  317. package/node_modules/yargs/build/lib/yargs.js +0 -1190
  318. package/node_modules/yargs/build/lib/yerror.d.ts +0 -4
  319. package/node_modules/yargs/build/lib/yerror.js +0 -11
  320. package/node_modules/yargs/index.js +0 -40
  321. package/node_modules/yargs/locales/be.json +0 -46
  322. package/node_modules/yargs/locales/de.json +0 -46
  323. package/node_modules/yargs/locales/en.json +0 -51
  324. package/node_modules/yargs/locales/es.json +0 -46
  325. package/node_modules/yargs/locales/fi.json +0 -49
  326. package/node_modules/yargs/locales/fr.json +0 -53
  327. package/node_modules/yargs/locales/hi.json +0 -49
  328. package/node_modules/yargs/locales/hu.json +0 -46
  329. package/node_modules/yargs/locales/id.json +0 -50
  330. package/node_modules/yargs/locales/it.json +0 -46
  331. package/node_modules/yargs/locales/ja.json +0 -51
  332. package/node_modules/yargs/locales/ko.json +0 -49
  333. package/node_modules/yargs/locales/nb.json +0 -44
  334. package/node_modules/yargs/locales/nl.json +0 -49
  335. package/node_modules/yargs/locales/nn.json +0 -44
  336. package/node_modules/yargs/locales/pirate.json +0 -13
  337. package/node_modules/yargs/locales/pl.json +0 -49
  338. package/node_modules/yargs/locales/pt.json +0 -45
  339. package/node_modules/yargs/locales/pt_BR.json +0 -48
  340. package/node_modules/yargs/locales/ru.json +0 -46
  341. package/node_modules/yargs/locales/th.json +0 -46
  342. package/node_modules/yargs/locales/tr.json +0 -48
  343. package/node_modules/yargs/locales/zh_CN.json +0 -48
  344. package/node_modules/yargs/locales/zh_TW.json +0 -47
  345. package/node_modules/yargs/package.json +0 -92
  346. package/node_modules/yargs/yargs.js +0 -14
  347. package/node_modules/yargs-parser/CHANGELOG.md +0 -601
  348. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  349. package/node_modules/yargs-parser/README.md +0 -449
  350. package/node_modules/yargs-parser/index.js +0 -1032
  351. package/node_modules/yargs-parser/lib/tokenize-arg-string.js +0 -40
  352. package/node_modules/yargs-parser/package.json +0 -46
@@ -1,346 +0,0 @@
1
- #!/usr/bin/env node
2
- // 插件自更新的**外部监督器**(ADR 0019;评审 #32 note 1286 的 R1,二次复核的 F1/F2/F3/F4)。
3
- //
4
- // 为什么必须独立:回滚绝不能依赖新版插件能否加载。本脚本由**旧版插件**启动,
5
- // 启动前先把自身代码**冻结**到不可变目录(pnpm 可能清理原模块目录),并在 systemd 托管时
6
- // 用 transient unit **逃逸出宿主 cgroup**(否则停宿主时监督器会被一起杀掉)。
7
- //
8
- // 工作方式:
9
- // 1. `--arm`:写就绪回执 → 接管事务锁 → 等事务进入 `restart-pending`(或终态/超时);
10
- // 2. 进入后**先安排第一次重启**(旧宿主不会自己加载新代码),再等新实例健康;
11
- // 3. 健康判据是**正在运行的内容标识**(`plugin.contentSha256`),不是磁盘字节;
12
- // 4. 不健康 → 用**快照**恢复旧依赖并重装 → 再重启 → 确认旧内容回来;
13
- // 5. 全程只在终态释放锁,并把结果原子落盘供手机查询。
14
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
15
- import { dirname, join } from "node:path";
16
- import { spawn, spawnSync } from "node:child_process";
17
- import { appendOperationLog } from "./plugin-update-log.js";
18
- import {
19
- TRANSACTION_PHASE,
20
- acquireLock,
21
- assertUpdateLease,
22
- restoreOwnedProfile,
23
- publishOwnedSnapshotLink,
24
- finishOwnedTerminal,
25
- claimOwnedRecovery,
26
- defaultIsPidAlive,
27
- writeOwnedTransaction,
28
- switchOwnedDependency,
29
- handOverLock,
30
- readTransaction,
31
- releaseLock,
32
- snapshotReady,
33
- updateLockPath,
34
- writeTransaction,
35
- } from "./plugin-update-transaction.js";
36
- import { pluginContentDigest } from "./plugin-content-digest.js";
37
- import { verifyFrozenPackage } from "./runtime-dependency-snapshot.js";
38
- import { restartPlan } from "./plugin-self-update.js";
39
- import { shellOptions } from "./tool-process.js";
40
-
41
- /** 等待宿主的默认超时:足够冷启动(含语料预热),又不至于让用户无限等。 */
42
- export const DEFAULT_WAIT_TIMEOUT_MS = 180_000;
43
- export const DEFAULT_POLL_MS = 2_000;
44
- /** 等事务进入 restart-pending 的上限(下载 + 安装可能很慢)。 */
45
- export const DEFAULT_ARM_TIMEOUT_MS = 15 * 60 * 1000;
46
-
47
- /** 解析命令行参数。 */
48
- export function parseArgs(argv) {
49
- const out = {};
50
- for (let i = 0; i < argv.length; i++) {
51
- const key = argv[i];
52
- if (!key.startsWith("--")) continue;
53
- const next = argv[i + 1];
54
- if (next === undefined || next.startsWith("--")) out[key.slice(2)] = "true";
55
- else {
56
- out[key.slice(2)] = next;
57
- i++;
58
- }
59
- }
60
- return out;
61
- }
62
-
63
- /** 轮询本机宿主,直到它报告出**期望的内容标识**(或期望版本)。 */
64
- export async function waitForHost({
65
- port,
66
- basePath = "/m",
67
- token = "",
68
- expectContentSha256 = "",
69
- expectVersion = "",
70
- timeoutMs = DEFAULT_WAIT_TIMEOUT_MS,
71
- pollMs = DEFAULT_POLL_MS,
72
- fetchImpl = fetch,
73
- now = () => Date.now(),
74
- sleep = (ms) => new Promise((r) => setTimeout(r, ms)),
75
- } = {}) {
76
- const deadline = now() + timeoutMs;
77
- const url = `http://127.0.0.1:${port}${basePath}/api/bootstrap`;
78
- let lastError = "no-response";
79
- while (now() < deadline) {
80
- try {
81
- const res = await fetchImpl(url, {
82
- headers: token ? { "x-mobile-token": token } : {},
83
- signal: AbortSignal.timeout(Math.max(1000, pollMs)),
84
- });
85
- if (res?.ok) {
86
- const body = await res.json();
87
- const plugin = body?.plugin ?? {};
88
- const contentOk = expectContentSha256 !== "" && plugin.contentSha256 === expectContentSha256;
89
- const versionOk = expectContentSha256 === "" && expectVersion !== "" && plugin.version === expectVersion;
90
- const anyOk = expectContentSha256 === "" && expectVersion === "" && Boolean(body?.ok);
91
- if (contentOk || versionOk || anyOk) {
92
- return { ok: true, plugin, matched: contentOk ? "content" : versionOk ? "version" : "any" };
93
- }
94
- lastError = `content-mismatch:${plugin.contentSha256 ?? "none"}`;
95
- } else {
96
- lastError = `http-${res?.status ?? "?"}`;
97
- }
98
- } catch (e) {
99
- lastError = String(e?.message ?? e);
100
- }
101
- await sleep(pollMs);
102
- }
103
- return { ok: false, error: `host-wait-timeout: ${lastError}` };
104
- }
105
-
106
- /** 找出**当前**占用该端口的进程(F3:回滚不能杀更新前的旧 PID)。 */
107
- export function findPortOwnerPid(port, { run = spawnSync } = {}) {
108
- if (!Number.isFinite(port) || port <= 0) return null;
109
- try {
110
- const ss = run("ss", ["-ltnpH", `sport = :${port}`], { encoding: "utf8" });
111
- const m = /pid=(\d+)/.exec(ss?.stdout ?? "");
112
- if (m) return Number(m[1]);
113
- } catch {
114
- // 继续尝试 lsof
115
- }
116
- try {
117
- const lsof = run("lsof", ["-ti", `tcp:${port}`, "-sTCP:LISTEN"], { encoding: "utf8" });
118
- const first = (lsof?.stdout ?? "").trim().split("\n")[0];
119
- if (/^\d+$/.test(first)) return Number(first);
120
- } catch {
121
- // 没有可用工具
122
- }
123
- return null;
124
- }
125
-
126
- /** 生成"杀掉当前端口占用者"的 shell 片段(找不到就退回给定 pid)。 */
127
- export function portKillSnippet(port, fallbackPid = null) {
128
- const lines = [
129
- `P=$(ss -ltnpH "sport = :${port}" 2>/dev/null | grep -oP 'pid=\\K[0-9]+' | head -1)`,
130
- `[ -z "$P" ] && P=$(lsof -ti tcp:${port} -sTCP:LISTEN 2>/dev/null | head -1)`,
131
- ];
132
- if (fallbackPid) lines.push(`[ -z "$P" ] && P=${fallbackPid}`);
133
- lines.push('[ -n "$P" ] && kill -TERM "$P" 2>/dev/null');
134
- return lines.join("; ");
135
- }
136
-
137
- /**
138
- * 默认重启器:**按当前实例**(端口占用者)终止,而不是事务里记的旧 PID;
139
- * 前台形态自行重新拉起。**返回结果不再被忽略**(F3)。
140
- */
141
- export function defaultRestart({ restartForm, port, pid = null, profile = "web", dshCommand = "dsh", log = () => {} }) {
142
- const plan = restartPlan({ form: restartForm, pid: null, profile, dshCommand });
143
- if (plan.mode === "unsupported") return { ok: false, error: "restart-unsupported" };
144
- const kill = portKillSnippet(port, pid);
145
- const script = plan.mode === "respawn"
146
- ? `sleep 1; ${kill}; sleep 2; nohup ${dshCommand} web --profile ${profile} >/dev/null 2>&1 &`
147
- : `sleep 1; ${kill}`;
148
- const r = spawnSync("bash", ["-lc", script], { encoding: "utf8" });
149
- if (r.error) return { ok: false, error: r.error.message };
150
- if (r.status !== 0) return { ok: false, error: `restart-script-exit-${r.status}: ${(r.stderr || "").trim()}` };
151
- log(`supervisor: 已安排重启(${plan.mode},目标=当前端口占用者)`);
152
- return { ok: true, script };
153
- }
154
-
155
- /**
156
- * 默认恢复器(F4):把依赖指回**快照**(而不是可能已变的原 clone/tag/source),
157
- * 再重装;并检查安装结果。
158
- */
159
- export async function defaultRestore({ profileDir, snapshotDir: snapDir, expectedContentSha256, profileSnapshot, dependencyKey, preserveSpecifier = false, lockPath, lease }) {
160
- if (!snapDir || !snapshotReady(snapDir) || (expectedContentSha256 && pluginContentDigest(snapDir) !== expectedContentSha256)) {
161
- return { ok: false, error: "snapshot-unavailable" };
162
- }
163
- try {
164
- assertUpdateLease(lockPath, lease);
165
- // 一次受代际保护的仲裁里恢复 profile/lockfile(A 阻塞:不再有 assert→write 空窗)。
166
- const restoreKey = dependencyKey || profileSnapshot?.dependencyKey || 'dsh-mobile-remote';
167
- const restored = restoreOwnedProfile({ profileDir, snapshotDir: snapDir, snapshot: profileSnapshot, key: restoreKey,
168
- preserveSpecifier, lockPath, lease });
169
- if (!restored.ok) return { ok: false, error: restored.error };
170
- // 直接把**已验证自包含**的快照发布为安装目录:旧字节精确、离线可加载;
171
- // npm 事务保留原精确 registry spec,legacy 事务继续使用 file: 快照 spec。
172
- const published = publishOwnedSnapshotLink({ profileDir, snapshotDir: snapDir, key: restoreKey, lockPath, lease });
173
- if (!published.ok) return { ok: false, error: published.error };
174
- assertUpdateLease(lockPath, lease);
175
- const actualRoot = join(profileDir, "node_modules", ...restoreKey.split("/"));
176
- if (pluginContentDigest(actualRoot) !== expectedContentSha256) return { ok: false, error: "restored-content-mismatch" };
177
- const verified = verifyFrozenPackage(actualRoot);
178
- if (!verified.ok) return { ok: false, error: `restored-snapshot-invalid: ${verified.error}` };
179
- return { ok: true, restoredTo: snapDir, digest: verified.digest };
180
- } catch(e) { return { ok: false, error: e.message }; }
181
- }
182
-
183
- /** 默认安装器(监督器是独立进程,阻塞没关系)。 */
184
- export function defaultRunInstall(profileDir) {
185
- // Windows 上 pnpm 是 pnpm.cmd,必须经 shell 解析。
186
- const r = spawnSync("pnpm", ["install"], { cwd: profileDir, encoding: "utf8", ...shellOptions() });
187
- if (r.error) return { ok: false, error: r.error.message };
188
- if (r.status !== 0) return { ok: false, error: (r.stderr || `exit ${r.status}`).trim() };
189
- return { ok: true };
190
- }
191
-
192
- /**
193
- * 推进一次已进入 `restart-pending` 的事务。
194
- * **顺序**:先安排第一次重启(F1),再等新实例健康;不健康才走回滚。
195
- */
196
- export async function runTransaction({ stateFile, tx, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS,
197
- pollMs = DEFAULT_POLL_MS, maxRollbacks = 1, waitForHost: waitImpl = waitForHost,
198
- restore = defaultRestore, restart = defaultRestart, runInstall = defaultRunInstall, log = () => {}, now = () => Date.now() } = {}) {
199
- const lockPath = tx.lockPath || join(dirname(stateFile), "plugin-update.lock.d");
200
- const lease = tx.lease;
201
- const phaseAt = () => tx.phase;
202
- const save = (patch, expectedPhases) => { tx = writeOwnedTransaction(stateFile, { ...tx, ...patch }, { lockPath, lease, currentFile: tx.currentFile, expectedPhases }); return tx; };
203
- // 终态与释放合一:不存在"已终态但锁还在/已被释放"的空窗(C3)。
204
- const finish = (phase, result, expectedPhases) => finishOwnedTerminal(stateFile, { phase, result, expectedPhases }, { lockPath, lease, currentFile: tx.currentFile });
205
- try {
206
- assertUpdateLease(lockPath, lease);
207
- let failure = tx.recoveryCause || tx.result?.reason;
208
- // 已经处于 rolling-back(安装失败/恢复重试):**直接续做恢复**,不重复"先重启再等待"。
209
- if (tx.phase !== TRANSACTION_PHASE.ROLLING_BACK) {
210
- const entryPhase = phaseAt();
211
- log("supervisor: restarting host to load candidate plugin");
212
- const result = await restart({ ...tx, pid: tx.hostPid, log });
213
- assertUpdateLease(lockPath, lease);
214
- if (!result?.ok) {
215
- log("supervisor: candidate restart failed");
216
- failure = `restart-failed: ${result?.error ?? "unknown"}`;
217
- } else {
218
- log("supervisor: waiting for candidate health confirmation");
219
- const healthy = await waitImpl({ ...tx, expectContentSha256: tx.targetContentSha256,
220
- expectVersion: tx.targetVersion, timeoutMs, pollMs });
221
- assertUpdateLease(lockPath, lease);
222
- if (healthy.ok) {
223
- log("supervisor: candidate plugin health confirmed");
224
- return finish(TRANSACTION_PHASE.SETTLED, { ok: true, matched: healthy.matched, at: new Date(now()).toISOString() }, [entryPhase]);
225
- }
226
- log("supervisor: candidate health check failed; rollback required");
227
- failure = healthy.error;
228
- }
229
- if (!tx.previousSnapshotDir) return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-target-missing", error: failure }, [entryPhase]);
230
- if ((tx.attempts ?? 0) >= maxRollbacks) return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-exhausted", error: failure }, [entryPhase]);
231
- // 正常失败与"续做恢复"共用同一入口;CAS 用**进入时的真实阶段**,不再硬编码。
232
- save({ phase: TRANSACTION_PHASE.ROLLING_BACK, attempts: (tx.attempts ?? 0) + 1, rolledBack: true,
233
- result: { ok: false, reason: "rolling-back", error: failure } }, [entryPhase]);
234
- }
235
- assertUpdateLease(lockPath, lease);
236
- if (!tx.previousSnapshotDir) return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-target-missing", error: failure }, ["rolling-back"]);
237
- if ((tx.attempts ?? 0) > maxRollbacks) return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-exhausted", error: failure }, ["rolling-back"]);
238
- // 同代唯一 claim:两个监督器同时重试时,只有一方真的执行恢复与重启。
239
- const owner = `${process.pid}-${Math.random().toString(36).slice(2)}`;
240
- const claimed = claimOwnedRecovery(stateFile, { owner }, { lockPath, lease, currentFile: tx.currentFile });
241
- if (!claimed.ok) return { ok: false, error: claimed.error, transaction: claimed.transaction };
242
- tx = claimed.transaction;
243
- log("supervisor: restoring previous plugin snapshot");
244
- const restored = await restore({ profileDir: tx.profileDir, snapshotDir: tx.previousSnapshotDir,
245
- expectedContentSha256: tx.previousContentSha256, profileSnapshot: tx.profileSnapshot,
246
- dependencyKey: tx.dependencyKey || tx.profileSnapshot?.dependencyKey,
247
- preserveSpecifier: Boolean(tx.npmCandidate), lockPath, lease, runInstall });
248
- assertUpdateLease(lockPath, lease);
249
- if (!restored?.ok) {
250
- log("supervisor: previous plugin snapshot restore failed");
251
- return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-restore-failed", error: restored?.error }, ["rolling-back"]);
252
- }
253
- log("supervisor: restarting host with previous plugin");
254
- const result = await restart({ ...tx, pid: null, log });
255
- assertUpdateLease(lockPath, lease);
256
- if (!result?.ok) {
257
- log("supervisor: rollback restart failed");
258
- return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "rollback-restart-failed", error: result?.error }, ["rolling-back"]);
259
- }
260
- log("supervisor: waiting for previous plugin health confirmation");
261
- const back = await waitImpl({ ...tx, expectContentSha256: tx.previousContentSha256,
262
- expectVersion: "", timeoutMs, pollMs });
263
- assertUpdateLease(lockPath, lease);
264
- log(back.ok ? "supervisor: previous plugin health confirmed" : "supervisor: previous plugin health not confirmed");
265
- return finish(back.ok ? TRANSACTION_PHASE.ROLLED_BACK : TRANSACTION_PHASE.FAILED,
266
- { ok: false, reason: back.ok ? "rolled-back" : "rollback-unconfirmed", error: back.ok ? failure : back.error }, ["rolling-back"]);
267
- } catch(e) {
268
- if (e.message === "lease-lost") return { ok: false, error: "lease-lost" };
269
- try { return finish(TRANSACTION_PHASE.FAILED, { ok: false, reason: "supervisor-error", error: e.message }, [tx.phase]); }
270
- catch { return { ok: false, error: e.message }; }
271
- }
272
- }
273
-
274
- export async function superviseUpdate(options = {}) {
275
- const tx = readTransaction(options.stateFile);
276
- if (!tx) return { ok: false, error: "no-transaction" };
277
- if (options.opId && (options.opId !== tx.opId || options.generation !== tx.lease?.generation)) return { ok: false, error: "operation-mismatch" };
278
- if (!["restart-pending", "rolling-back"].includes(tx.phase)) return { ok: false, error: `not-restart-pending:${tx.phase}` };
279
- return runTransaction({ ...options, tx });
280
- }
281
-
282
- export async function superviseArmed({ stateFile, readyFile, opId, generation,
283
- armTimeoutMs = DEFAULT_ARM_TIMEOUT_MS, pollMs = DEFAULT_POLL_MS,
284
- log = () => {}, sleep = ms => new Promise(r => setTimeout(r, ms)), now = () => Date.now(), ...rest } = {}) {
285
- const tx0 = readTransaction(stateFile);
286
- if (!tx0 || tx0.opId !== opId || tx0.lease?.generation !== generation) return { ok: false, error: "operation-mismatch" };
287
- const lockPath = tx0.lockPath, lease = tx0.lease;
288
- if (!handOverLock(lockPath, { lease, toPid: process.pid })) return { ok: false, error: "lease-lost" };
289
- let cgroup = "";
290
- try { cgroup = readFileSync("/proc/self/cgroup", "utf8").trim(); } catch { /* portable ready receipt */ }
291
- mkdirSync(dirname(readyFile), { recursive: true });
292
- writeFileSync(readyFile, JSON.stringify({ pid: process.pid, opId, generation, cgroup, at: new Date(now()).toISOString() }), { mode: 0o600 });
293
- const deadline = now() + armTimeoutMs;
294
- while (now() < deadline) {
295
- const tx = readTransaction(stateFile);
296
- if (!tx || tx.opId !== opId || tx.lease?.generation !== generation) return { ok: false, error: "operation-mismatch" };
297
- try { assertUpdateLease(lockPath, lease); } catch { return { ok: false, error: "lease-lost" }; }
298
- if (["restart-pending","rolling-back"].includes(tx.phase)) return runTransaction({ stateFile, tx, log, ...rest });
299
- if (["settled","rolled-back","failed"].includes(tx.phase)) return tx;
300
- if (!defaultIsPidAlive(tx.hostPid) && tx.phase === "installing") {
301
- const recovering = writeOwnedTransaction(stateFile, { ...tx, phase: "rolling-back", recoveryCause: "install-worker-gone", rolledBack: true }, { lockPath, lease, currentFile: tx.currentFile });
302
- return runTransaction({ stateFile, tx: recovering, log, ...rest });
303
- }
304
- await sleep(pollMs);
305
- }
306
- // Do not race a live installer. Keep its protected recovery metadata, rather than granting a new transaction.
307
- const current = readTransaction(stateFile);
308
- if (current.phase === "staging") {
309
- // 终态 + 释放同一次仲裁;不覆盖已推进到 installing 的事务(phase CAS)。
310
- try { finishOwnedTerminal(stateFile, { phase: "failed", result: { ok: false, reason: "arm-timeout" }, expectedPhases: ["staging"] }, { lockPath, lease, currentFile: current.currentFile }); }
311
- catch (e) { log(`supervisor: 保留受保护事务(${e.message})`); }
312
- }
313
- return { ok: false, error: "arm-timeout" };
314
- }
315
-
316
- async function main() {
317
- const args = parseArgs(process.argv.slice(2));
318
- const stateFile = args.state;
319
- if (!stateFile) {
320
- console.error("usage: node update-supervisor.js --state <transaction.json> [--arm --ready <file>] [--timeout 180]");
321
- process.exit(2);
322
- }
323
- const timeoutMs = Number(args.timeout ?? 0) > 0 ? Number(args.timeout) * 1000 : DEFAULT_WAIT_TIMEOUT_MS;
324
- const pollMs = Number(args.poll ?? 0) > 0 ? Number(args.poll) : DEFAULT_POLL_MS;
325
- const txAtStart = readTransaction(stateFile);
326
- const generation = txAtStart?.lease?.generation ?? args.generation;
327
- const currentFile = txAtStart?.currentFile ?? "";
328
- const logHome = currentFile ? dirname(dirname(dirname(currentFile))) : (process.env.HOME ?? "");
329
- const log = (message) => {
330
- if (logHome && generation) {
331
- try { appendOperationLog({ home: logHome, generation, stage: "supervisor", text: message, redactPaths: [logHome, txAtStart?.profileDir] }); } catch { /* progress logging must not block recovery */ }
332
- }
333
- console.log("supervisor: progress event recorded");
334
- };
335
- const finalState = args.arm
336
- ? await superviseArmed({ stateFile, readyFile: args.ready, opId: args.op, generation: args.generation, timeoutMs, pollMs, log })
337
- : await superviseUpdate({ stateFile, opId: args.op, generation: args.generation, timeoutMs, pollMs, log });
338
- console.log(`supervisor: 结束于 ${finalState?.phase ?? "unknown"}`);
339
- }
340
-
341
- if (process.argv[1] && process.argv[1].endsWith("update-supervisor.js")) {
342
- main().catch((e) => {
343
- console.error(`supervisor: 异常 ${e?.stack ?? e}`);
344
- process.exit(1);
345
- });
346
- }
@@ -1,37 +0,0 @@
1
- declare namespace ansiRegex {
2
- interface Options {
3
- /**
4
- Match only the first ANSI escape.
5
-
6
- @default false
7
- */
8
- onlyFirst: boolean;
9
- }
10
- }
11
-
12
- /**
13
- Regular expression for matching ANSI escape codes.
14
-
15
- @example
16
- ```
17
- import ansiRegex = require('ansi-regex');
18
-
19
- ansiRegex().test('\u001B[4mcake\u001B[0m');
20
- //=> true
21
-
22
- ansiRegex().test('cake');
23
- //=> false
24
-
25
- '\u001B[4mcake\u001B[0m'.match(ansiRegex());
26
- //=> ['\u001B[4m', '\u001B[0m']
27
-
28
- '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
29
- //=> ['\u001B[4m']
30
-
31
- '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
32
- //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
33
- ```
34
- */
35
- declare function ansiRegex(options?: ansiRegex.Options): RegExp;
36
-
37
- export = ansiRegex;
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({onlyFirst = false} = {}) => {
4
- const pattern = [
5
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
6
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
7
- ].join('|');
8
-
9
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
10
- };
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,55 +0,0 @@
1
- {
2
- "name": "ansi-regex",
3
- "version": "5.0.1",
4
- "description": "Regular expression for matching ANSI escape codes",
5
- "license": "MIT",
6
- "repository": "chalk/ansi-regex",
7
- "author": {
8
- "name": "Sindre Sorhus",
9
- "email": "sindresorhus@gmail.com",
10
- "url": "sindresorhus.com"
11
- },
12
- "engines": {
13
- "node": ">=8"
14
- },
15
- "scripts": {
16
- "test": "xo && ava && tsd",
17
- "view-supported": "node fixtures/view-codes.js"
18
- },
19
- "files": [
20
- "index.js",
21
- "index.d.ts"
22
- ],
23
- "keywords": [
24
- "ansi",
25
- "styles",
26
- "color",
27
- "colour",
28
- "colors",
29
- "terminal",
30
- "console",
31
- "cli",
32
- "string",
33
- "tty",
34
- "escape",
35
- "formatting",
36
- "rgb",
37
- "256",
38
- "shell",
39
- "xterm",
40
- "command-line",
41
- "text",
42
- "regex",
43
- "regexp",
44
- "re",
45
- "match",
46
- "test",
47
- "find",
48
- "pattern"
49
- ],
50
- "devDependencies": {
51
- "ava": "^2.4.0",
52
- "tsd": "^0.9.0",
53
- "xo": "^0.25.3"
54
- }
55
- }
@@ -1,78 +0,0 @@
1
- # ansi-regex
2
-
3
- > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
-
5
-
6
- ## Install
7
-
8
- ```
9
- $ npm install ansi-regex
10
- ```
11
-
12
-
13
- ## Usage
14
-
15
- ```js
16
- const ansiRegex = require('ansi-regex');
17
-
18
- ansiRegex().test('\u001B[4mcake\u001B[0m');
19
- //=> true
20
-
21
- ansiRegex().test('cake');
22
- //=> false
23
-
24
- '\u001B[4mcake\u001B[0m'.match(ansiRegex());
25
- //=> ['\u001B[4m', '\u001B[0m']
26
-
27
- '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
28
- //=> ['\u001B[4m']
29
-
30
- '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
31
- //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
32
- ```
33
-
34
-
35
- ## API
36
-
37
- ### ansiRegex(options?)
38
-
39
- Returns a regex for matching ANSI escape codes.
40
-
41
- #### options
42
-
43
- Type: `object`
44
-
45
- ##### onlyFirst
46
-
47
- Type: `boolean`<br>
48
- Default: `false` *(Matches any ANSI escape codes in a string)*
49
-
50
- Match only the first ANSI escape.
51
-
52
-
53
- ## FAQ
54
-
55
- ### Why do you test for codes not in the ECMA 48 standard?
56
-
57
- Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
58
-
59
- On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
60
-
61
-
62
- ## Maintainers
63
-
64
- - [Sindre Sorhus](https://github.com/sindresorhus)
65
- - [Josh Junon](https://github.com/qix-)
66
-
67
-
68
- ---
69
-
70
- <div align="center">
71
- <b>
72
- <a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
73
- </b>
74
- <br>
75
- <sub>
76
- Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
77
- </sub>
78
- </div>