@marktrue/dsh-mobile-remote 3.2.2-alpha.1 → 3.2.2-rc.1-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 (353) hide show
  1. package/DSH-Remote-v3.2.2.apk +4 -0
  2. package/README.md +6 -253
  3. package/manifest.json +21 -0
  4. package/package.json +12 -65
  5. package/CHANGELOG.md +0 -1223
  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 -930
  13. package/docs/04-security.md +0 -100
  14. package/docs/05-test-cases.md +0 -366
  15. package/docs/06-install-run.md +0 -372
  16. package/docs/07-user-manual.md +0 -66
  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 -223
  19. package/docs/10-release.md +0 -929
  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/docs/spec-app-auto-update.md +0 -143
  30. package/lib/account-usage.js +0 -145
  31. package/lib/app-alignment.js +0 -112
  32. package/lib/app-carrier-store.js +0 -1972
  33. package/lib/app-carrier.js +0 -609
  34. package/lib/client.js +0 -1174
  35. package/lib/desktop-form.js +0 -738
  36. package/lib/endpoint-registry.js +0 -165
  37. package/lib/git-read-bundled-provider.js +0 -255
  38. package/lib/git-read-service.js +0 -322
  39. package/lib/index.js +0 -9467
  40. package/lib/npm-update-source.js +0 -226
  41. package/lib/plugin-content-digest.js +0 -80
  42. package/lib/plugin-self-update.js +0 -997
  43. package/lib/plugin-update-controller.js +0 -274
  44. package/lib/plugin-update-log.js +0 -164
  45. package/lib/plugin-update-transaction.js +0 -322
  46. package/lib/plugin-update.js +0 -309
  47. package/lib/runtime-dependency-snapshot.js +0 -345
  48. package/lib/session-title-cache.js +0 -123
  49. package/lib/session-title-refresh.js +0 -261
  50. package/lib/tool-process.js +0 -20
  51. package/lib/update-fetch.js +0 -24
  52. package/lib/update-lock-arbiter.js +0 -170
  53. package/lib/update-supervisor.js +0 -346
  54. package/node_modules/ansi-regex/index.d.ts +0 -37
  55. package/node_modules/ansi-regex/index.js +0 -10
  56. package/node_modules/ansi-regex/license +0 -9
  57. package/node_modules/ansi-regex/package.json +0 -55
  58. package/node_modules/ansi-regex/readme.md +0 -78
  59. package/node_modules/ansi-styles/index.d.ts +0 -345
  60. package/node_modules/ansi-styles/index.js +0 -163
  61. package/node_modules/ansi-styles/license +0 -9
  62. package/node_modules/ansi-styles/package.json +0 -56
  63. package/node_modules/ansi-styles/readme.md +0 -152
  64. package/node_modules/camelcase/index.d.ts +0 -63
  65. package/node_modules/camelcase/index.js +0 -76
  66. package/node_modules/camelcase/license +0 -9
  67. package/node_modules/camelcase/package.json +0 -43
  68. package/node_modules/camelcase/readme.md +0 -99
  69. package/node_modules/cliui/CHANGELOG.md +0 -76
  70. package/node_modules/cliui/LICENSE.txt +0 -14
  71. package/node_modules/cliui/README.md +0 -115
  72. package/node_modules/cliui/index.js +0 -354
  73. package/node_modules/cliui/package.json +0 -65
  74. package/node_modules/color-convert/CHANGELOG.md +0 -54
  75. package/node_modules/color-convert/LICENSE +0 -21
  76. package/node_modules/color-convert/README.md +0 -68
  77. package/node_modules/color-convert/conversions.js +0 -839
  78. package/node_modules/color-convert/index.js +0 -81
  79. package/node_modules/color-convert/package.json +0 -48
  80. package/node_modules/color-convert/route.js +0 -97
  81. package/node_modules/color-name/LICENSE +0 -8
  82. package/node_modules/color-name/README.md +0 -11
  83. package/node_modules/color-name/index.js +0 -152
  84. package/node_modules/color-name/package.json +0 -28
  85. package/node_modules/decamelize/index.js +0 -13
  86. package/node_modules/decamelize/license +0 -21
  87. package/node_modules/decamelize/package.json +0 -38
  88. package/node_modules/decamelize/readme.md +0 -48
  89. package/node_modules/dijkstrajs/.travis.yml +0 -4
  90. package/node_modules/dijkstrajs/CONTRIBUTING.md +0 -8
  91. package/node_modules/dijkstrajs/LICENSE.md +0 -19
  92. package/node_modules/dijkstrajs/README.md +0 -18
  93. package/node_modules/dijkstrajs/dijkstra.js +0 -165
  94. package/node_modules/dijkstrajs/package.json +0 -60
  95. package/node_modules/dijkstrajs/test/dijkstra.test.js +0 -96
  96. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  97. package/node_modules/emoji-regex/README.md +0 -73
  98. package/node_modules/emoji-regex/es2015/index.js +0 -6
  99. package/node_modules/emoji-regex/es2015/text.js +0 -6
  100. package/node_modules/emoji-regex/index.d.ts +0 -23
  101. package/node_modules/emoji-regex/index.js +0 -6
  102. package/node_modules/emoji-regex/package.json +0 -50
  103. package/node_modules/emoji-regex/text.js +0 -6
  104. package/node_modules/find-up/index.d.ts +0 -137
  105. package/node_modules/find-up/index.js +0 -89
  106. package/node_modules/find-up/license +0 -9
  107. package/node_modules/find-up/package.json +0 -53
  108. package/node_modules/find-up/readme.md +0 -156
  109. package/node_modules/get-caller-file/LICENSE.md +0 -6
  110. package/node_modules/get-caller-file/README.md +0 -41
  111. package/node_modules/get-caller-file/index.d.ts +0 -2
  112. package/node_modules/get-caller-file/index.js +0 -22
  113. package/node_modules/get-caller-file/index.js.map +0 -1
  114. package/node_modules/get-caller-file/package.json +0 -42
  115. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  116. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  117. package/node_modules/is-fullwidth-code-point/license +0 -9
  118. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  119. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  120. package/node_modules/locate-path/index.d.ts +0 -83
  121. package/node_modules/locate-path/index.js +0 -65
  122. package/node_modules/locate-path/license +0 -9
  123. package/node_modules/locate-path/package.json +0 -45
  124. package/node_modules/locate-path/readme.md +0 -122
  125. package/node_modules/p-limit/index.d.ts +0 -38
  126. package/node_modules/p-limit/index.js +0 -57
  127. package/node_modules/p-limit/license +0 -9
  128. package/node_modules/p-limit/package.json +0 -52
  129. package/node_modules/p-limit/readme.md +0 -101
  130. package/node_modules/p-locate/index.d.ts +0 -64
  131. package/node_modules/p-locate/index.js +0 -52
  132. package/node_modules/p-locate/license +0 -9
  133. package/node_modules/p-locate/package.json +0 -53
  134. package/node_modules/p-locate/readme.md +0 -90
  135. package/node_modules/p-try/index.d.ts +0 -39
  136. package/node_modules/p-try/index.js +0 -9
  137. package/node_modules/p-try/license +0 -9
  138. package/node_modules/p-try/package.json +0 -42
  139. package/node_modules/p-try/readme.md +0 -58
  140. package/node_modules/path-exists/index.d.ts +0 -28
  141. package/node_modules/path-exists/index.js +0 -23
  142. package/node_modules/path-exists/license +0 -9
  143. package/node_modules/path-exists/package.json +0 -39
  144. package/node_modules/path-exists/readme.md +0 -52
  145. package/node_modules/pngjs/.eslintignore +0 -2
  146. package/node_modules/pngjs/.eslintrc.json +0 -19
  147. package/node_modules/pngjs/.prettierignore +0 -3
  148. package/node_modules/pngjs/LICENSE +0 -20
  149. package/node_modules/pngjs/README.md +0 -429
  150. package/node_modules/pngjs/browser.js +0 -16096
  151. package/node_modules/pngjs/coverage/lcov-report/base.css +0 -354
  152. package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +0 -881
  153. package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +0 -554
  154. package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +0 -77
  155. package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +0 -647
  156. package/node_modules/pngjs/coverage/lcov-report/constants.js.html +0 -176
  157. package/node_modules/pngjs/coverage/lcov-report/crc.js.html +0 -200
  158. package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
  159. package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +0 -593
  160. package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +0 -152
  161. package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +0 -143
  162. package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +0 -611
  163. package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +0 -359
  164. package/node_modules/pngjs/coverage/lcov-report/index.html +0 -426
  165. package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +0 -365
  166. package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +0 -230
  167. package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +0 -248
  168. package/node_modules/pngjs/coverage/lcov-report/packer.js.html +0 -467
  169. package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +0 -128
  170. package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +0 -575
  171. package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +0 -404
  172. package/node_modules/pngjs/coverage/lcov-report/parser.js.html +0 -950
  173. package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +0 -116
  174. package/node_modules/pngjs/coverage/lcov-report/png.js.html +0 -662
  175. package/node_modules/pngjs/coverage/lcov-report/prettify.css +0 -101
  176. package/node_modules/pngjs/coverage/lcov-report/prettify.js +0 -1007
  177. package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  178. package/node_modules/pngjs/coverage/lcov-report/sorter.js +0 -169
  179. package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +0 -584
  180. package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +0 -215
  181. package/node_modules/pngjs/coverage/lcov.info +0 -2177
  182. package/node_modules/pngjs/lib/bitmapper.js +0 -267
  183. package/node_modules/pngjs/lib/bitpacker.js +0 -158
  184. package/node_modules/pngjs/lib/chunkstream.js +0 -189
  185. package/node_modules/pngjs/lib/constants.js +0 -32
  186. package/node_modules/pngjs/lib/crc.js +0 -40
  187. package/node_modules/pngjs/lib/filter-pack.js +0 -171
  188. package/node_modules/pngjs/lib/filter-parse-async.js +0 -24
  189. package/node_modules/pngjs/lib/filter-parse-sync.js +0 -21
  190. package/node_modules/pngjs/lib/filter-parse.js +0 -177
  191. package/node_modules/pngjs/lib/format-normaliser.js +0 -93
  192. package/node_modules/pngjs/lib/interlace.js +0 -95
  193. package/node_modules/pngjs/lib/packer-async.js +0 -50
  194. package/node_modules/pngjs/lib/packer-sync.js +0 -56
  195. package/node_modules/pngjs/lib/packer.js +0 -129
  196. package/node_modules/pngjs/lib/paeth-predictor.js +0 -16
  197. package/node_modules/pngjs/lib/parser-async.js +0 -165
  198. package/node_modules/pngjs/lib/parser-sync.js +0 -108
  199. package/node_modules/pngjs/lib/parser.js +0 -290
  200. package/node_modules/pngjs/lib/png-sync.js +0 -12
  201. package/node_modules/pngjs/lib/png.js +0 -194
  202. package/node_modules/pngjs/lib/sync-inflate.js +0 -168
  203. package/node_modules/pngjs/lib/sync-reader.js +0 -45
  204. package/node_modules/pngjs/package.json +0 -73
  205. package/node_modules/qrcode/README.md +0 -770
  206. package/node_modules/qrcode/bin/qrcode +0 -159
  207. package/node_modules/qrcode/helper/to-sjis-browser.js +0 -2
  208. package/node_modules/qrcode/helper/to-sjis.js +0 -105
  209. package/node_modules/qrcode/lib/browser.js +0 -76
  210. package/node_modules/qrcode/lib/can-promise.js +0 -7
  211. package/node_modules/qrcode/lib/core/alignment-pattern.js +0 -83
  212. package/node_modules/qrcode/lib/core/alphanumeric-data.js +0 -59
  213. package/node_modules/qrcode/lib/core/bit-buffer.js +0 -37
  214. package/node_modules/qrcode/lib/core/bit-matrix.js +0 -65
  215. package/node_modules/qrcode/lib/core/byte-data.js +0 -30
  216. package/node_modules/qrcode/lib/core/error-correction-code.js +0 -135
  217. package/node_modules/qrcode/lib/core/error-correction-level.js +0 -50
  218. package/node_modules/qrcode/lib/core/finder-pattern.js +0 -22
  219. package/node_modules/qrcode/lib/core/format-info.js +0 -29
  220. package/node_modules/qrcode/lib/core/galois-field.js +0 -69
  221. package/node_modules/qrcode/lib/core/kanji-data.js +0 -54
  222. package/node_modules/qrcode/lib/core/mask-pattern.js +0 -234
  223. package/node_modules/qrcode/lib/core/mode.js +0 -167
  224. package/node_modules/qrcode/lib/core/numeric-data.js +0 -43
  225. package/node_modules/qrcode/lib/core/polynomial.js +0 -62
  226. package/node_modules/qrcode/lib/core/qrcode.js +0 -495
  227. package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +0 -56
  228. package/node_modules/qrcode/lib/core/regex.js +0 -31
  229. package/node_modules/qrcode/lib/core/segments.js +0 -330
  230. package/node_modules/qrcode/lib/core/utils.js +0 -63
  231. package/node_modules/qrcode/lib/core/version-check.js +0 -9
  232. package/node_modules/qrcode/lib/core/version.js +0 -163
  233. package/node_modules/qrcode/lib/index.js +0 -12
  234. package/node_modules/qrcode/lib/renderer/canvas.js +0 -63
  235. package/node_modules/qrcode/lib/renderer/png.js +0 -78
  236. package/node_modules/qrcode/lib/renderer/svg-tag.js +0 -81
  237. package/node_modules/qrcode/lib/renderer/svg.js +0 -19
  238. package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +0 -85
  239. package/node_modules/qrcode/lib/renderer/terminal/terminal.js +0 -49
  240. package/node_modules/qrcode/lib/renderer/terminal.js +0 -9
  241. package/node_modules/qrcode/lib/renderer/utf8.js +0 -71
  242. package/node_modules/qrcode/lib/renderer/utils.js +0 -99
  243. package/node_modules/qrcode/lib/server.js +0 -138
  244. package/node_modules/qrcode/license +0 -10
  245. package/node_modules/qrcode/package.json +0 -77
  246. package/node_modules/require-directory/.jshintrc +0 -67
  247. package/node_modules/require-directory/.npmignore +0 -1
  248. package/node_modules/require-directory/.travis.yml +0 -3
  249. package/node_modules/require-directory/LICENSE +0 -22
  250. package/node_modules/require-directory/README.markdown +0 -184
  251. package/node_modules/require-directory/index.js +0 -86
  252. package/node_modules/require-directory/package.json +0 -40
  253. package/node_modules/require-main-filename/CHANGELOG.md +0 -26
  254. package/node_modules/require-main-filename/LICENSE.txt +0 -14
  255. package/node_modules/require-main-filename/README.md +0 -26
  256. package/node_modules/require-main-filename/index.js +0 -18
  257. package/node_modules/require-main-filename/package.json +0 -35
  258. package/node_modules/set-blocking/CHANGELOG.md +0 -26
  259. package/node_modules/set-blocking/LICENSE.txt +0 -14
  260. package/node_modules/set-blocking/README.md +0 -31
  261. package/node_modules/set-blocking/index.js +0 -7
  262. package/node_modules/set-blocking/package.json +0 -42
  263. package/node_modules/string-width/index.d.ts +0 -29
  264. package/node_modules/string-width/index.js +0 -47
  265. package/node_modules/string-width/license +0 -9
  266. package/node_modules/string-width/package.json +0 -56
  267. package/node_modules/string-width/readme.md +0 -50
  268. package/node_modules/strip-ansi/index.d.ts +0 -17
  269. package/node_modules/strip-ansi/index.js +0 -4
  270. package/node_modules/strip-ansi/license +0 -9
  271. package/node_modules/strip-ansi/package.json +0 -54
  272. package/node_modules/strip-ansi/readme.md +0 -46
  273. package/node_modules/which-module/LICENSE +0 -13
  274. package/node_modules/which-module/README.md +0 -58
  275. package/node_modules/which-module/index.js +0 -9
  276. package/node_modules/which-module/package.json +0 -41
  277. package/node_modules/wrap-ansi/index.js +0 -186
  278. package/node_modules/wrap-ansi/license +0 -9
  279. package/node_modules/wrap-ansi/package.json +0 -61
  280. package/node_modules/wrap-ansi/readme.md +0 -97
  281. package/node_modules/y18n/CHANGELOG.md +0 -35
  282. package/node_modules/y18n/LICENSE +0 -13
  283. package/node_modules/y18n/README.md +0 -109
  284. package/node_modules/y18n/index.js +0 -188
  285. package/node_modules/y18n/package.json +0 -39
  286. package/node_modules/yargs/CHANGELOG.md +0 -420
  287. package/node_modules/yargs/LICENSE +0 -21
  288. package/node_modules/yargs/README.md +0 -140
  289. package/node_modules/yargs/build/lib/apply-extends.d.ts +0 -2
  290. package/node_modules/yargs/build/lib/apply-extends.js +0 -65
  291. package/node_modules/yargs/build/lib/argsert.d.ts +0 -2
  292. package/node_modules/yargs/build/lib/argsert.js +0 -65
  293. package/node_modules/yargs/build/lib/command.d.ts +0 -64
  294. package/node_modules/yargs/build/lib/command.js +0 -416
  295. package/node_modules/yargs/build/lib/common-types.d.ts +0 -36
  296. package/node_modules/yargs/build/lib/common-types.js +0 -25
  297. package/node_modules/yargs/build/lib/completion-templates.d.ts +0 -2
  298. package/node_modules/yargs/build/lib/completion-templates.js +0 -50
  299. package/node_modules/yargs/build/lib/completion.d.ts +0 -21
  300. package/node_modules/yargs/build/lib/completion.js +0 -135
  301. package/node_modules/yargs/build/lib/is-promise.d.ts +0 -1
  302. package/node_modules/yargs/build/lib/is-promise.js +0 -9
  303. package/node_modules/yargs/build/lib/levenshtein.d.ts +0 -1
  304. package/node_modules/yargs/build/lib/levenshtein.js +0 -58
  305. package/node_modules/yargs/build/lib/middleware.d.ts +0 -10
  306. package/node_modules/yargs/build/lib/middleware.js +0 -57
  307. package/node_modules/yargs/build/lib/obj-filter.d.ts +0 -1
  308. package/node_modules/yargs/build/lib/obj-filter.js +0 -14
  309. package/node_modules/yargs/build/lib/parse-command.d.ts +0 -11
  310. package/node_modules/yargs/build/lib/parse-command.js +0 -36
  311. package/node_modules/yargs/build/lib/process-argv.d.ts +0 -2
  312. package/node_modules/yargs/build/lib/process-argv.js +0 -31
  313. package/node_modules/yargs/build/lib/usage.d.ts +0 -49
  314. package/node_modules/yargs/build/lib/usage.js +0 -540
  315. package/node_modules/yargs/build/lib/validation.d.ts +0 -34
  316. package/node_modules/yargs/build/lib/validation.js +0 -330
  317. package/node_modules/yargs/build/lib/yargs.d.ts +0 -274
  318. package/node_modules/yargs/build/lib/yargs.js +0 -1190
  319. package/node_modules/yargs/build/lib/yerror.d.ts +0 -4
  320. package/node_modules/yargs/build/lib/yerror.js +0 -11
  321. package/node_modules/yargs/index.js +0 -40
  322. package/node_modules/yargs/locales/be.json +0 -46
  323. package/node_modules/yargs/locales/de.json +0 -46
  324. package/node_modules/yargs/locales/en.json +0 -51
  325. package/node_modules/yargs/locales/es.json +0 -46
  326. package/node_modules/yargs/locales/fi.json +0 -49
  327. package/node_modules/yargs/locales/fr.json +0 -53
  328. package/node_modules/yargs/locales/hi.json +0 -49
  329. package/node_modules/yargs/locales/hu.json +0 -46
  330. package/node_modules/yargs/locales/id.json +0 -50
  331. package/node_modules/yargs/locales/it.json +0 -46
  332. package/node_modules/yargs/locales/ja.json +0 -51
  333. package/node_modules/yargs/locales/ko.json +0 -49
  334. package/node_modules/yargs/locales/nb.json +0 -44
  335. package/node_modules/yargs/locales/nl.json +0 -49
  336. package/node_modules/yargs/locales/nn.json +0 -44
  337. package/node_modules/yargs/locales/pirate.json +0 -13
  338. package/node_modules/yargs/locales/pl.json +0 -49
  339. package/node_modules/yargs/locales/pt.json +0 -45
  340. package/node_modules/yargs/locales/pt_BR.json +0 -48
  341. package/node_modules/yargs/locales/ru.json +0 -46
  342. package/node_modules/yargs/locales/th.json +0 -46
  343. package/node_modules/yargs/locales/tr.json +0 -48
  344. package/node_modules/yargs/locales/zh_CN.json +0 -48
  345. package/node_modules/yargs/locales/zh_TW.json +0 -47
  346. package/node_modules/yargs/package.json +0 -92
  347. package/node_modules/yargs/yargs.js +0 -14
  348. package/node_modules/yargs-parser/CHANGELOG.md +0 -601
  349. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  350. package/node_modules/yargs-parser/README.md +0 -449
  351. package/node_modules/yargs-parser/index.js +0 -1032
  352. package/node_modules/yargs-parser/lib/tokenize-arg-string.js +0 -40
  353. package/node_modules/yargs-parser/package.json +0 -46
@@ -1,186 +0,0 @@
1
- 'use strict';
2
- const stringWidth = require('string-width');
3
- const stripAnsi = require('strip-ansi');
4
- const ansiStyles = require('ansi-styles');
5
-
6
- const ESCAPES = new Set([
7
- '\u001B',
8
- '\u009B'
9
- ]);
10
-
11
- const END_CODE = 39;
12
-
13
- const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`;
14
-
15
- // Calculate the length of words split on ' ', ignoring
16
- // the extra characters added by ansi escape codes
17
- const wordLengths = string => string.split(' ').map(character => stringWidth(character));
18
-
19
- // Wrap a long word across multiple rows
20
- // Ansi escape codes do not count towards length
21
- const wrapWord = (rows, word, columns) => {
22
- const characters = [...word];
23
-
24
- let isInsideEscape = false;
25
- let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
26
-
27
- for (const [index, character] of characters.entries()) {
28
- const characterLength = stringWidth(character);
29
-
30
- if (visible + characterLength <= columns) {
31
- rows[rows.length - 1] += character;
32
- } else {
33
- rows.push(character);
34
- visible = 0;
35
- }
36
-
37
- if (ESCAPES.has(character)) {
38
- isInsideEscape = true;
39
- } else if (isInsideEscape && character === 'm') {
40
- isInsideEscape = false;
41
- continue;
42
- }
43
-
44
- if (isInsideEscape) {
45
- continue;
46
- }
47
-
48
- visible += characterLength;
49
-
50
- if (visible === columns && index < characters.length - 1) {
51
- rows.push('');
52
- visible = 0;
53
- }
54
- }
55
-
56
- // It's possible that the last row we copy over is only
57
- // ansi escape characters, handle this edge-case
58
- if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
59
- rows[rows.length - 2] += rows.pop();
60
- }
61
- };
62
-
63
- // Trims spaces from a string ignoring invisible sequences
64
- const stringVisibleTrimSpacesRight = str => {
65
- const words = str.split(' ');
66
- let last = words.length;
67
-
68
- while (last > 0) {
69
- if (stringWidth(words[last - 1]) > 0) {
70
- break;
71
- }
72
-
73
- last--;
74
- }
75
-
76
- if (last === words.length) {
77
- return str;
78
- }
79
-
80
- return words.slice(0, last).join(' ') + words.slice(last).join('');
81
- };
82
-
83
- // The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
84
- //
85
- // 'hard' will never allow a string to take up more than columns characters
86
- //
87
- // 'soft' allows long words to expand past the column length
88
- const exec = (string, columns, options = {}) => {
89
- if (options.trim !== false && string.trim() === '') {
90
- return '';
91
- }
92
-
93
- let pre = '';
94
- let ret = '';
95
- let escapeCode;
96
-
97
- const lengths = wordLengths(string);
98
- let rows = [''];
99
-
100
- for (const [index, word] of string.split(' ').entries()) {
101
- if (options.trim !== false) {
102
- rows[rows.length - 1] = rows[rows.length - 1].trimLeft();
103
- }
104
-
105
- let rowLength = stringWidth(rows[rows.length - 1]);
106
-
107
- if (index !== 0) {
108
- if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
109
- // If we start with a new word but the current row length equals the length of the columns, add a new row
110
- rows.push('');
111
- rowLength = 0;
112
- }
113
-
114
- if (rowLength > 0 || options.trim === false) {
115
- rows[rows.length - 1] += ' ';
116
- rowLength++;
117
- }
118
- }
119
-
120
- // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
121
- if (options.hard && lengths[index] > columns) {
122
- const remainingColumns = (columns - rowLength);
123
- const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
124
- const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
125
- if (breaksStartingNextLine < breaksStartingThisLine) {
126
- rows.push('');
127
- }
128
-
129
- wrapWord(rows, word, columns);
130
- continue;
131
- }
132
-
133
- if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
134
- if (options.wordWrap === false && rowLength < columns) {
135
- wrapWord(rows, word, columns);
136
- continue;
137
- }
138
-
139
- rows.push('');
140
- }
141
-
142
- if (rowLength + lengths[index] > columns && options.wordWrap === false) {
143
- wrapWord(rows, word, columns);
144
- continue;
145
- }
146
-
147
- rows[rows.length - 1] += word;
148
- }
149
-
150
- if (options.trim !== false) {
151
- rows = rows.map(stringVisibleTrimSpacesRight);
152
- }
153
-
154
- pre = rows.join('\n');
155
-
156
- for (const [index, character] of [...pre].entries()) {
157
- ret += character;
158
-
159
- if (ESCAPES.has(character)) {
160
- const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4)));
161
- escapeCode = code === END_CODE ? null : code;
162
- }
163
-
164
- const code = ansiStyles.codes.get(Number(escapeCode));
165
-
166
- if (escapeCode && code) {
167
- if (pre[index + 1] === '\n') {
168
- ret += wrapAnsi(code);
169
- } else if (character === '\n') {
170
- ret += wrapAnsi(escapeCode);
171
- }
172
- }
173
- }
174
-
175
- return ret;
176
- };
177
-
178
- // For each newline, invoke the method separately
179
- module.exports = (string, columns, options) => {
180
- return String(string)
181
- .normalize()
182
- .replace(/\r\n/g, '\n')
183
- .split('\n')
184
- .map(line => exec(line, columns, options))
185
- .join('\n');
186
- };
@@ -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,61 +0,0 @@
1
- {
2
- "name": "wrap-ansi",
3
- "version": "6.2.0",
4
- "description": "Wordwrap a string with ANSI escape codes",
5
- "license": "MIT",
6
- "repository": "chalk/wrap-ansi",
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 && nyc ava"
17
- },
18
- "files": [
19
- "index.js"
20
- ],
21
- "keywords": [
22
- "wrap",
23
- "break",
24
- "wordwrap",
25
- "wordbreak",
26
- "linewrap",
27
- "ansi",
28
- "styles",
29
- "color",
30
- "colour",
31
- "colors",
32
- "terminal",
33
- "console",
34
- "cli",
35
- "string",
36
- "tty",
37
- "escape",
38
- "formatting",
39
- "rgb",
40
- "256",
41
- "shell",
42
- "xterm",
43
- "log",
44
- "logging",
45
- "command-line",
46
- "text"
47
- ],
48
- "dependencies": {
49
- "ansi-styles": "^4.0.0",
50
- "string-width": "^4.1.0",
51
- "strip-ansi": "^6.0.0"
52
- },
53
- "devDependencies": {
54
- "ava": "^2.1.0",
55
- "chalk": "^2.4.2",
56
- "coveralls": "^3.0.3",
57
- "has-ansi": "^3.0.0",
58
- "nyc": "^14.1.1",
59
- "xo": "^0.24.0"
60
- }
61
- }
@@ -1,97 +0,0 @@
1
- # wrap-ansi [![Build Status](https://travis-ci.org/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.org/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master)
2
-
3
- > Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
4
-
5
-
6
- ## Install
7
-
8
- ```
9
- $ npm install wrap-ansi
10
- ```
11
-
12
-
13
- ## Usage
14
-
15
- ```js
16
- const chalk = require('chalk');
17
- const wrapAnsi = require('wrap-ansi');
18
-
19
- const input = 'The quick brown ' + chalk.red('fox jumped over ') +
20
- 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
21
-
22
- console.log(wrapAnsi(input, 20));
23
- ```
24
-
25
- <img width="331" src="screenshot.png">
26
-
27
-
28
- ## API
29
-
30
- ### wrapAnsi(string, columns, options?)
31
-
32
- Wrap words to the specified column width.
33
-
34
- #### string
35
-
36
- Type: `string`
37
-
38
- String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
39
-
40
- #### columns
41
-
42
- Type: `number`
43
-
44
- Number of columns to wrap the text to.
45
-
46
- #### options
47
-
48
- Type: `object`
49
-
50
- ##### hard
51
-
52
- Type: `boolean`<br>
53
- Default: `false`
54
-
55
- By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
56
-
57
- ##### wordWrap
58
-
59
- Type: `boolean`<br>
60
- Default: `true`
61
-
62
- By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
63
-
64
- ##### trim
65
-
66
- Type: `boolean`<br>
67
- Default: `true`
68
-
69
- Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
70
-
71
-
72
- ## Related
73
-
74
- - [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
75
- - [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
76
- - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
77
- - [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures.
78
-
79
-
80
- ## Maintainers
81
-
82
- - [Sindre Sorhus](https://github.com/sindresorhus)
83
- - [Josh Junon](https://github.com/qix-)
84
- - [Benjamin Coe](https://github.com/bcoe)
85
-
86
-
87
- ---
88
-
89
- <div align="center">
90
- <b>
91
- <a href="https://tidelift.com/subscription/pkg/npm-wrap_ansi?utm_source=npm-wrap-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
92
- </b>
93
- <br>
94
- <sub>
95
- Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
96
- </sub>
97
- </div>
@@ -1,35 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
-
6
- ### [4.0.3](https://www.github.com/yargs/y18n/compare/y18n-v4.0.2...y18n-v4.0.3) (2021-04-07)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **release:** 4.x.x should not enforce Node 10 ([#126](https://www.github.com/yargs/y18n/issues/126)) ([1e21a53](https://www.github.com/yargs/y18n/commit/1e21a536e9135d8403a47be88922157a706b7cde))
12
-
13
- ### 4.0.1 (2020-11-30)
14
-
15
- ### Bug Fixes
16
-
17
- * address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25))
18
-
19
- <a name="4.0.0"></a>
20
- # [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10)
21
-
22
-
23
- ### Bug Fixes
24
-
25
- * allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123))
26
-
27
-
28
- ### Features
29
-
30
- * **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf))
31
-
32
-
33
- ### BREAKING CHANGES
34
-
35
- * **__:** dropping Node 0.10/Node 0.12 support
@@ -1,13 +0,0 @@
1
- Copyright (c) 2015, Contributors
2
-
3
- Permission to use, copy, modify, and/or distribute this software for any purpose
4
- with or without fee is hereby granted, provided that the above copyright notice
5
- and this permission notice appear in all copies.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
- FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
- THIS SOFTWARE.
@@ -1,109 +0,0 @@
1
- # y18n
2
-
3
- [![Build Status][travis-image]][travis-url]
4
- [![Coverage Status][coveralls-image]][coveralls-url]
5
- [![NPM version][npm-image]][npm-url]
6
- [![js-standard-style][standard-image]][standard-url]
7
- [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
8
-
9
- The bare-bones internationalization library used by yargs.
10
-
11
- Inspired by [i18n](https://www.npmjs.com/package/i18n).
12
-
13
- ## Examples
14
-
15
- _simple string translation:_
16
-
17
- ```js
18
- var __ = require('y18n').__
19
-
20
- console.log(__('my awesome string %s', 'foo'))
21
- ```
22
-
23
- output:
24
-
25
- `my awesome string foo`
26
-
27
- _using tagged template literals_
28
-
29
- ```js
30
- var __ = require('y18n').__
31
- var str = 'foo'
32
-
33
- console.log(__`my awesome string ${str}`)
34
- ```
35
-
36
- output:
37
-
38
- `my awesome string foo`
39
-
40
- _pluralization support:_
41
-
42
- ```js
43
- var __n = require('y18n').__n
44
-
45
- console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'))
46
- ```
47
-
48
- output:
49
-
50
- `2 fishes foo`
51
-
52
- ## JSON Language Files
53
-
54
- The JSON language files should be stored in a `./locales` folder.
55
- File names correspond to locales, e.g., `en.json`, `pirate.json`.
56
-
57
- When strings are observed for the first time they will be
58
- added to the JSON file corresponding to the current locale.
59
-
60
- ## Methods
61
-
62
- ### require('y18n')(config)
63
-
64
- Create an instance of y18n with the config provided, options include:
65
-
66
- * `directory`: the locale directory, default `./locales`.
67
- * `updateFiles`: should newly observed strings be updated in file, default `true`.
68
- * `locale`: what locale should be used.
69
- * `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`)
70
- be allowed if a file matching the locale does not exist (e.g. `en_US.json`),
71
- default `true`.
72
-
73
- ### y18n.\_\_(str, arg, arg, arg)
74
-
75
- Print a localized string, `%s` will be replaced with `arg`s.
76
-
77
- This function can also be used as a tag for a template literal. You can use it
78
- like this: <code>__&#96;hello ${'world'}&#96;</code>. This will be equivalent to
79
- `__('hello %s', 'world')`.
80
-
81
- ### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg)
82
-
83
- Print a localized string with appropriate pluralization. If `%d` is provided
84
- in the string, the `count` will replace this placeholder.
85
-
86
- ### y18n.setLocale(str)
87
-
88
- Set the current locale being used.
89
-
90
- ### y18n.getLocale()
91
-
92
- What locale is currently being used?
93
-
94
- ### y18n.updateLocale(obj)
95
-
96
- Update the current locale with the key value pairs in `obj`.
97
-
98
- ## License
99
-
100
- ISC
101
-
102
- [travis-url]: https://travis-ci.org/yargs/y18n
103
- [travis-image]: https://img.shields.io/travis/yargs/y18n.svg
104
- [coveralls-url]: https://coveralls.io/github/yargs/y18n
105
- [coveralls-image]: https://img.shields.io/coveralls/yargs/y18n.svg
106
- [npm-url]: https://npmjs.org/package/y18n
107
- [npm-image]: https://img.shields.io/npm/v/y18n.svg
108
- [standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
109
- [standard-url]: https://github.com/feross/standard
@@ -1,188 +0,0 @@
1
- var fs = require('fs')
2
- var path = require('path')
3
- var util = require('util')
4
-
5
- function Y18N (opts) {
6
- // configurable options.
7
- opts = opts || {}
8
- this.directory = opts.directory || './locales'
9
- this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true
10
- this.locale = opts.locale || 'en'
11
- this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true
12
-
13
- // internal stuff.
14
- this.cache = Object.create(null)
15
- this.writeQueue = []
16
- }
17
-
18
- Y18N.prototype.__ = function () {
19
- if (typeof arguments[0] !== 'string') {
20
- return this._taggedLiteral.apply(this, arguments)
21
- }
22
- var args = Array.prototype.slice.call(arguments)
23
- var str = args.shift()
24
- var cb = function () {} // start with noop.
25
-
26
- if (typeof args[args.length - 1] === 'function') cb = args.pop()
27
- cb = cb || function () {} // noop.
28
-
29
- if (!this.cache[this.locale]) this._readLocaleFile()
30
-
31
- // we've observed a new string, update the language file.
32
- if (!this.cache[this.locale][str] && this.updateFiles) {
33
- this.cache[this.locale][str] = str
34
-
35
- // include the current directory and locale,
36
- // since these values could change before the
37
- // write is performed.
38
- this._enqueueWrite([this.directory, this.locale, cb])
39
- } else {
40
- cb()
41
- }
42
-
43
- return util.format.apply(util, [this.cache[this.locale][str] || str].concat(args))
44
- }
45
-
46
- Y18N.prototype._taggedLiteral = function (parts) {
47
- var args = arguments
48
- var str = ''
49
- parts.forEach(function (part, i) {
50
- var arg = args[i + 1]
51
- str += part
52
- if (typeof arg !== 'undefined') {
53
- str += '%s'
54
- }
55
- })
56
- return this.__.apply(null, [str].concat([].slice.call(arguments, 1)))
57
- }
58
-
59
- Y18N.prototype._enqueueWrite = function (work) {
60
- this.writeQueue.push(work)
61
- if (this.writeQueue.length === 1) this._processWriteQueue()
62
- }
63
-
64
- Y18N.prototype._processWriteQueue = function () {
65
- var _this = this
66
- var work = this.writeQueue[0]
67
-
68
- // destructure the enqueued work.
69
- var directory = work[0]
70
- var locale = work[1]
71
- var cb = work[2]
72
-
73
- var languageFile = this._resolveLocaleFile(directory, locale)
74
- var serializedLocale = JSON.stringify(this.cache[locale], null, 2)
75
-
76
- fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
77
- _this.writeQueue.shift()
78
- if (_this.writeQueue.length > 0) _this._processWriteQueue()
79
- cb(err)
80
- })
81
- }
82
-
83
- Y18N.prototype._readLocaleFile = function () {
84
- var localeLookup = {}
85
- var languageFile = this._resolveLocaleFile(this.directory, this.locale)
86
-
87
- try {
88
- localeLookup = JSON.parse(fs.readFileSync(languageFile, 'utf-8'))
89
- } catch (err) {
90
- if (err instanceof SyntaxError) {
91
- err.message = 'syntax error in ' + languageFile
92
- }
93
-
94
- if (err.code === 'ENOENT') localeLookup = {}
95
- else throw err
96
- }
97
-
98
- this.cache[this.locale] = localeLookup
99
- }
100
-
101
- Y18N.prototype._resolveLocaleFile = function (directory, locale) {
102
- var file = path.resolve(directory, './', locale + '.json')
103
- if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
104
- // attempt fallback to language only
105
- var languageFile = path.resolve(directory, './', locale.split('_')[0] + '.json')
106
- if (this._fileExistsSync(languageFile)) file = languageFile
107
- }
108
- return file
109
- }
110
-
111
- // this only exists because fs.existsSync() "will be deprecated"
112
- // see https://nodejs.org/api/fs.html#fs_fs_existssync_path
113
- Y18N.prototype._fileExistsSync = function (file) {
114
- try {
115
- return fs.statSync(file).isFile()
116
- } catch (err) {
117
- return false
118
- }
119
- }
120
-
121
- Y18N.prototype.__n = function () {
122
- var args = Array.prototype.slice.call(arguments)
123
- var singular = args.shift()
124
- var plural = args.shift()
125
- var quantity = args.shift()
126
-
127
- var cb = function () {} // start with noop.
128
- if (typeof args[args.length - 1] === 'function') cb = args.pop()
129
-
130
- if (!this.cache[this.locale]) this._readLocaleFile()
131
-
132
- var str = quantity === 1 ? singular : plural
133
- if (this.cache[this.locale][singular]) {
134
- str = this.cache[this.locale][singular][quantity === 1 ? 'one' : 'other']
135
- }
136
-
137
- // we've observed a new string, update the language file.
138
- if (!this.cache[this.locale][singular] && this.updateFiles) {
139
- this.cache[this.locale][singular] = {
140
- one: singular,
141
- other: plural
142
- }
143
-
144
- // include the current directory and locale,
145
- // since these values could change before the
146
- // write is performed.
147
- this._enqueueWrite([this.directory, this.locale, cb])
148
- } else {
149
- cb()
150
- }
151
-
152
- // if a %d placeholder is provided, add quantity
153
- // to the arguments expanded by util.format.
154
- var values = [str]
155
- if (~str.indexOf('%d')) values.push(quantity)
156
-
157
- return util.format.apply(util, values.concat(args))
158
- }
159
-
160
- Y18N.prototype.setLocale = function (locale) {
161
- this.locale = locale
162
- }
163
-
164
- Y18N.prototype.getLocale = function () {
165
- return this.locale
166
- }
167
-
168
- Y18N.prototype.updateLocale = function (obj) {
169
- if (!this.cache[this.locale]) this._readLocaleFile()
170
-
171
- for (var key in obj) {
172
- this.cache[this.locale][key] = obj[key]
173
- }
174
- }
175
-
176
- module.exports = function (opts) {
177
- var y18n = new Y18N(opts)
178
-
179
- // bind all functions to y18n, so that
180
- // they can be used in isolation.
181
- for (var key in y18n) {
182
- if (typeof y18n[key] === 'function') {
183
- y18n[key] = y18n[key].bind(y18n)
184
- }
185
- }
186
-
187
- return y18n
188
- }