@socketsecurity/cli-with-sentry 1.1.25 → 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 (914) hide show
  1. package/CHANGELOG.md +51 -218
  2. package/README.md +41 -74
  3. package/dist/cli.js.bz +0 -0
  4. package/dist/cli.js.bz.sha256 +1 -0
  5. package/dist/index.js +2 -0
  6. package/package.json +31 -274
  7. package/bin/cli.js +0 -52
  8. package/bin/npm-cli.js +0 -29
  9. package/bin/npx-cli.js +0 -29
  10. package/bin/pnpm-cli.js +0 -29
  11. package/bin/yarn-cli.js +0 -29
  12. package/dist/cli.js +0 -14999
  13. package/dist/cli.js.map +0 -1
  14. package/dist/constants.js +0 -845
  15. package/dist/constants.js.map +0 -1
  16. package/dist/flags.js +0 -212
  17. package/dist/flags.js.map +0 -1
  18. package/dist/init.gradle +0 -250
  19. package/dist/instrument-with-sentry.js +0 -44
  20. package/dist/instrument-with-sentry.js.map +0 -1
  21. package/dist/npm-cli.js +0 -30
  22. package/dist/npm-cli.js.map +0 -1
  23. package/dist/npx-cli.js +0 -26
  24. package/dist/npx-cli.js.map +0 -1
  25. package/dist/pnpm-cli.js +0 -30
  26. package/dist/pnpm-cli.js.map +0 -1
  27. package/dist/shadow-npm-bin.js +0 -8
  28. package/dist/shadow-npm-bin.js.map +0 -1
  29. package/dist/shadow-npm-bin2.js +0 -102
  30. package/dist/shadow-npm-bin2.js.map +0 -1
  31. package/dist/shadow-npm-inject.js +0 -307
  32. package/dist/shadow-npm-inject.js.map +0 -1
  33. package/dist/shadow-npx-bin.js +0 -12
  34. package/dist/shadow-npx-bin.js.map +0 -1
  35. package/dist/shadow-pnpm-bin.js +0 -8
  36. package/dist/shadow-pnpm-bin.js.map +0 -1
  37. package/dist/shadow-pnpm-bin2.js +0 -300
  38. package/dist/shadow-pnpm-bin2.js.map +0 -1
  39. package/dist/shadow-yarn-bin.js +0 -96
  40. package/dist/shadow-yarn-bin.js.map +0 -1
  41. package/dist/tsconfig.dts.tsbuildinfo +0 -1
  42. package/dist/types/cli.d.mts +0 -3
  43. package/dist/types/cli.d.mts.map +0 -1
  44. package/dist/types/commands/analytics/cmd-analytics.d.mts +0 -10
  45. package/dist/types/commands/analytics/cmd-analytics.d.mts.map +0 -1
  46. package/dist/types/commands/analytics/fetch-org-analytics.d.mts +0 -8
  47. package/dist/types/commands/analytics/fetch-org-analytics.d.mts.map +0 -1
  48. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +0 -8
  49. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts.map +0 -1
  50. package/dist/types/commands/analytics/handle-analytics.d.mts +0 -10
  51. package/dist/types/commands/analytics/handle-analytics.d.mts.map +0 -1
  52. package/dist/types/commands/analytics/output-analytics.d.mts +0 -29
  53. package/dist/types/commands/analytics/output-analytics.d.mts.map +0 -1
  54. package/dist/types/commands/audit-log/cmd-audit-log.d.mts +0 -10
  55. package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +0 -1
  56. package/dist/types/commands/audit-log/fetch-audit-log.d.mts +0 -15
  57. package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +0 -1
  58. package/dist/types/commands/audit-log/handle-audit-log.d.mts +0 -9
  59. package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +0 -1
  60. package/dist/types/commands/audit-log/output-audit-log.d.mts +0 -22
  61. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +0 -1
  62. package/dist/types/commands/ci/cmd-ci.d.mts +0 -9
  63. package/dist/types/commands/ci/cmd-ci.d.mts.map +0 -1
  64. package/dist/types/commands/ci/fetch-default-org-slug.d.mts +0 -4
  65. package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +0 -1
  66. package/dist/types/commands/ci/handle-ci.d.mts +0 -2
  67. package/dist/types/commands/ci/handle-ci.d.mts.map +0 -1
  68. package/dist/types/commands/config/cmd-config-auto.d.mts +0 -10
  69. package/dist/types/commands/config/cmd-config-auto.d.mts.map +0 -1
  70. package/dist/types/commands/config/cmd-config-get.d.mts +0 -9
  71. package/dist/types/commands/config/cmd-config-get.d.mts.map +0 -1
  72. package/dist/types/commands/config/cmd-config-list.d.mts +0 -9
  73. package/dist/types/commands/config/cmd-config-list.d.mts.map +0 -1
  74. package/dist/types/commands/config/cmd-config-set.d.mts +0 -10
  75. package/dist/types/commands/config/cmd-config-set.d.mts.map +0 -1
  76. package/dist/types/commands/config/cmd-config-unset.d.mts +0 -10
  77. package/dist/types/commands/config/cmd-config-unset.d.mts.map +0 -1
  78. package/dist/types/commands/config/cmd-config.d.mts +0 -3
  79. package/dist/types/commands/config/cmd-config.d.mts.map +0 -1
  80. package/dist/types/commands/config/discover-config-value.d.mts +0 -3
  81. package/dist/types/commands/config/discover-config-value.d.mts.map +0 -1
  82. package/dist/types/commands/config/handle-config-auto.d.mts +0 -7
  83. package/dist/types/commands/config/handle-config-auto.d.mts.map +0 -1
  84. package/dist/types/commands/config/handle-config-get.d.mts +0 -7
  85. package/dist/types/commands/config/handle-config-get.d.mts.map +0 -1
  86. package/dist/types/commands/config/handle-config-set.d.mts +0 -8
  87. package/dist/types/commands/config/handle-config-set.d.mts.map +0 -1
  88. package/dist/types/commands/config/handle-config-unset.d.mts +0 -7
  89. package/dist/types/commands/config/handle-config-unset.d.mts.map +0 -1
  90. package/dist/types/commands/config/output-config-auto.d.mts +0 -4
  91. package/dist/types/commands/config/output-config-auto.d.mts.map +0 -1
  92. package/dist/types/commands/config/output-config-get.d.mts +0 -4
  93. package/dist/types/commands/config/output-config-get.d.mts.map +0 -1
  94. package/dist/types/commands/config/output-config-list.d.mts +0 -6
  95. package/dist/types/commands/config/output-config-list.d.mts.map +0 -1
  96. package/dist/types/commands/config/output-config-set.d.mts +0 -3
  97. package/dist/types/commands/config/output-config-set.d.mts.map +0 -1
  98. package/dist/types/commands/config/output-config-unset.d.mts +0 -3
  99. package/dist/types/commands/config/output-config-unset.d.mts.map +0 -1
  100. package/dist/types/commands/fix/cmd-fix.d.mts +0 -10
  101. package/dist/types/commands/fix/cmd-fix.d.mts.map +0 -1
  102. package/dist/types/commands/fix/coana-fix.d.mts +0 -6
  103. package/dist/types/commands/fix/coana-fix.d.mts.map +0 -1
  104. package/dist/types/commands/fix/env-helpers.d.mts +0 -26
  105. package/dist/types/commands/fix/env-helpers.d.mts.map +0 -1
  106. package/dist/types/commands/fix/git.d.mts +0 -13
  107. package/dist/types/commands/fix/git.d.mts.map +0 -1
  108. package/dist/types/commands/fix/handle-fix.d.mts +0 -20
  109. package/dist/types/commands/fix/handle-fix.d.mts.map +0 -1
  110. package/dist/types/commands/fix/output-fix-result.d.mts +0 -3
  111. package/dist/types/commands/fix/output-fix-result.d.mts.map +0 -1
  112. package/dist/types/commands/fix/pull-request.d.mts +0 -31
  113. package/dist/types/commands/fix/pull-request.d.mts.map +0 -1
  114. package/dist/types/commands/fix/types.d.mts +0 -21
  115. package/dist/types/commands/fix/types.d.mts.map +0 -1
  116. package/dist/types/commands/install/cmd-install-completion.d.mts +0 -9
  117. package/dist/types/commands/install/cmd-install-completion.d.mts.map +0 -1
  118. package/dist/types/commands/install/cmd-install.d.mts +0 -3
  119. package/dist/types/commands/install/cmd-install.d.mts.map +0 -1
  120. package/dist/types/commands/install/handle-install-completion.d.mts +0 -2
  121. package/dist/types/commands/install/handle-install-completion.d.mts.map +0 -1
  122. package/dist/types/commands/install/output-install-completion.d.mts +0 -12
  123. package/dist/types/commands/install/output-install-completion.d.mts.map +0 -1
  124. package/dist/types/commands/install/setup-tab-completion.d.mts +0 -13
  125. package/dist/types/commands/install/setup-tab-completion.d.mts.map +0 -1
  126. package/dist/types/commands/json/cmd-json.d.mts +0 -9
  127. package/dist/types/commands/json/cmd-json.d.mts.map +0 -1
  128. package/dist/types/commands/json/handle-cmd-json.d.mts +0 -2
  129. package/dist/types/commands/json/handle-cmd-json.d.mts.map +0 -1
  130. package/dist/types/commands/json/output-cmd-json.d.mts +0 -2
  131. package/dist/types/commands/json/output-cmd-json.d.mts.map +0 -1
  132. package/dist/types/commands/login/apply-login.d.mts +0 -2
  133. package/dist/types/commands/login/apply-login.d.mts.map +0 -1
  134. package/dist/types/commands/login/attempt-login.d.mts +0 -6
  135. package/dist/types/commands/login/attempt-login.d.mts.map +0 -1
  136. package/dist/types/commands/login/cmd-login.d.mts +0 -10
  137. package/dist/types/commands/login/cmd-login.d.mts.map +0 -1
  138. package/dist/types/commands/logout/apply-logout.d.mts +0 -2
  139. package/dist/types/commands/logout/apply-logout.d.mts.map +0 -1
  140. package/dist/types/commands/logout/attempt-logout.d.mts +0 -2
  141. package/dist/types/commands/logout/attempt-logout.d.mts.map +0 -1
  142. package/dist/types/commands/logout/cmd-logout.d.mts +0 -9
  143. package/dist/types/commands/logout/cmd-logout.d.mts.map +0 -1
  144. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +0 -9
  145. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +0 -1
  146. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +0 -9
  147. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +0 -1
  148. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +0 -9
  149. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +0 -1
  150. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +0 -9
  151. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +0 -1
  152. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +0 -9
  153. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +0 -1
  154. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +0 -9
  155. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +0 -1
  156. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +0 -9
  157. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +0 -1
  158. package/dist/types/commands/manifest/cmd-manifest.d.mts +0 -9
  159. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +0 -1
  160. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +0 -8
  161. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +0 -1
  162. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +0 -7
  163. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts.map +0 -1
  164. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +0 -8
  165. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts.map +0 -1
  166. package/dist/types/commands/manifest/detect-manifest-actions.d.mts +0 -13
  167. package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +0 -1
  168. package/dist/types/commands/manifest/generate_auto_manifest.d.mts +0 -9
  169. package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +0 -1
  170. package/dist/types/commands/manifest/handle-manifest-conda.d.mts +0 -9
  171. package/dist/types/commands/manifest/handle-manifest-conda.d.mts.map +0 -1
  172. package/dist/types/commands/manifest/handle-manifest-setup.d.mts +0 -2
  173. package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +0 -1
  174. package/dist/types/commands/manifest/output-manifest-setup.d.mts +0 -3
  175. package/dist/types/commands/manifest/output-manifest-setup.d.mts.map +0 -1
  176. package/dist/types/commands/manifest/output-requirements.d.mts +0 -6
  177. package/dist/types/commands/manifest/output-requirements.d.mts.map +0 -1
  178. package/dist/types/commands/manifest/run-cdxgen.d.mts +0 -6
  179. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +0 -1
  180. package/dist/types/commands/manifest/setup-manifest-config.d.mts +0 -3
  181. package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +0 -1
  182. package/dist/types/commands/npm/cmd-npm.d.mts +0 -10
  183. package/dist/types/commands/npm/cmd-npm.d.mts.map +0 -1
  184. package/dist/types/commands/npx/cmd-npx.d.mts +0 -9
  185. package/dist/types/commands/npx/cmd-npx.d.mts.map +0 -1
  186. package/dist/types/commands/oops/cmd-oops.d.mts +0 -9
  187. package/dist/types/commands/oops/cmd-oops.d.mts.map +0 -1
  188. package/dist/types/commands/optimize/add-overrides.d.mts +0 -20
  189. package/dist/types/commands/optimize/add-overrides.d.mts.map +0 -1
  190. package/dist/types/commands/optimize/apply-optimization.d.mts +0 -14
  191. package/dist/types/commands/optimize/apply-optimization.d.mts.map +0 -1
  192. package/dist/types/commands/optimize/cmd-optimize.d.mts +0 -10
  193. package/dist/types/commands/optimize/cmd-optimize.d.mts.map +0 -1
  194. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +0 -5
  195. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts.map +0 -1
  196. package/dist/types/commands/optimize/get-dependency-entries.d.mts +0 -3
  197. package/dist/types/commands/optimize/get-dependency-entries.d.mts.map +0 -1
  198. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +0 -42
  199. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts.map +0 -1
  200. package/dist/types/commands/optimize/handle-optimize.d.mts +0 -8
  201. package/dist/types/commands/optimize/handle-optimize.d.mts.map +0 -1
  202. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +0 -8
  203. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts.map +0 -1
  204. package/dist/types/commands/optimize/ls-by-agent.d.mts +0 -13
  205. package/dist/types/commands/optimize/ls-by-agent.d.mts.map +0 -1
  206. package/dist/types/commands/optimize/output-optimize-result.d.mts +0 -9
  207. package/dist/types/commands/optimize/output-optimize-result.d.mts.map +0 -1
  208. package/dist/types/commands/optimize/shared.d.mts +0 -2
  209. package/dist/types/commands/optimize/shared.d.mts.map +0 -1
  210. package/dist/types/commands/optimize/types.d.mts +0 -9
  211. package/dist/types/commands/optimize/types.d.mts.map +0 -1
  212. package/dist/types/commands/optimize/update-lockfile.d.mts +0 -11
  213. package/dist/types/commands/optimize/update-lockfile.d.mts.map +0 -1
  214. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +0 -8
  215. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts.map +0 -1
  216. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +0 -10
  217. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +0 -1
  218. package/dist/types/commands/organization/cmd-organization-list.d.mts +0 -10
  219. package/dist/types/commands/organization/cmd-organization-list.d.mts.map +0 -1
  220. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +0 -10
  221. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +0 -1
  222. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +0 -10
  223. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +0 -1
  224. package/dist/types/commands/organization/cmd-organization-policy.d.mts +0 -3
  225. package/dist/types/commands/organization/cmd-organization-policy.d.mts.map +0 -1
  226. package/dist/types/commands/organization/cmd-organization-quota.d.mts +0 -9
  227. package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +0 -1
  228. package/dist/types/commands/organization/cmd-organization.d.mts +0 -3
  229. package/dist/types/commands/organization/cmd-organization.d.mts.map +0 -1
  230. package/dist/types/commands/organization/fetch-dependencies.d.mts +0 -12
  231. package/dist/types/commands/organization/fetch-dependencies.d.mts.map +0 -1
  232. package/dist/types/commands/organization/fetch-license-policy.d.mts +0 -8
  233. package/dist/types/commands/organization/fetch-license-policy.d.mts.map +0 -1
  234. package/dist/types/commands/organization/fetch-organization-list.d.mts +0 -20
  235. package/dist/types/commands/organization/fetch-organization-list.d.mts.map +0 -1
  236. package/dist/types/commands/organization/fetch-quota.d.mts +0 -8
  237. package/dist/types/commands/organization/fetch-quota.d.mts.map +0 -1
  238. package/dist/types/commands/organization/fetch-security-policy.d.mts +0 -8
  239. package/dist/types/commands/organization/fetch-security-policy.d.mts.map +0 -1
  240. package/dist/types/commands/organization/handle-dependencies.d.mts +0 -7
  241. package/dist/types/commands/organization/handle-dependencies.d.mts.map +0 -1
  242. package/dist/types/commands/organization/handle-license-policy.d.mts +0 -3
  243. package/dist/types/commands/organization/handle-license-policy.d.mts.map +0 -1
  244. package/dist/types/commands/organization/handle-organization-list.d.mts +0 -3
  245. package/dist/types/commands/organization/handle-organization-list.d.mts.map +0 -1
  246. package/dist/types/commands/organization/handle-quota.d.mts +0 -3
  247. package/dist/types/commands/organization/handle-quota.d.mts.map +0 -1
  248. package/dist/types/commands/organization/handle-security-policy.d.mts +0 -3
  249. package/dist/types/commands/organization/handle-security-policy.d.mts.map +0 -1
  250. package/dist/types/commands/organization/output-dependencies.d.mts +0 -8
  251. package/dist/types/commands/organization/output-dependencies.d.mts.map +0 -1
  252. package/dist/types/commands/organization/output-license-policy.d.mts +0 -4
  253. package/dist/types/commands/organization/output-license-policy.d.mts.map +0 -1
  254. package/dist/types/commands/organization/output-organization-list.d.mts +0 -4
  255. package/dist/types/commands/organization/output-organization-list.d.mts.map +0 -1
  256. package/dist/types/commands/organization/output-quota.d.mts +0 -4
  257. package/dist/types/commands/organization/output-quota.d.mts.map +0 -1
  258. package/dist/types/commands/organization/output-security-policy.d.mts +0 -4
  259. package/dist/types/commands/organization/output-security-policy.d.mts.map +0 -1
  260. package/dist/types/commands/package/cmd-package-score.d.mts +0 -10
  261. package/dist/types/commands/package/cmd-package-score.d.mts.map +0 -1
  262. package/dist/types/commands/package/cmd-package-shallow.d.mts +0 -17
  263. package/dist/types/commands/package/cmd-package-shallow.d.mts.map +0 -1
  264. package/dist/types/commands/package/cmd-package.d.mts +0 -3
  265. package/dist/types/commands/package/cmd-package.d.mts.map +0 -1
  266. package/dist/types/commands/package/fetch-purl-deep-score.d.mts +0 -51
  267. package/dist/types/commands/package/fetch-purl-deep-score.d.mts.map +0 -1
  268. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +0 -8
  269. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +0 -1
  270. package/dist/types/commands/package/handle-purl-deep-score.d.mts +0 -3
  271. package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +0 -1
  272. package/dist/types/commands/package/handle-purls-shallow-score.d.mts +0 -6
  273. package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +0 -1
  274. package/dist/types/commands/package/output-purls-deep-score.d.mts +0 -5
  275. package/dist/types/commands/package/output-purls-deep-score.d.mts.map +0 -1
  276. package/dist/types/commands/package/output-purls-shallow-score.d.mts +0 -29
  277. package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +0 -1
  278. package/dist/types/commands/package/parse-package-specifiers.d.mts +0 -9
  279. package/dist/types/commands/package/parse-package-specifiers.d.mts.map +0 -1
  280. package/dist/types/commands/patch/cmd-patch.d.mts +0 -10
  281. package/dist/types/commands/patch/cmd-patch.d.mts.map +0 -1
  282. package/dist/types/commands/patch/handle-patch.d.mts +0 -12
  283. package/dist/types/commands/patch/handle-patch.d.mts.map +0 -1
  284. package/dist/types/commands/patch/manifest-schema.d.mts +0 -34
  285. package/dist/types/commands/patch/manifest-schema.d.mts.map +0 -1
  286. package/dist/types/commands/patch/output-patch-result.d.mts +0 -5
  287. package/dist/types/commands/patch/output-patch-result.d.mts.map +0 -1
  288. package/dist/types/commands/pnpm/cmd-pnpm.d.mts +0 -10
  289. package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +0 -1
  290. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +0 -9
  291. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +0 -1
  292. package/dist/types/commands/raw-npm/run-raw-npm.d.mts +0 -2
  293. package/dist/types/commands/raw-npm/run-raw-npm.d.mts.map +0 -1
  294. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +0 -9
  295. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +0 -1
  296. package/dist/types/commands/raw-npx/run-raw-npx.d.mts +0 -2
  297. package/dist/types/commands/raw-npx/run-raw-npx.d.mts.map +0 -1
  298. package/dist/types/commands/repository/cmd-repository-create.d.mts +0 -10
  299. package/dist/types/commands/repository/cmd-repository-create.d.mts.map +0 -1
  300. package/dist/types/commands/repository/cmd-repository-del.d.mts +0 -10
  301. package/dist/types/commands/repository/cmd-repository-del.d.mts.map +0 -1
  302. package/dist/types/commands/repository/cmd-repository-list.d.mts +0 -10
  303. package/dist/types/commands/repository/cmd-repository-list.d.mts.map +0 -1
  304. package/dist/types/commands/repository/cmd-repository-update.d.mts +0 -10
  305. package/dist/types/commands/repository/cmd-repository-update.d.mts.map +0 -1
  306. package/dist/types/commands/repository/cmd-repository-view.d.mts +0 -10
  307. package/dist/types/commands/repository/cmd-repository-view.d.mts.map +0 -1
  308. package/dist/types/commands/repository/cmd-repository.d.mts +0 -3
  309. package/dist/types/commands/repository/cmd-repository.d.mts.map +0 -1
  310. package/dist/types/commands/repository/fetch-create-repo.d.mts +0 -16
  311. package/dist/types/commands/repository/fetch-create-repo.d.mts.map +0 -1
  312. package/dist/types/commands/repository/fetch-delete-repo.d.mts +0 -8
  313. package/dist/types/commands/repository/fetch-delete-repo.d.mts.map +0 -1
  314. package/dist/types/commands/repository/fetch-list-all-repos.d.mts +0 -10
  315. package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +0 -1
  316. package/dist/types/commands/repository/fetch-list-repos.d.mts +0 -15
  317. package/dist/types/commands/repository/fetch-list-repos.d.mts.map +0 -1
  318. package/dist/types/commands/repository/fetch-update-repo.d.mts +0 -16
  319. package/dist/types/commands/repository/fetch-update-repo.d.mts.map +0 -1
  320. package/dist/types/commands/repository/fetch-view-repo.d.mts +0 -8
  321. package/dist/types/commands/repository/fetch-view-repo.d.mts.map +0 -1
  322. package/dist/types/commands/repository/handle-create-repo.d.mts +0 -10
  323. package/dist/types/commands/repository/handle-create-repo.d.mts.map +0 -1
  324. package/dist/types/commands/repository/handle-delete-repo.d.mts +0 -3
  325. package/dist/types/commands/repository/handle-delete-repo.d.mts.map +0 -1
  326. package/dist/types/commands/repository/handle-list-repos.d.mts +0 -12
  327. package/dist/types/commands/repository/handle-list-repos.d.mts.map +0 -1
  328. package/dist/types/commands/repository/handle-update-repo.d.mts +0 -10
  329. package/dist/types/commands/repository/handle-update-repo.d.mts.map +0 -1
  330. package/dist/types/commands/repository/handle-view-repo.d.mts +0 -3
  331. package/dist/types/commands/repository/handle-view-repo.d.mts.map +0 -1
  332. package/dist/types/commands/repository/output-create-repo.d.mts +0 -4
  333. package/dist/types/commands/repository/output-create-repo.d.mts.map +0 -1
  334. package/dist/types/commands/repository/output-delete-repo.d.mts +0 -4
  335. package/dist/types/commands/repository/output-delete-repo.d.mts.map +0 -1
  336. package/dist/types/commands/repository/output-list-repos.d.mts +0 -5
  337. package/dist/types/commands/repository/output-list-repos.d.mts.map +0 -1
  338. package/dist/types/commands/repository/output-update-repo.d.mts +0 -4
  339. package/dist/types/commands/repository/output-update-repo.d.mts.map +0 -1
  340. package/dist/types/commands/repository/output-view-repo.d.mts +0 -4
  341. package/dist/types/commands/repository/output-view-repo.d.mts.map +0 -1
  342. package/dist/types/commands/repository/types.d.mts +0 -2
  343. package/dist/types/commands/repository/types.d.mts.map +0 -1
  344. package/dist/types/commands/scan/cmd-scan-create.d.mts +0 -10
  345. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +0 -1
  346. package/dist/types/commands/scan/cmd-scan-del.d.mts +0 -10
  347. package/dist/types/commands/scan/cmd-scan-del.d.mts.map +0 -1
  348. package/dist/types/commands/scan/cmd-scan-diff.d.mts +0 -10
  349. package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +0 -1
  350. package/dist/types/commands/scan/cmd-scan-github.d.mts +0 -10
  351. package/dist/types/commands/scan/cmd-scan-github.d.mts.map +0 -1
  352. package/dist/types/commands/scan/cmd-scan-list.d.mts +0 -4
  353. package/dist/types/commands/scan/cmd-scan-list.d.mts.map +0 -1
  354. package/dist/types/commands/scan/cmd-scan-metadata.d.mts +0 -4
  355. package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +0 -1
  356. package/dist/types/commands/scan/cmd-scan-reach.d.mts +0 -10
  357. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +0 -1
  358. package/dist/types/commands/scan/cmd-scan-report.d.mts +0 -4
  359. package/dist/types/commands/scan/cmd-scan-report.d.mts.map +0 -1
  360. package/dist/types/commands/scan/cmd-scan-setup.d.mts +0 -9
  361. package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +0 -1
  362. package/dist/types/commands/scan/cmd-scan-view.d.mts +0 -4
  363. package/dist/types/commands/scan/cmd-scan-view.d.mts.map +0 -1
  364. package/dist/types/commands/scan/cmd-scan.d.mts +0 -3
  365. package/dist/types/commands/scan/cmd-scan.d.mts.map +0 -1
  366. package/dist/types/commands/scan/create-scan-from-github.d.mts +0 -12
  367. package/dist/types/commands/scan/create-scan-from-github.d.mts.map +0 -1
  368. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +0 -20
  369. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +0 -1
  370. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +0 -8
  371. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts.map +0 -1
  372. package/dist/types/commands/scan/fetch-diff-scan.d.mts +0 -8
  373. package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +0 -1
  374. package/dist/types/commands/scan/fetch-list-scans.d.mts +0 -18
  375. package/dist/types/commands/scan/fetch-list-scans.d.mts.map +0 -1
  376. package/dist/types/commands/scan/fetch-report-data.d.mts +0 -17
  377. package/dist/types/commands/scan/fetch-report-data.d.mts.map +0 -1
  378. package/dist/types/commands/scan/fetch-scan-metadata.d.mts +0 -8
  379. package/dist/types/commands/scan/fetch-scan-metadata.d.mts.map +0 -1
  380. package/dist/types/commands/scan/fetch-scan.d.mts +0 -4
  381. package/dist/types/commands/scan/fetch-scan.d.mts.map +0 -1
  382. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +0 -10
  383. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +0 -1
  384. package/dist/types/commands/scan/finalize-tier1-scan.d.mts +0 -12
  385. package/dist/types/commands/scan/finalize-tier1-scan.d.mts.map +0 -1
  386. package/dist/types/commands/scan/generate-report.d.mts +0 -44
  387. package/dist/types/commands/scan/generate-report.d.mts.map +0 -1
  388. package/dist/types/commands/scan/handle-create-github-scan.d.mts +0 -12
  389. package/dist/types/commands/scan/handle-create-github-scan.d.mts.map +0 -1
  390. package/dist/types/commands/scan/handle-create-new-scan.d.mts +0 -29
  391. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +0 -1
  392. package/dist/types/commands/scan/handle-delete-scan.d.mts +0 -3
  393. package/dist/types/commands/scan/handle-delete-scan.d.mts.map +0 -1
  394. package/dist/types/commands/scan/handle-diff-scan.d.mts +0 -10
  395. package/dist/types/commands/scan/handle-diff-scan.d.mts.map +0 -1
  396. package/dist/types/commands/scan/handle-list-scans.d.mts +0 -13
  397. package/dist/types/commands/scan/handle-list-scans.d.mts.map +0 -1
  398. package/dist/types/commands/scan/handle-scan-config.d.mts +0 -2
  399. package/dist/types/commands/scan/handle-scan-config.d.mts.map +0 -1
  400. package/dist/types/commands/scan/handle-scan-metadata.d.mts +0 -3
  401. package/dist/types/commands/scan/handle-scan-metadata.d.mts.map +0 -1
  402. package/dist/types/commands/scan/handle-scan-reach.d.mts +0 -12
  403. package/dist/types/commands/scan/handle-scan-reach.d.mts.map +0 -1
  404. package/dist/types/commands/scan/handle-scan-report.d.mts +0 -14
  405. package/dist/types/commands/scan/handle-scan-report.d.mts.map +0 -1
  406. package/dist/types/commands/scan/handle-scan-view.d.mts +0 -3
  407. package/dist/types/commands/scan/handle-scan-view.d.mts.map +0 -1
  408. package/dist/types/commands/scan/output-create-new-scan.d.mts +0 -10
  409. package/dist/types/commands/scan/output-create-new-scan.d.mts.map +0 -1
  410. package/dist/types/commands/scan/output-delete-scan.d.mts +0 -4
  411. package/dist/types/commands/scan/output-delete-scan.d.mts.map +0 -1
  412. package/dist/types/commands/scan/output-diff-scan.d.mts +0 -8
  413. package/dist/types/commands/scan/output-diff-scan.d.mts.map +0 -1
  414. package/dist/types/commands/scan/output-list-scans.d.mts +0 -4
  415. package/dist/types/commands/scan/output-list-scans.d.mts.map +0 -1
  416. package/dist/types/commands/scan/output-scan-config-result.d.mts +0 -3
  417. package/dist/types/commands/scan/output-scan-config-result.d.mts.map +0 -1
  418. package/dist/types/commands/scan/output-scan-github.d.mts +0 -3
  419. package/dist/types/commands/scan/output-scan-github.d.mts.map +0 -1
  420. package/dist/types/commands/scan/output-scan-metadata.d.mts +0 -4
  421. package/dist/types/commands/scan/output-scan-metadata.d.mts.map +0 -1
  422. package/dist/types/commands/scan/output-scan-reach.d.mts +0 -7
  423. package/dist/types/commands/scan/output-scan-reach.d.mts.map +0 -1
  424. package/dist/types/commands/scan/output-scan-report.d.mts +0 -22
  425. package/dist/types/commands/scan/output-scan-report.d.mts.map +0 -1
  426. package/dist/types/commands/scan/output-scan-view.d.mts +0 -4
  427. package/dist/types/commands/scan/output-scan-view.d.mts.map +0 -1
  428. package/dist/types/commands/scan/perform-reachability-analysis.d.mts +0 -27
  429. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +0 -1
  430. package/dist/types/commands/scan/reachability-flags.d.mts +0 -3
  431. package/dist/types/commands/scan/reachability-flags.d.mts.map +0 -1
  432. package/dist/types/commands/scan/setup-scan-config.d.mts +0 -3
  433. package/dist/types/commands/scan/setup-scan-config.d.mts.map +0 -1
  434. package/dist/types/commands/scan/stream-scan.d.mts +0 -7
  435. package/dist/types/commands/scan/stream-scan.d.mts.map +0 -1
  436. package/dist/types/commands/scan/suggest-org-slug.d.mts +0 -2
  437. package/dist/types/commands/scan/suggest-org-slug.d.mts.map +0 -1
  438. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts +0 -2
  439. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts.map +0 -1
  440. package/dist/types/commands/scan/suggest_branch_slug.d.mts +0 -2
  441. package/dist/types/commands/scan/suggest_branch_slug.d.mts.map +0 -1
  442. package/dist/types/commands/scan/suggest_target.d.mts +0 -2
  443. package/dist/types/commands/scan/suggest_target.d.mts.map +0 -1
  444. package/dist/types/commands/scan/types.d.mts +0 -3
  445. package/dist/types/commands/scan/types.d.mts.map +0 -1
  446. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +0 -10
  447. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +0 -1
  448. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +0 -13
  449. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +0 -1
  450. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +0 -13
  451. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +0 -1
  452. package/dist/types/commands/threat-feed/output-threat-feed.d.mts +0 -4
  453. package/dist/types/commands/threat-feed/output-threat-feed.d.mts.map +0 -1
  454. package/dist/types/commands/threat-feed/types.d.mts +0 -15
  455. package/dist/types/commands/threat-feed/types.d.mts.map +0 -1
  456. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +0 -8
  457. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +0 -1
  458. package/dist/types/commands/uninstall/cmd-uninstall.d.mts +0 -3
  459. package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +0 -1
  460. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +0 -2
  461. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +0 -1
  462. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +0 -6
  463. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +0 -1
  464. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +0 -6
  465. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +0 -1
  466. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +0 -2
  467. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts.map +0 -1
  468. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +0 -2
  469. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts.map +0 -1
  470. package/dist/types/commands/wrapper/cmd-wrapper.d.mts +0 -9
  471. package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +0 -1
  472. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +0 -2
  473. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +0 -1
  474. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +0 -2
  475. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts.map +0 -1
  476. package/dist/types/commands/yarn/cmd-yarn.d.mts +0 -10
  477. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +0 -1
  478. package/dist/types/commands.d.mts +0 -203
  479. package/dist/types/commands.d.mts.map +0 -1
  480. package/dist/types/constants.d.mts +0 -299
  481. package/dist/types/constants.d.mts.map +0 -1
  482. package/dist/types/flags.d.mts +0 -18
  483. package/dist/types/flags.d.mts.map +0 -1
  484. package/dist/types/instrument-with-sentry.d.mts +0 -2
  485. package/dist/types/instrument-with-sentry.d.mts.map +0 -1
  486. package/dist/types/npm-cli.d.mts +0 -3
  487. package/dist/types/npm-cli.d.mts.map +0 -1
  488. package/dist/types/npx-cli.d.mts +0 -3
  489. package/dist/types/npx-cli.d.mts.map +0 -1
  490. package/dist/types/pnpm-cli.d.mts +0 -3
  491. package/dist/types/pnpm-cli.d.mts.map +0 -1
  492. package/dist/types/sea/bootstrap.d.mts +0 -2
  493. package/dist/types/sea/bootstrap.d.mts.map +0 -1
  494. package/dist/types/sea/build-sea.d.mts +0 -27
  495. package/dist/types/sea/build-sea.d.mts.map +0 -1
  496. package/dist/types/shadow/common.d.mts +0 -23
  497. package/dist/types/shadow/common.d.mts.map +0 -1
  498. package/dist/types/shadow/npm/arborist/index.d.mts +0 -8
  499. package/dist/types/shadow/npm/arborist/index.d.mts.map +0 -1
  500. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +0 -35
  501. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +0 -1
  502. package/dist/types/shadow/npm/arborist/types.d.mts +0 -123
  503. package/dist/types/shadow/npm/arborist/types.d.mts.map +0 -1
  504. package/dist/types/shadow/npm/arborist-helpers.d.mts +0 -24
  505. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +0 -1
  506. package/dist/types/shadow/npm/bin.d.mts +0 -5
  507. package/dist/types/shadow/npm/bin.d.mts.map +0 -1
  508. package/dist/types/shadow/npm/inject.d.mts +0 -2
  509. package/dist/types/shadow/npm/inject.d.mts.map +0 -1
  510. package/dist/types/shadow/npm/install.d.mts +0 -13
  511. package/dist/types/shadow/npm/install.d.mts.map +0 -1
  512. package/dist/types/shadow/npm/paths.d.mts +0 -6
  513. package/dist/types/shadow/npm/paths.d.mts.map +0 -1
  514. package/dist/types/shadow/npm-base.d.mts +0 -11
  515. package/dist/types/shadow/npm-base.d.mts.map +0 -1
  516. package/dist/types/shadow/npx/bin.d.mts +0 -5
  517. package/dist/types/shadow/npx/bin.d.mts.map +0 -1
  518. package/dist/types/shadow/pnpm/bin.d.mts +0 -10
  519. package/dist/types/shadow/pnpm/bin.d.mts.map +0 -1
  520. package/dist/types/shadow/stdio-ipc.d.mts +0 -7
  521. package/dist/types/shadow/stdio-ipc.d.mts.map +0 -1
  522. package/dist/types/shadow/yarn/bin.d.mts +0 -10
  523. package/dist/types/shadow/yarn/bin.d.mts.map +0 -1
  524. package/dist/types/test/json-output-validation.d.mts +0 -37
  525. package/dist/types/test/json-output-validation.d.mts.map +0 -1
  526. package/dist/types/test/mocks/socket-auth.d.mts +0 -88
  527. package/dist/types/test/mocks/socket-auth.d.mts.map +0 -1
  528. package/dist/types/types.d.mts +0 -29
  529. package/dist/types/types.d.mts.map +0 -1
  530. package/dist/types/utils/agent.d.mts +0 -12
  531. package/dist/types/utils/agent.d.mts.map +0 -1
  532. package/dist/types/utils/alert/artifact.d.mts +0 -21
  533. package/dist/types/utils/alert/artifact.d.mts.map +0 -1
  534. package/dist/types/utils/alert/fix.d.mts +0 -6
  535. package/dist/types/utils/alert/fix.d.mts.map +0 -1
  536. package/dist/types/utils/alert/severity.d.mts +0 -14
  537. package/dist/types/utils/alert/severity.d.mts.map +0 -1
  538. package/dist/types/utils/alerts-map.d.mts +0 -27
  539. package/dist/types/utils/alerts-map.d.mts.map +0 -1
  540. package/dist/types/utils/api.d.mts +0 -44
  541. package/dist/types/utils/api.d.mts.map +0 -1
  542. package/dist/types/utils/check-input.d.mts +0 -9
  543. package/dist/types/utils/check-input.d.mts.map +0 -1
  544. package/dist/types/utils/cmd.d.mts +0 -50
  545. package/dist/types/utils/cmd.d.mts.map +0 -1
  546. package/dist/types/utils/coana.d.mts +0 -2
  547. package/dist/types/utils/coana.d.mts.map +0 -1
  548. package/dist/types/utils/color-or-markdown.d.mts +0 -16
  549. package/dist/types/utils/color-or-markdown.d.mts.map +0 -1
  550. package/dist/types/utils/completion.d.mts +0 -11
  551. package/dist/types/utils/completion.d.mts.map +0 -1
  552. package/dist/types/utils/config.d.mts +0 -34
  553. package/dist/types/utils/config.d.mts.map +0 -1
  554. package/dist/types/utils/cve-to-ghsa.d.mts +0 -6
  555. package/dist/types/utils/cve-to-ghsa.d.mts.map +0 -1
  556. package/dist/types/utils/debug.d.mts +0 -45
  557. package/dist/types/utils/debug.d.mts.map +0 -1
  558. package/dist/types/utils/determine-org-slug.d.mts +0 -2
  559. package/dist/types/utils/determine-org-slug.d.mts.map +0 -1
  560. package/dist/types/utils/dlx-binary.d.mts +0 -58
  561. package/dist/types/utils/dlx-binary.d.mts.map +0 -1
  562. package/dist/types/utils/dlx-detection.d.mts +0 -29
  563. package/dist/types/utils/dlx-detection.d.mts.map +0 -1
  564. package/dist/types/utils/dlx.d.mts +0 -36
  565. package/dist/types/utils/dlx.d.mts.map +0 -1
  566. package/dist/types/utils/ecosystem.d.mts +0 -20
  567. package/dist/types/utils/ecosystem.d.mts.map +0 -1
  568. package/dist/types/utils/errors.d.mts +0 -62
  569. package/dist/types/utils/errors.d.mts.map +0 -1
  570. package/dist/types/utils/extract-names.d.mts +0 -15
  571. package/dist/types/utils/extract-names.d.mts.map +0 -1
  572. package/dist/types/utils/fail-msg-with-badge.d.mts +0 -2
  573. package/dist/types/utils/fail-msg-with-badge.d.mts.map +0 -1
  574. package/dist/types/utils/filter-config.d.mts +0 -5
  575. package/dist/types/utils/filter-config.d.mts.map +0 -1
  576. package/dist/types/utils/fs.d.mts +0 -8
  577. package/dist/types/utils/fs.d.mts.map +0 -1
  578. package/dist/types/utils/get-output-kind.d.mts +0 -3
  579. package/dist/types/utils/get-output-kind.d.mts.map +0 -1
  580. package/dist/types/utils/git.d.mts +0 -35
  581. package/dist/types/utils/git.d.mts.map +0 -1
  582. package/dist/types/utils/github.d.mts +0 -38
  583. package/dist/types/utils/github.d.mts.map +0 -1
  584. package/dist/types/utils/glob.d.mts +0 -15
  585. package/dist/types/utils/glob.d.mts.map +0 -1
  586. package/dist/types/utils/lockfile.d.mts +0 -2
  587. package/dist/types/utils/lockfile.d.mts.map +0 -1
  588. package/dist/types/utils/map-to-object.d.mts +0 -10
  589. package/dist/types/utils/map-to-object.d.mts.map +0 -1
  590. package/dist/types/utils/markdown.d.mts +0 -27
  591. package/dist/types/utils/markdown.d.mts.map +0 -1
  592. package/dist/types/utils/meow-with-subcommands.d.mts +0 -83
  593. package/dist/types/utils/meow-with-subcommands.d.mts.map +0 -1
  594. package/dist/types/utils/ms-at-home.d.mts +0 -2
  595. package/dist/types/utils/ms-at-home.d.mts.map +0 -1
  596. package/dist/types/utils/npm-config.d.mts +0 -14
  597. package/dist/types/utils/npm-config.d.mts.map +0 -1
  598. package/dist/types/utils/npm-package-arg.d.mts +0 -8
  599. package/dist/types/utils/npm-package-arg.d.mts.map +0 -1
  600. package/dist/types/utils/npm-paths.d.mts +0 -7
  601. package/dist/types/utils/npm-paths.d.mts.map +0 -1
  602. package/dist/types/utils/npm-spec.d.mts +0 -57
  603. package/dist/types/utils/npm-spec.d.mts.map +0 -1
  604. package/dist/types/utils/objects.d.mts +0 -3
  605. package/dist/types/utils/objects.d.mts.map +0 -1
  606. package/dist/types/utils/organization.d.mts +0 -5
  607. package/dist/types/utils/organization.d.mts.map +0 -1
  608. package/dist/types/utils/output-formatting.d.mts +0 -20
  609. package/dist/types/utils/output-formatting.d.mts.map +0 -1
  610. package/dist/types/utils/package-environment.d.mts +0 -57
  611. package/dist/types/utils/package-environment.d.mts.map +0 -1
  612. package/dist/types/utils/path-resolve.d.mts +0 -14
  613. package/dist/types/utils/path-resolve.d.mts.map +0 -1
  614. package/dist/types/utils/pnpm-paths.d.mts +0 -5
  615. package/dist/types/utils/pnpm-paths.d.mts.map +0 -1
  616. package/dist/types/utils/pnpm.d.mts +0 -11
  617. package/dist/types/utils/pnpm.d.mts.map +0 -1
  618. package/dist/types/utils/purl-to-ghsa.d.mts +0 -6
  619. package/dist/types/utils/purl-to-ghsa.d.mts.map +0 -1
  620. package/dist/types/utils/purl.d.mts +0 -71
  621. package/dist/types/utils/purl.d.mts.map +0 -1
  622. package/dist/types/utils/requirements.d.mts +0 -125
  623. package/dist/types/utils/requirements.d.mts.map +0 -1
  624. package/dist/types/utils/sdk.d.mts +0 -17
  625. package/dist/types/utils/sdk.d.mts.map +0 -1
  626. package/dist/types/utils/semver.d.mts +0 -7
  627. package/dist/types/utils/semver.d.mts.map +0 -1
  628. package/dist/types/utils/serialize-result-json.d.mts +0 -5
  629. package/dist/types/utils/serialize-result-json.d.mts.map +0 -1
  630. package/dist/types/utils/shadow-links.d.mts +0 -5
  631. package/dist/types/utils/shadow-links.d.mts.map +0 -1
  632. package/dist/types/utils/socket-json.d.mts +0 -59
  633. package/dist/types/utils/socket-json.d.mts.map +0 -1
  634. package/dist/types/utils/socket-package-alert.d.mts +0 -80
  635. package/dist/types/utils/socket-package-alert.d.mts.map +0 -1
  636. package/dist/types/utils/socket-url.d.mts +0 -8
  637. package/dist/types/utils/socket-url.d.mts.map +0 -1
  638. package/dist/types/utils/spec.d.mts +0 -5
  639. package/dist/types/utils/spec.d.mts.map +0 -1
  640. package/dist/types/utils/strings.d.mts +0 -14
  641. package/dist/types/utils/strings.d.mts.map +0 -1
  642. package/dist/types/utils/terminal-link.d.mts +0 -52
  643. package/dist/types/utils/terminal-link.d.mts.map +0 -1
  644. package/dist/types/utils/tildify.d.mts +0 -2
  645. package/dist/types/utils/tildify.d.mts.map +0 -1
  646. package/dist/types/utils/translations.d.mts +0 -617
  647. package/dist/types/utils/translations.d.mts.map +0 -1
  648. package/dist/types/utils/walk-nested-map.d.mts +0 -7
  649. package/dist/types/utils/walk-nested-map.d.mts.map +0 -1
  650. package/dist/types/utils/yarn-paths.d.mts +0 -5
  651. package/dist/types/utils/yarn-paths.d.mts.map +0 -1
  652. package/dist/types/utils/yarn-version.d.mts +0 -2
  653. package/dist/types/utils/yarn-version.d.mts.map +0 -1
  654. package/dist/types/yarn-cli.d.mts +0 -3
  655. package/dist/types/yarn-cli.d.mts.map +0 -1
  656. package/dist/utils.js +0 -6146
  657. package/dist/utils.js.map +0 -1
  658. package/dist/vendor.js +0 -162074
  659. package/dist/yarn-cli.js +0 -30
  660. package/dist/yarn-cli.js.map +0 -1
  661. package/external/@socketsecurity/registry/LICENSE +0 -21
  662. package/external/@socketsecurity/registry/README.md +0 -9
  663. package/external/@socketsecurity/registry/extensions.json +0 -28
  664. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
  665. package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
  666. package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
  667. package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
  668. package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
  669. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
  670. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
  671. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
  672. package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
  673. package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
  674. package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
  675. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
  676. package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
  677. package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
  678. package/external/@socketsecurity/registry/external/cacache.js +0 -16208
  679. package/external/@socketsecurity/registry/external/debug.js +0 -1163
  680. package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
  681. package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
  682. package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
  683. package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
  684. package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
  685. package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
  686. package/external/@socketsecurity/registry/external/pacote.js +0 -74109
  687. package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
  688. package/external/@socketsecurity/registry/external/semver.js +0 -2618
  689. package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
  690. package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
  691. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
  692. package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
  693. package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
  694. package/external/@socketsecurity/registry/external/which.js +0 -405
  695. package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
  696. package/external/@socketsecurity/registry/index.js +0 -31
  697. package/external/@socketsecurity/registry/lib/agent.js +0 -390
  698. package/external/@socketsecurity/registry/lib/arrays.js +0 -89
  699. package/external/@socketsecurity/registry/lib/bin.js +0 -650
  700. package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
  701. package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
  702. package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
  703. package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
  704. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
  705. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
  706. package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
  707. package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
  708. package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
  709. package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
  710. package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
  711. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
  712. package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
  713. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
  714. package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
  715. package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
  716. package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
  717. package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
  718. package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
  719. package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
  720. package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
  721. package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
  722. package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
  723. package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
  724. package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
  725. package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
  726. package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
  727. package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
  728. package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
  729. package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
  730. package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
  731. package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
  732. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
  733. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
  734. package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
  735. package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
  736. package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
  737. package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
  738. package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
  739. package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
  740. package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
  741. package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
  742. package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
  743. package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
  744. package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
  745. package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
  746. package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
  747. package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
  748. package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
  749. package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
  750. package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
  751. package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
  752. package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
  753. package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
  754. package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
  755. package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
  756. package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
  757. package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
  758. package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
  759. package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
  760. package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
  761. package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
  762. package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
  763. package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
  764. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
  765. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
  766. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
  767. package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
  768. package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
  769. package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
  770. package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
  771. package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
  772. package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
  773. package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
  774. package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
  775. package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
  776. package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
  777. package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
  778. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
  779. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
  780. package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
  781. package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
  782. package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
  783. package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
  784. package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
  785. package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
  786. package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
  787. package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
  788. package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
  789. package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
  790. package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
  791. package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
  792. package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
  793. package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
  794. package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
  795. package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
  796. package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
  797. package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
  798. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
  799. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
  800. package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
  801. package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
  802. package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
  803. package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
  804. package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
  805. package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
  806. package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
  807. package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
  808. package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
  809. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
  810. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
  811. package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
  812. package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
  813. package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
  814. package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
  815. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
  816. package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
  817. package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
  818. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
  819. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
  820. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
  821. package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
  822. package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
  823. package/external/@socketsecurity/registry/lib/debug.js +0 -264
  824. package/external/@socketsecurity/registry/lib/env.js +0 -62
  825. package/external/@socketsecurity/registry/lib/fs.js +0 -556
  826. package/external/@socketsecurity/registry/lib/functions.js +0 -20
  827. package/external/@socketsecurity/registry/lib/globs.js +0 -145
  828. package/external/@socketsecurity/registry/lib/json.js +0 -69
  829. package/external/@socketsecurity/registry/lib/logger.js +0 -534
  830. package/external/@socketsecurity/registry/lib/objects.js +0 -422
  831. package/external/@socketsecurity/registry/lib/packages.js +0 -1376
  832. package/external/@socketsecurity/registry/lib/path.js +0 -231
  833. package/external/@socketsecurity/registry/lib/promises.js +0 -286
  834. package/external/@socketsecurity/registry/lib/prompts.js +0 -63
  835. package/external/@socketsecurity/registry/lib/regexps.js +0 -23
  836. package/external/@socketsecurity/registry/lib/sorts.js +0 -70
  837. package/external/@socketsecurity/registry/lib/spawn.js +0 -252
  838. package/external/@socketsecurity/registry/lib/spinner.js +0 -205
  839. package/external/@socketsecurity/registry/lib/streams.js +0 -84
  840. package/external/@socketsecurity/registry/lib/strings.js +0 -235
  841. package/external/@socketsecurity/registry/lib/url.js +0 -68
  842. package/external/@socketsecurity/registry/lib/words.js +0 -45
  843. package/external/@socketsecurity/registry/manifest.json +0 -1875
  844. package/external/blessed/LICENSE +0 -20
  845. package/external/blessed/README.md +0 -2421
  846. package/external/blessed/lib/alias.js +0 -528
  847. package/external/blessed/lib/blessed.js +0 -34
  848. package/external/blessed/lib/colors.js +0 -532
  849. package/external/blessed/lib/events.js +0 -191
  850. package/external/blessed/lib/gpmclient.js +0 -223
  851. package/external/blessed/lib/helpers.js +0 -167
  852. package/external/blessed/lib/keys.js +0 -341
  853. package/external/blessed/lib/program.js +0 -4297
  854. package/external/blessed/lib/tput.js +0 -3020
  855. package/external/blessed/lib/unicode.js +0 -792
  856. package/external/blessed/lib/widget.js +0 -62
  857. package/external/blessed/lib/widgets/ansiimage.js +0 -169
  858. package/external/blessed/lib/widgets/bigtext.js +0 -161
  859. package/external/blessed/lib/widgets/box.js +0 -36
  860. package/external/blessed/lib/widgets/button.js +0 -64
  861. package/external/blessed/lib/widgets/checkbox.js +0 -93
  862. package/external/blessed/lib/widgets/element.js +0 -2572
  863. package/external/blessed/lib/widgets/filemanager.js +0 -214
  864. package/external/blessed/lib/widgets/form.js +0 -269
  865. package/external/blessed/lib/widgets/image.js +0 -63
  866. package/external/blessed/lib/widgets/input.js +0 -36
  867. package/external/blessed/lib/widgets/layout.js +0 -235
  868. package/external/blessed/lib/widgets/line.js +0 -58
  869. package/external/blessed/lib/widgets/list.js +0 -601
  870. package/external/blessed/lib/widgets/listbar.js +0 -413
  871. package/external/blessed/lib/widgets/listtable.js +0 -254
  872. package/external/blessed/lib/widgets/loading.js +0 -90
  873. package/external/blessed/lib/widgets/log.js +0 -85
  874. package/external/blessed/lib/widgets/message.js +0 -125
  875. package/external/blessed/lib/widgets/node.js +0 -284
  876. package/external/blessed/lib/widgets/overlayimage.js +0 -719
  877. package/external/blessed/lib/widgets/progressbar.js +0 -159
  878. package/external/blessed/lib/widgets/prompt.js +0 -122
  879. package/external/blessed/lib/widgets/question.js +0 -118
  880. package/external/blessed/lib/widgets/radiobutton.js +0 -63
  881. package/external/blessed/lib/widgets/radioset.js +0 -38
  882. package/external/blessed/lib/widgets/screen.js +0 -2300
  883. package/external/blessed/lib/widgets/scrollablebox.js +0 -391
  884. package/external/blessed/lib/widgets/scrollabletext.js +0 -37
  885. package/external/blessed/lib/widgets/table.js +0 -356
  886. package/external/blessed/lib/widgets/terminal.js +0 -414
  887. package/external/blessed/lib/widgets/text.js +0 -37
  888. package/external/blessed/lib/widgets/textarea.js +0 -344
  889. package/external/blessed/lib/widgets/textbox.js +0 -79
  890. package/external/blessed/lib/widgets/video.js +0 -128
  891. package/external/blessed/usr/fonts/AUTHORS +0 -1
  892. package/external/blessed/usr/fonts/LICENSE +0 -94
  893. package/external/blessed/usr/fonts/README +0 -340
  894. package/external/blessed/usr/fonts/ter-u14b.json +0 -17826
  895. package/external/blessed/usr/fonts/ter-u14n.json +0 -17826
  896. package/external/blessed/usr/linux +0 -0
  897. package/external/blessed/usr/windows-ansi +0 -0
  898. package/external/blessed/usr/xterm +0 -0
  899. package/external/blessed/usr/xterm-256color +0 -0
  900. package/external/blessed/usr/xterm.termcap +0 -243
  901. package/external/blessed/usr/xterm.terminfo +0 -1977
  902. package/external/blessed/vendor/tng.js +0 -1757
  903. package/external/blessed-contrib/LICENSE.md +0 -21
  904. package/external/blessed-contrib/lib/layout/grid.js +0 -409
  905. package/external/blessed-contrib/lib/widget/charts/bar.js +0 -8370
  906. package/external/blessed-contrib/lib/widget/charts/line.js +0 -17924
  907. package/external/blessed-contrib/lib/widget/table.js +0 -187
  908. package/shadow-bin/npm +0 -27
  909. package/shadow-bin/npx +0 -27
  910. package/shadow-bin/pnpm +0 -27
  911. package/shadow-bin/yarn +0 -27
  912. /package/{translations.json → data/alert-translations.json} +0 -0
  913. /package/{requirements.json → data/command-api-requirements.json} +0 -0
  914. /package/{dist → data}/socket-completion.bash +0 -0
@@ -1,3020 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * tput.js - parse and compile terminfo caps to javascript.
5
- * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
6
- * https://github.com/chjj/blessed
7
- */
8
-
9
- // Resources:
10
- // $ man term
11
- // $ man terminfo
12
- // http://invisible-island.net/ncurses/man/term.5.html
13
- // https://en.wikipedia.org/wiki/Terminfo
14
-
15
- // Todo:
16
- // - xterm's XT (set-title capability?) value should
17
- // be true (at least tmux thinks it should).
18
- // It's not parsed as true. Investigate.
19
- // - Possibly switch to other method of finding the
20
- // extended data string table: i += h.symOffsetCount * 2;
21
-
22
- /**
23
- * Modules
24
- */
25
-
26
- var assert = require('assert')
27
- , path = require('path')
28
- , fs = require('fs')
29
- , cp = require('child_process');
30
-
31
- /**
32
- * Tput
33
- */
34
-
35
- function Tput(options) {
36
- if (!(this instanceof Tput)) {
37
- return new Tput(options);
38
- }
39
-
40
- options = options || {};
41
- if (typeof options === 'string') {
42
- options = { terminal: options };
43
- }
44
-
45
- this.options = options;
46
- this.terminal = options.terminal
47
- || options.term
48
- || process.env.TERM
49
- || (process.platform === 'win32' ? 'windows-ansi' : 'xterm');
50
-
51
- this.terminal = this.terminal.toLowerCase();
52
-
53
- this.debug = options.debug;
54
- this.padding = options.padding;
55
- this.extended = options.extended;
56
- this.printf = options.printf;
57
- this.termcap = options.termcap;
58
- this.error = null;
59
-
60
- this.terminfoPrefix = options.terminfoPrefix;
61
- this.terminfoFile = options.terminfoFile;
62
- this.termcapFile = options.termcapFile;
63
-
64
- if (options.terminal || options.term) {
65
- this.setup();
66
- }
67
- }
68
-
69
- Tput.prototype.setup = function() {
70
- this.error = null;
71
- try {
72
- if (this.termcap) {
73
- try {
74
- this.injectTermcap();
75
- } catch (e) {
76
- if (this.debug) throw e;
77
- this.error = new Error('Termcap parse error.');
78
- this._useInternalCap(this.terminal);
79
- }
80
- } else {
81
- try {
82
- this.injectTerminfo();
83
- } catch (e) {
84
- if (this.debug) throw e;
85
- this.error = new Error('Terminfo parse error.');
86
- this._useInternalInfo(this.terminal);
87
- }
88
- }
89
- } catch (e) {
90
- // If there was an error, fallback
91
- // to an internally stored terminfo/cap.
92
- if (this.debug) throw e;
93
- this.error = new Error('Terminfo not found.');
94
- this._useXtermInfo();
95
- }
96
- };
97
-
98
- Tput.prototype.term = function(is) {
99
- return this.terminal.indexOf(is) === 0;
100
- };
101
-
102
- Tput.prototype._debug = function() {
103
- if (!this.debug) return;
104
- return console.log.apply(console, arguments);
105
- };
106
-
107
- /**
108
- * Fallback
109
- */
110
-
111
- Tput.prototype._useVt102Cap = function() {
112
- return this.injectTermcap('vt102');
113
- };
114
-
115
- Tput.prototype._useXtermCap = function() {
116
- return this.injectTermcap(__dirname + '/../usr/xterm.termcap');
117
- };
118
-
119
- Tput.prototype._useXtermInfo = function() {
120
- return this.injectTerminfo(__dirname + '/../usr/xterm');
121
- };
122
-
123
- Tput.prototype._useInternalInfo = function(name) {
124
- name = path.basename(name);
125
- return this.injectTerminfo(__dirname + '/../usr/' + name);
126
- };
127
-
128
- Tput.prototype._useInternalCap = function(name) {
129
- name = path.basename(name);
130
- return this.injectTermcap(__dirname + '/../usr/' + name + '.termcap');
131
- };
132
-
133
- /**
134
- * Terminfo
135
- */
136
-
137
- Tput.ipaths = [
138
- process.env.TERMINFO || '',
139
- (process.env.TERMINFO_DIRS || '').split(':'),
140
- (process.env.HOME || '') + '/.terminfo',
141
- '/usr/share/terminfo',
142
- '/usr/share/lib/terminfo',
143
- '/usr/lib/terminfo',
144
- '/usr/local/share/terminfo',
145
- '/usr/local/share/lib/terminfo',
146
- '/usr/local/lib/terminfo',
147
- '/usr/local/ncurses/lib/terminfo',
148
- '/lib/terminfo'
149
- ];
150
-
151
- Tput.prototype.readTerminfo = function(term) {
152
- var data
153
- , file
154
- , info;
155
-
156
- term = term || this.terminal;
157
-
158
- file = path.normalize(this._prefix(term));
159
- data = fs.readFileSync(file);
160
- info = this.parseTerminfo(data, file);
161
-
162
- if (this.debug) {
163
- this._terminfo = info;
164
- }
165
-
166
- return info;
167
- };
168
-
169
- Tput._prefix =
170
- Tput.prototype._prefix = function(term) {
171
- // If we have a terminfoFile, or our
172
- // term looks like a filename, use it.
173
- if (term) {
174
- if (~term.indexOf(path.sep)) {
175
- return term;
176
- }
177
- if (this.terminfoFile) {
178
- return this.terminfoFile;
179
- }
180
- }
181
-
182
- var paths = Tput.ipaths.slice()
183
- , file;
184
-
185
- if (this.terminfoPrefix) {
186
- paths.unshift(this.terminfoPrefix);
187
- }
188
-
189
- // Try exact matches.
190
- file = this._tprefix(paths, term);
191
- if (file) return file;
192
-
193
- // Try similar matches.
194
- file = this._tprefix(paths, term, true);
195
- if (file) return file;
196
-
197
- // Not found.
198
- throw new Error('Terminfo directory not found.');
199
- };
200
-
201
- Tput._tprefix =
202
- Tput.prototype._tprefix = function(prefix, term, soft) {
203
- if (!prefix) return;
204
-
205
- var file
206
- , dir
207
- , i
208
- , sdiff
209
- , sfile
210
- , list;
211
-
212
- if (Array.isArray(prefix)) {
213
- for (i = 0; i < prefix.length; i++) {
214
- file = this._tprefix(prefix[i], term, soft);
215
- if (file) return file;
216
- }
217
- return;
218
- }
219
-
220
- var find = function(word) {
221
- var file, ch;
222
-
223
- file = path.resolve(prefix, word[0]);
224
- try {
225
- fs.statSync(file);
226
- return file;
227
- } catch (e) {
228
- ;
229
- }
230
-
231
- ch = word[0].charCodeAt(0).toString(16);
232
- if (ch.length < 2) ch = '0' + ch;
233
-
234
- file = path.resolve(prefix, ch);
235
- try {
236
- fs.statSync(file);
237
- return file;
238
- } catch (e) {
239
- ;
240
- }
241
- };
242
-
243
- if (!term) {
244
- // Make sure the directory's sub-directories
245
- // are all one-letter, or hex digits.
246
- // return find('x') ? prefix : null;
247
- try {
248
- dir = fs.readdirSync(prefix).filter(function(file) {
249
- return file.length !== 1 && !/^[0-9a-fA-F]{2}$/.test(file);
250
- });
251
- if (!dir.length) {
252
- return prefix;
253
- }
254
- } catch (e) {
255
- ;
256
- }
257
- return;
258
- }
259
-
260
- term = path.basename(term);
261
- dir = find(term);
262
-
263
- if (!dir) return;
264
-
265
- if (soft) {
266
- try {
267
- list = fs.readdirSync(dir);
268
- } catch (e) {
269
- return;
270
- }
271
-
272
- list.forEach(function(file) {
273
- if (file.indexOf(term) === 0) {
274
- var diff = file.length - term.length;
275
- if (!sfile || diff < sdiff) {
276
- sdiff = diff;
277
- sfile = file;
278
- }
279
- }
280
- });
281
-
282
- return sfile && (soft || sdiff === 0)
283
- ? path.resolve(dir, sfile)
284
- : null;
285
- }
286
-
287
- file = path.resolve(dir, term);
288
- try {
289
- fs.statSync(file);
290
- return file;
291
- } catch (e) {
292
- ;
293
- }
294
- };
295
-
296
- /**
297
- * Terminfo Parser
298
- * All shorts are little-endian
299
- */
300
-
301
- Tput.prototype.parseTerminfo = function(data, file) {
302
- var info = {}
303
- , extended
304
- , l = data.length
305
- , i = 0
306
- , v
307
- , o;
308
-
309
- var h = info.header = {
310
- dataSize: data.length,
311
- headerSize: 12,
312
- magicNumber: (data[1] << 8) | data[0],
313
- namesSize: (data[3] << 8) | data[2],
314
- boolCount: (data[5] << 8) | data[4],
315
- numCount: (data[7] << 8) | data[6],
316
- strCount: (data[9] << 8) | data[8],
317
- strTableSize: (data[11] << 8) | data[10]
318
- };
319
-
320
- h.total = h.headerSize
321
- + h.namesSize
322
- + h.boolCount
323
- + h.numCount * 2
324
- + h.strCount * 2
325
- + h.strTableSize;
326
-
327
- i += h.headerSize;
328
-
329
- // Names Section
330
- var names = data.toString('ascii', i, i + h.namesSize - 1)
331
- , parts = names.split('|')
332
- , name = parts[0]
333
- , desc = parts.pop();
334
-
335
- info.name = name;
336
- info.names = parts;
337
- info.desc = desc;
338
-
339
- info.dir = path.resolve(file, '..', '..');
340
- info.file = file;
341
-
342
- i += h.namesSize - 1;
343
-
344
- // Names is nul-terminated.
345
- assert.equal(data[i], 0);
346
- i++;
347
-
348
- // Booleans Section
349
- // One byte for each flag
350
- // Same order as <term.h>
351
- info.bools = {};
352
- l = i + h.boolCount;
353
- o = 0;
354
- for (; i < l; i++) {
355
- v = Tput.bools[o++];
356
- info.bools[v] = data[i] === 1;
357
- }
358
-
359
- // Null byte in between to make sure numbers begin on an even byte.
360
- if (i % 2) {
361
- assert.equal(data[i], 0);
362
- i++;
363
- }
364
-
365
- // Numbers Section
366
- info.numbers = {};
367
- l = i + h.numCount * 2;
368
- o = 0;
369
- for (; i < l; i += 2) {
370
- v = Tput.numbers[o++];
371
- if (data[i + 1] === 0o377 && data[i] === 0o377) {
372
- info.numbers[v] = -1;
373
- } else {
374
- info.numbers[v] = (data[i + 1] << 8) | data[i];
375
- }
376
- }
377
-
378
- // Strings Section
379
- info.strings = {};
380
- l = i + h.strCount * 2;
381
- o = 0;
382
- for (; i < l; i += 2) {
383
- v = Tput.strings[o++];
384
- if (data[i + 1] === 0o377 && data[i] === 0o377) {
385
- info.strings[v] = -1;
386
- } else {
387
- info.strings[v] = (data[i + 1] << 8) | data[i];
388
- }
389
- }
390
-
391
- // String Table
392
- Object.keys(info.strings).forEach(function(key) {
393
- if (info.strings[key] === -1) {
394
- delete info.strings[key];
395
- return;
396
- }
397
-
398
- // Workaround: fix an odd bug in the screen-256color terminfo where it tries
399
- // to set -1, but it appears to have {0xfe, 0xff} instead of {0xff, 0xff}.
400
- // TODO: Possibly handle errors gracefully below, as well as in the
401
- // extended info. Also possibly do: `if (info.strings[key] >= data.length)`.
402
- if (info.strings[key] === 65534) {
403
- delete info.strings[key];
404
- return;
405
- }
406
-
407
- var s = i + info.strings[key]
408
- , j = s;
409
-
410
- while (data[j]) j++;
411
-
412
- assert(j < data.length);
413
-
414
- info.strings[key] = data.toString('ascii', s, j);
415
- });
416
-
417
- // Extended Header
418
- if (this.extended !== false) {
419
- i--;
420
- i += h.strTableSize;
421
- if (i % 2) {
422
- assert.equal(data[i], 0);
423
- i++;
424
- }
425
- l = data.length;
426
- if (i < l - 1) {
427
- try {
428
- extended = this.parseExtended(data.slice(i));
429
- } catch (e) {
430
- if (this.debug) {
431
- throw e;
432
- }
433
- return info;
434
- }
435
- info.header.extended = extended.header;
436
- ['bools', 'numbers', 'strings'].forEach(function(key) {
437
- merge(info[key], extended[key]);
438
- });
439
- }
440
- }
441
-
442
- return info;
443
- };
444
-
445
- /**
446
- * Extended Parsing
447
- */
448
-
449
- // Some data to help understand:
450
-
451
- // For xterm, non-extended header:
452
- // { dataSize: 3270,
453
- // headerSize: 12,
454
- // magicNumber: 282,
455
- // namesSize: 48,
456
- // boolCount: 38,
457
- // numCount: 15,
458
- // strCount: 413,
459
- // strTableSize: 1388,
460
- // total: 2342 }
461
-
462
- // For xterm, header:
463
- // Offset: 2342
464
- // { header:
465
- // { dataSize: 928,
466
- // headerSize: 10,
467
- // boolCount: 2,
468
- // numCount: 1,
469
- // strCount: 57,
470
- // strTableSize: 117,
471
- // lastStrTableOffset: 680,
472
- // total: 245 },
473
-
474
- // For xterm, layout:
475
- // { header: '0 - 10', // length: 10
476
- // bools: '10 - 12', // length: 2
477
- // numbers: '12 - 14', // length: 2
478
- // strings: '14 - 128', // length: 114 (57 short)
479
- // symoffsets: '128 - 248', // length: 120 (60 short)
480
- // stringtable: '248 - 612', // length: 364
481
- // sym: '612 - 928' } // length: 316
482
- //
483
- // How lastStrTableOffset works:
484
- // data.length - h.lastStrTableOffset === 248
485
- // (sym-offset end, string-table start)
486
- // 364 + 316 === 680 (lastStrTableOffset)
487
- // How strTableSize works:
488
- // h.strCount + [symOffsetCount] === h.strTableSize
489
- // 57 + 60 === 117 (strTableSize)
490
- // symOffsetCount doesn't actually exist in the header. it's just implied.
491
- // Getting the number of sym offsets:
492
- // h.symOffsetCount = h.strTableSize - h.strCount;
493
- // h.symOffsetSize = (h.strTableSize - h.strCount) * 2;
494
-
495
- Tput.prototype.parseExtended = function(data) {
496
- var info = {}
497
- , l = data.length
498
- , i = 0;
499
-
500
- var h = info.header = {
501
- dataSize: data.length,
502
- headerSize: 10,
503
- boolCount: (data[i + 1] << 8) | data[i + 0],
504
- numCount: (data[i + 3] << 8) | data[i + 2],
505
- strCount: (data[i + 5] << 8) | data[i + 4],
506
- strTableSize: (data[i + 7] << 8) | data[i + 6],
507
- lastStrTableOffset: (data[i + 9] << 8) | data[i + 8]
508
- };
509
-
510
- // h.symOffsetCount = h.strTableSize - h.strCount;
511
-
512
- h.total = h.headerSize
513
- + h.boolCount
514
- + h.numCount * 2
515
- + h.strCount * 2
516
- + h.strTableSize;
517
-
518
- i += h.headerSize;
519
-
520
- // Booleans Section
521
- // One byte for each flag
522
- var _bools = [];
523
- l = i + h.boolCount;
524
- for (; i < l; i++) {
525
- _bools.push(data[i] === 1);
526
- }
527
-
528
- // Null byte in between to make sure numbers begin on an even byte.
529
- if (i % 2) {
530
- assert.equal(data[i], 0);
531
- i++;
532
- }
533
-
534
- // Numbers Section
535
- var _numbers = [];
536
- l = i + h.numCount * 2;
537
- for (; i < l; i += 2) {
538
- if (data[i + 1] === 0o377 && data[i] === 0o377) {
539
- _numbers.push(-1);
540
- } else {
541
- _numbers.push((data[i + 1] << 8) | data[i]);
542
- }
543
- }
544
-
545
- // Strings Section
546
- var _strings = [];
547
- l = i + h.strCount * 2;
548
- for (; i < l; i += 2) {
549
- if (data[i + 1] === 0o377 && data[i] === 0o377) {
550
- _strings.push(-1);
551
- } else {
552
- _strings.push((data[i + 1] << 8) | data[i]);
553
- }
554
- }
555
-
556
- // Pass over the sym offsets and get to the string table.
557
- i = data.length - h.lastStrTableOffset;
558
- // Might be better to do this instead if the file has trailing bytes:
559
- // i += h.symOffsetCount * 2;
560
-
561
- // String Table
562
- var high = 0;
563
- _strings.forEach(function(offset, k) {
564
- if (offset === -1) {
565
- _strings[k] = '';
566
- return;
567
- }
568
-
569
- var s = i + offset
570
- , j = s;
571
-
572
- while (data[j]) j++;
573
-
574
- assert(j < data.length);
575
-
576
- // Find out where the string table ends by
577
- // getting the highest string length.
578
- if (high < j - i) {
579
- high = j - i;
580
- }
581
-
582
- _strings[k] = data.toString('ascii', s, j);
583
- });
584
-
585
- // Symbol Table
586
- // Add one to the highest string length because we didn't count \0.
587
- i += high + 1;
588
- l = data.length;
589
-
590
- var sym = []
591
- , j;
592
-
593
- for (; i < l; i++) {
594
- j = i;
595
- while (data[j]) j++;
596
- sym.push(data.toString('ascii', i, j));
597
- i = j;
598
- }
599
-
600
- // Identify by name
601
- j = 0;
602
-
603
- info.bools = {};
604
- _bools.forEach(function(bool) {
605
- info.bools[sym[j++]] = bool;
606
- });
607
-
608
- info.numbers = {};
609
- _numbers.forEach(function(number) {
610
- info.numbers[sym[j++]] = number;
611
- });
612
-
613
- info.strings = {};
614
- _strings.forEach(function(string) {
615
- info.strings[sym[j++]] = string;
616
- });
617
-
618
- // Should be the very last bit of data.
619
- assert.equal(i, data.length);
620
-
621
- return info;
622
- };
623
-
624
- Tput.prototype.compileTerminfo = function(term) {
625
- return this.compile(this.readTerminfo(term));
626
- };
627
-
628
- Tput.prototype.injectTerminfo = function(term) {
629
- return this.inject(this.compileTerminfo(term));
630
- };
631
-
632
- /**
633
- * Compiler - terminfo cap->javascript
634
- */
635
-
636
- Tput.prototype.compile = function(info) {
637
- var self = this;
638
-
639
- if (!info) {
640
- throw new Error('Terminal not found.');
641
- }
642
-
643
- this.detectFeatures(info);
644
-
645
- this._debug(info);
646
-
647
- info.all = {};
648
- info.methods = {};
649
-
650
- ['bools', 'numbers', 'strings'].forEach(function(type) {
651
- Object.keys(info[type]).forEach(function(key) {
652
- info.all[key] = info[type][key];
653
- info.methods[key] = self._compile(info, key, info.all[key]);
654
- });
655
- });
656
-
657
- Tput.bools.forEach(function(key) {
658
- if (info.methods[key] == null) info.methods[key] = false;
659
- });
660
-
661
- Tput.numbers.forEach(function(key) {
662
- if (info.methods[key] == null) info.methods[key] = -1;
663
- });
664
-
665
- Tput.strings.forEach(function(key) {
666
- if (!info.methods[key]) info.methods[key] = noop;
667
- });
668
-
669
- Object.keys(info.methods).forEach(function(key) {
670
- if (!Tput.alias[key]) return;
671
- Tput.alias[key].forEach(function(alias) {
672
- info.methods[alias] = info.methods[key];
673
- });
674
- // Could just use:
675
- // Object.keys(Tput.aliasMap).forEach(function(key) {
676
- // info.methods[key] = info.methods[Tput.aliasMap[key]];
677
- // });
678
- });
679
-
680
- return info;
681
- };
682
-
683
- Tput.prototype.inject = function(info) {
684
- var self = this
685
- , methods = info.methods || info;
686
-
687
- Object.keys(methods).forEach(function(key) {
688
- if (typeof methods[key] !== 'function') {
689
- self[key] = methods[key];
690
- return;
691
- }
692
- self[key] = function() {
693
- var args = Array.prototype.slice.call(arguments);
694
- return methods[key].call(self, args);
695
- };
696
- });
697
-
698
- this.info = info;
699
- this.all = info.all;
700
- this.methods = info.methods;
701
- this.bools = info.bools;
702
- this.numbers = info.numbers;
703
- this.strings = info.strings;
704
-
705
- if (!~info.names.indexOf(this.terminal)) {
706
- this.terminal = info.name;
707
- }
708
-
709
- this.features = info.features;
710
- Object.keys(info.features).forEach(function(key) {
711
- if (key === 'padding') {
712
- if (!info.features.padding && self.options.padding !== true) {
713
- self.padding = false;
714
- }
715
- return;
716
- }
717
- self[key] = info.features[key];
718
- });
719
- };
720
-
721
- // See:
722
- // ~/ncurses/ncurses/tinfo/lib_tparm.c
723
- // ~/ncurses/ncurses/tinfo/comp_scan.c
724
- Tput.prototype._compile = function(info, key, str) {
725
- var v;
726
-
727
- this._debug('Compiling %s: %s', key, JSON.stringify(str));
728
-
729
- switch (typeof str) {
730
- case 'boolean':
731
- return str;
732
- case 'number':
733
- return str;
734
- case 'string':
735
- break;
736
- default:
737
- return noop;
738
- }
739
-
740
- if (!str) {
741
- return noop;
742
- }
743
-
744
- // See:
745
- // ~/ncurses/progs/tput.c - tput() - L149
746
- // ~/ncurses/progs/tset.c - set_init() - L992
747
- if (key === 'init_file' || key === 'reset_file') {
748
- try {
749
- str = fs.readFileSync(str, 'utf8');
750
- if (this.debug) {
751
- v = ('return ' + JSON.stringify(str) + ';')
752
- .replace(/\x1b/g, '\\x1b')
753
- .replace(/\r/g, '\\r')
754
- .replace(/\n/g, '\\n');
755
- process.stdout.write(v + '\n');
756
- }
757
- return function() { return str; };
758
- } catch (e) {
759
- return noop;
760
- }
761
- }
762
-
763
- var tkey = info.name + '.' + key
764
- , header = 'var v, dyn = {}, stat = {}, stack = [], out = [];'
765
- , footer = ';return out.join("");'
766
- , code = header
767
- , val = str
768
- , buff = ''
769
- , cap
770
- , ch
771
- , fi
772
- , then
773
- , els
774
- , end;
775
-
776
- function read(regex, no) {
777
- cap = regex.exec(val);
778
- if (!cap) return;
779
- val = val.substring(cap[0].length);
780
- ch = cap[1];
781
- if (!no) clear();
782
- return cap;
783
- }
784
-
785
- function stmt(c) {
786
- if (code[code.length - 1] === ',') {
787
- code = code.slice(0, -1);
788
- }
789
- code += c;
790
- }
791
-
792
- function expr(c) {
793
- code += c + ',';
794
- }
795
-
796
- function echo(c) {
797
- if (c === '""') return;
798
- expr('out.push(' + c + ')');
799
- }
800
-
801
- function print(c) {
802
- buff += c;
803
- }
804
-
805
- function clear() {
806
- if (buff) {
807
- echo(JSON.stringify(buff).replace(/\\u00([0-9a-fA-F]{2})/g, '\\x$1'));
808
- buff = '';
809
- }
810
- }
811
-
812
- while (val) {
813
- // Ignore newlines
814
- if (read(/^\n /, true)) {
815
- continue;
816
- }
817
-
818
- // '^A' -> ^A
819
- if (read(/^\^(.)/i, true)) {
820
- if (!(ch >= ' ' && ch <= '~')) {
821
- this._debug('%s: bad caret char.', tkey);
822
- // NOTE: ncurses appears to simply
823
- // continue in this situation, but
824
- // I could be wrong.
825
- print(cap[0]);
826
- continue;
827
- }
828
- if (ch === '?') {
829
- ch = '\x7f';
830
- } else {
831
- ch = ch.charCodeAt(0) & 31;
832
- if (ch === 0) ch = 128;
833
- ch = String.fromCharCode(ch);
834
- }
835
- print(ch);
836
- continue;
837
- }
838
-
839
- // 3 octal digits -> character
840
- if (read(/^\\([0-7]{3})/, true)) {
841
- print(String.fromCharCode(parseInt(ch, 8)));
842
- continue;
843
- }
844
-
845
- // '\e' -> ^[
846
- // '\n' -> \n
847
- // '\r' -> \r
848
- // '\0' -> \200 (special case)
849
- if (read(/^\\([eEnlrtbfs\^\\,:0]|.)/, true)) {
850
- switch (ch) {
851
- case 'e':
852
- case 'E':
853
- ch = '\x1b';
854
- break;
855
- case 'n':
856
- ch = '\n';
857
- break;
858
- case 'l':
859
- ch = '\x85';
860
- break;
861
- case 'r':
862
- ch = '\r';
863
- break;
864
- case 't':
865
- ch = '\t';
866
- break;
867
- case 'b':
868
- ch = '\x08';
869
- break;
870
- case 'f':
871
- ch = '\x0c';
872
- break;
873
- case 's':
874
- ch = ' ';
875
- break;
876
- case '^':
877
- ch = '^';
878
- break;
879
- case '\\':
880
- ch = '\\';
881
- break;
882
- case ',':
883
- ch = ',';
884
- break;
885
- case ':':
886
- ch = ':';
887
- break;
888
- case '0':
889
- ch = '\200';
890
- break;
891
- case 'a':
892
- ch = '\x07';
893
- break;
894
- default:
895
- this._debug('%s: bad backslash char.', tkey);
896
- ch = cap[0];
897
- break;
898
- }
899
- print(ch);
900
- continue;
901
- }
902
-
903
- // $<5> -> padding
904
- // e.g. flash_screen: '\u001b[?5h$<100/>\u001b[?5l',
905
- if (read(/^\$<(\d+)([*\/]{0,2})>/, true)) {
906
- if (this.padding) print(cap[0]);
907
- continue;
908
- }
909
-
910
- // %% outputs `%'
911
- if (read(/^%%/, true)) {
912
- print('%');
913
- continue;
914
- }
915
-
916
- // %[[:]flags][width[.precision]][doxXs]
917
- // as in printf, flags are [-+#] and space. Use a `:' to allow the
918
- // next character to be a `-' flag, avoiding interpreting "%-" as an
919
- // operator.
920
- // %c print pop() like %c in printf
921
- // Example from screen terminfo:
922
- // S0: "\u001b(%p1%c"
923
- // %d print pop()
924
- // "Print (e.g., "%d") is a special case."
925
- // %s print pop() like %s in printf
926
- if (read(/^%((?::-|[+# ]){1,4})?(\d+(?:\.\d+)?)?([doxXsc])/)) {
927
- if (this.printf || cap[1] || cap[2] || ~'oxX'.indexOf(cap[3])) {
928
- echo('sprintf("'+ cap[0].replace(':-', '-') + '", stack.pop())');
929
- } else if (cap[3] === 'c') {
930
- echo('(v = stack.pop(), isFinite(v) '
931
- + '? String.fromCharCode(v || 0o200) : "")');
932
- } else {
933
- echo('stack.pop()');
934
- }
935
- continue;
936
- }
937
-
938
- // %p[1-9]
939
- // push i'th parameter
940
- if (read(/^%p([1-9])/)) {
941
- expr('(stack.push(v = params[' + (ch - 1) + ']), v)');
942
- continue;
943
- }
944
-
945
- // %P[a-z]
946
- // set dynamic variable [a-z] to pop()
947
- if (read(/^%P([a-z])/)) {
948
- expr('dyn.' + ch + ' = stack.pop()');
949
- continue;
950
- }
951
-
952
- // %g[a-z]
953
- // get dynamic variable [a-z] and push it
954
- if (read(/^%g([a-z])/)) {
955
- expr('(stack.push(dyn.' + ch + '), dyn.' + ch + ')');
956
- continue;
957
- }
958
-
959
- // %P[A-Z]
960
- // set static variable [a-z] to pop()
961
- if (read(/^%P([A-Z])/)) {
962
- expr('stat.' + ch + ' = stack.pop()');
963
- continue;
964
- }
965
-
966
- // %g[A-Z]
967
- // get static variable [a-z] and push it
968
- // The terms "static" and "dynamic" are misleading. Historically,
969
- // these are simply two different sets of variables, whose values are
970
- // not reset between calls to tparm. However, that fact is not
971
- // documented in other implementations. Relying on it will adversely
972
- // impact portability to other implementations.
973
- if (read(/^%g([A-Z])/)) {
974
- expr('(stack.push(v = stat.' + ch + '), v)');
975
- continue;
976
- }
977
-
978
- // %'c' char constant c
979
- // NOTE: These are stored as c chars, exemplified by:
980
- // cursor_address: "\u001b=%p1%' '%+%c%p2%' '%+%c"
981
- if (read(/^%'(.)'/)) {
982
- expr('(stack.push(v = ' + ch.charCodeAt(0) + '), v)');
983
- continue;
984
- }
985
-
986
- // %{nn}
987
- // integer constant nn
988
- if (read(/^%\{(\d+)\}/)) {
989
- expr('(stack.push(v = ' + ch + '), v)');
990
- continue;
991
- }
992
-
993
- // %l push strlen(pop)
994
- if (read(/^%l/)) {
995
- expr('(stack.push(v = (stack.pop() || "").length || 0), v)');
996
- continue;
997
- }
998
-
999
- // %+ %- %* %/ %m
1000
- // arithmetic (%m is mod): push(pop() op pop())
1001
- // %& %| %^
1002
- // bit operations (AND, OR and exclusive-OR): push(pop() op pop())
1003
- // %= %> %<
1004
- // logical operations: push(pop() op pop())
1005
- if (read(/^%([+\-*\/m&|\^=><])/)) {
1006
- if (ch === '=') ch = '===';
1007
- else if (ch === 'm') ch = '%';
1008
- expr('(v = stack.pop(),'
1009
- + ' stack.push(v = (stack.pop() ' + ch + ' v) || 0),'
1010
- + ' v)');
1011
- continue;
1012
- }
1013
-
1014
- // %A, %O
1015
- // logical AND and OR operations (for conditionals)
1016
- if (read(/^%([AO])/)) {
1017
- // Are we supposed to store the result on the stack?
1018
- expr('(stack.push(v = (stack.pop() '
1019
- + (ch === 'A' ? '&&' : '||')
1020
- + ' stack.pop())), v)');
1021
- continue;
1022
- }
1023
-
1024
- // %! %~
1025
- // unary operations (logical and bit complement): push(op pop())
1026
- if (read(/^%([!~])/)) {
1027
- expr('(stack.push(v = ' + ch + 'stack.pop()), v)');
1028
- continue;
1029
- }
1030
-
1031
- // %i add 1 to first two parameters (for ANSI terminals)
1032
- if (read(/^%i/)) {
1033
- // Are these supposed to go on the stack in certain situations?
1034
- // ncurses doesn't seem to put them on the stack, but xterm.user6
1035
- // seems to assume they're on the stack for some reason. Could
1036
- // just be a bad terminfo string.
1037
- // user6: "\u001b[%i%d;%dR" - possibly a termcap-style string.
1038
- // expr('(params[0] |= 0, params[1] |= 0, params[0]++, params[1]++)');
1039
- expr('(params[0]++, params[1]++)');
1040
- continue;
1041
- }
1042
-
1043
- // %? expr %t thenpart %e elsepart %;
1044
- // This forms an if-then-else. The %e elsepart is optional. Usually
1045
- // the %? expr part pushes a value onto the stack, and %t pops it from
1046
- // the stack, testing if it is nonzero (true). If it is zero (false),
1047
- // control passes to the %e (else) part.
1048
- // It is possible to form else-if's a la Algol 68:
1049
- // %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %;
1050
- // where ci are conditions, bi are bodies.
1051
- if (read(/^%\?/)) {
1052
- end = -1;
1053
- stmt(';if (');
1054
- continue;
1055
- }
1056
-
1057
- if (read(/^%t/)) {
1058
- end = -1;
1059
- // Technically this is supposed to pop everything off the stack that was
1060
- // pushed onto the stack after the if statement, see man terminfo.
1061
- // Right now, we don't pop anything off. This could cause compat issues.
1062
- // Perhaps implement a "pushed" counter from the time the if statement
1063
- // is added, to the time the then statement is added, and pop off
1064
- // the appropriate number of elements.
1065
- // while (pushed--) expr('stack.pop()');
1066
- stmt(') {');
1067
- continue;
1068
- }
1069
-
1070
- // Terminfo does elseif's like
1071
- // this: %?[expr]%t...%e[expr]%t...%;
1072
- if (read(/^%e/)) {
1073
- fi = val.indexOf('%?');
1074
- then = val.indexOf('%t');
1075
- els = val.indexOf('%e');
1076
- end = val.indexOf('%;');
1077
- if (end === -1) end = Infinity;
1078
- if (then !== -1 && then < end
1079
- && (fi === -1 || then < fi)
1080
- && (els === -1 || then < els)) {
1081
- stmt('} else if (');
1082
- } else {
1083
- stmt('} else {');
1084
- }
1085
- continue;
1086
- }
1087
-
1088
- if (read(/^%;/)) {
1089
- end = null;
1090
- stmt('}');
1091
- continue;
1092
- }
1093
-
1094
- buff += val[0];
1095
- val = val.substring(1);
1096
- }
1097
-
1098
- // Clear the buffer of any remaining text.
1099
- clear();
1100
-
1101
- // Some terminfos (I'm looking at you, atari-color), don't end an if
1102
- // statement. It's assumed terminfo will automatically end it for
1103
- // them, because they are a bunch of lazy bastards.
1104
- if (end != null) {
1105
- stmt('}');
1106
- }
1107
-
1108
- // Add the footer.
1109
- stmt(footer);
1110
-
1111
- // Optimize and cleanup generated code.
1112
- v = code.slice(header.length, -footer.length);
1113
- if (!v.length) {
1114
- code = 'return "";';
1115
- } else if (v = /^out\.push\(("(?:[^"]|\\")+")\)$/.exec(v)) {
1116
- code = 'return ' + v[1] + ';';
1117
- } else {
1118
- // Turn `(stack.push(v = params[0]), v),out.push(stack.pop())`
1119
- // into `out.push(params[0])`.
1120
- code = code.replace(
1121
- /\(stack\.push\(v = params\[(\d+)\]\), v\),out\.push\(stack\.pop\(\)\)/g,
1122
- 'out.push(params[$1])');
1123
-
1124
- // Remove unnecessary variable initializations.
1125
- v = code.slice(header.length, -footer.length);
1126
- if (!~v.indexOf('v = ')) code = code.replace('v, ', '');
1127
- if (!~v.indexOf('dyn')) code = code.replace('dyn = {}, ', '');
1128
- if (!~v.indexOf('stat')) code = code.replace('stat = {}, ', '');
1129
- if (!~v.indexOf('stack')) code = code.replace('stack = [], ', '');
1130
-
1131
- // Turn `var out = [];out.push("foo"),` into `var out = ["foo"];`.
1132
- code = code.replace(
1133
- /out = \[\];out\.push\(("(?:[^"]|\\")+")\),/,
1134
- 'out = [$1];');
1135
- }
1136
-
1137
- // Terminfos `wyse350-vb`, and `wy350-w`
1138
- // seem to have a few broken strings.
1139
- if (str === '\u001b%?') {
1140
- code = 'return "\\x1b";';
1141
- }
1142
-
1143
- if (this.debug) {
1144
- v = code
1145
- .replace(/\x1b/g, '\\x1b')
1146
- .replace(/\r/g, '\\r')
1147
- .replace(/\n/g, '\\n');
1148
- process.stdout.write(v + '\n');
1149
- }
1150
-
1151
- try {
1152
- if (this.options.stringify && code.indexOf('return ') === 0) {
1153
- return new Function('', code)();
1154
- }
1155
- return this.printf || ~code.indexOf('sprintf(')
1156
- ? new Function('sprintf, params', code).bind(null, sprintf)
1157
- : new Function('params', code);
1158
- } catch (e) {
1159
- console.error('');
1160
- console.error('Error on %s:', tkey);
1161
- console.error(JSON.stringify(str));
1162
- console.error('');
1163
- console.error(code.replace(/(,|;)/g, '$1\n'));
1164
- e.stack = e.stack.replace(/\x1b/g, '\\x1b');
1165
- throw e;
1166
- }
1167
- };
1168
-
1169
- // See: ~/ncurses/ncurses/tinfo/lib_tputs.c
1170
- Tput.prototype._print = function(code, print, done) {
1171
- var xon = !this.bools.needs_xon_xoff || this.bools.xon_xoff;
1172
-
1173
- print = print || write;
1174
- done = done || noop;
1175
-
1176
- if (!this.padding) {
1177
- print(code);
1178
- return done();
1179
- }
1180
-
1181
- var parts = code.split(/(?=\$<[\d.]+[*\/]{0,2}>)/)
1182
- , i = 0;
1183
-
1184
- (function next() {
1185
- if (i === parts.length) {
1186
- return done();
1187
- }
1188
-
1189
- var part = parts[i++]
1190
- , padding = /^\$<([\d.]+)([*\/]{0,2})>/.exec(part)
1191
- , amount
1192
- , suffix;
1193
- // , affect;
1194
-
1195
- if (!padding) {
1196
- print(part);
1197
- return next();
1198
- }
1199
-
1200
- part = part.substring(padding[0].length);
1201
- amount = +padding[1];
1202
- suffix = padding[2];
1203
-
1204
- // A `/' suffix indicates that the padding is mandatory and forces a
1205
- // delay of the given number of milliseconds even on devices for which xon
1206
- // is present to indicate flow control.
1207
- if (xon && !~suffix.indexOf('/')) {
1208
- print(part);
1209
- return next();
1210
- }
1211
-
1212
- // A `*' indicates that the padding required is proportional to the number
1213
- // of lines affected by the operation, and the amount given is the
1214
- // per-affected-unit padding required. (In the case of insert character,
1215
- // the factor is still the number of lines affected.) Normally, padding is
1216
- // advisory if the device has the xon capability; it is used for cost
1217
- // computation but does not trigger delays.
1218
- if (~suffix.indexOf('*')) {
1219
- // XXX Disable this for now.
1220
- amount = amount;
1221
- // if (affect = /\x1b\[(\d+)[LM]/.exec(part)) {
1222
- // amount *= +affect[1];
1223
- // }
1224
- // The above is a huge workaround. In reality, we need to compile
1225
- // `_print` into the string functions and check the cap name and
1226
- // params.
1227
- // if (cap === 'insert_line' || cap === 'delete_line') {
1228
- // amount *= params[0];
1229
- // }
1230
- // if (cap === 'clear_screen') {
1231
- // amount *= process.stdout.rows;
1232
- // }
1233
- }
1234
-
1235
- return setTimeout(function() {
1236
- print(part);
1237
- return next();
1238
- }, amount);
1239
- })();
1240
- };
1241
-
1242
- // A small helper function if we want
1243
- // to easily output text with setTimeouts.
1244
- Tput.print = function() {
1245
- var fake = {
1246
- padding: true,
1247
- bools: { needs_xon_xoff: true, xon_xoff: false }
1248
- };
1249
- return Tput.prototype._print.apply(fake, arguments);
1250
- };
1251
-
1252
- /**
1253
- * Termcap
1254
- */
1255
-
1256
- Tput.cpaths = [
1257
- process.env.TERMCAP || '',
1258
- (process.env.TERMPATH || '').split(/[: ]/),
1259
- (process.env.HOME || '') + '/.termcap',
1260
- '/usr/share/misc/termcap',
1261
- '/etc/termcap'
1262
- ];
1263
-
1264
- Tput.prototype.readTermcap = function(term) {
1265
- var self = this
1266
- , terms
1267
- , term_
1268
- , root
1269
- , paths;
1270
-
1271
- term = term || this.terminal;
1272
-
1273
- // Termcap has a bunch of terminals usually stored in one file/string,
1274
- // so we need to find the one containing our desired terminal.
1275
- if (~term.indexOf(path.sep) && (terms = this._tryCap(path.resolve(term)))) {
1276
- term_ = path.basename(term).split('.')[0];
1277
- if (terms[process.env.TERM]) {
1278
- term = process.env.TERM;
1279
- } else if (terms[term_]) {
1280
- term = term_;
1281
- } else {
1282
- term = Object.keys(terms)[0];
1283
- }
1284
- } else {
1285
- paths = Tput.cpaths.slice();
1286
-
1287
- if (this.termcapFile) {
1288
- paths.unshift(this.termcapFile);
1289
- }
1290
-
1291
- paths.push(Tput.termcap);
1292
-
1293
- terms = this._tryCap(paths, term);
1294
- }
1295
-
1296
- if (!terms) {
1297
- throw new Error('Cannot find termcap for: ' + term);
1298
- }
1299
-
1300
- root = terms[term];
1301
-
1302
- if (this.debug) {
1303
- this._termcap = terms;
1304
- }
1305
-
1306
- (function tc(term) {
1307
- if (term && term.strings.tc) {
1308
- root.inherits = root.inherits || [];
1309
- root.inherits.push(term.strings.tc);
1310
-
1311
- var names = terms[term.strings.tc]
1312
- ? terms[term.strings.tc].names
1313
- : [term.strings.tc];
1314
-
1315
- self._debug('%s inherits from %s.',
1316
- term.names.join('/'), names.join('/'));
1317
-
1318
- var inherit = tc(terms[term.strings.tc]);
1319
- if (inherit) {
1320
- ['bools', 'numbers', 'strings'].forEach(function(type) {
1321
- merge(term[type], inherit[type]);
1322
- });
1323
- }
1324
- }
1325
- return term;
1326
- })(root);
1327
-
1328
- // Translate termcap names to terminfo-style names.
1329
- root = this.translateTermcap(root);
1330
-
1331
- return root;
1332
- };
1333
-
1334
- Tput.prototype._tryCap = function(file, term) {
1335
- if (!file) return;
1336
-
1337
- var terms
1338
- , data
1339
- , i;
1340
-
1341
- if (Array.isArray(file)) {
1342
- for (i = 0; i < file.length; i++) {
1343
- data = this._tryCap(file[i], term);
1344
- if (data) return data;
1345
- }
1346
- return;
1347
- }
1348
-
1349
- // If the termcap string starts with `/`,
1350
- // ncurses considers it a filename.
1351
- data = file[0] === '/'
1352
- ? tryRead(file)
1353
- : file;
1354
-
1355
- if (!data) return;
1356
-
1357
- terms = this.parseTermcap(data, file);
1358
-
1359
- if (term && !terms[term]) {
1360
- return;
1361
- }
1362
-
1363
- return terms;
1364
- };
1365
-
1366
- /**
1367
- * Termcap Parser
1368
- * http://en.wikipedia.org/wiki/Termcap
1369
- * http://www.gnu.org/software
1370
- * /termutils/manual/termcap-1.3/html_mono/termcap.html
1371
- * http://www.gnu.org/software
1372
- * /termutils/manual/termcap-1.3/html_mono/termcap.html#SEC17
1373
- * http://tldp.org/HOWTO/Text-Terminal-HOWTO.html#toc16
1374
- * man termcap
1375
- */
1376
-
1377
- // Example:
1378
- // vt102|dec vt102:\
1379
- // :do=^J:co#80:li#24:cl=50\E[;H\E[2J:\
1380
- // :le=^H:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
1381
- // :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
1382
- // :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
1383
- // :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
1384
- // :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
1385
- // :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:\
1386
- // :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h:\
1387
- // :mi:al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:
1388
-
1389
- Tput.prototype.parseTermcap = function(data, file) {
1390
- var terms = {}
1391
- , parts
1392
- , term
1393
- , entries
1394
- , fields
1395
- , field
1396
- , names
1397
- , i
1398
- , j
1399
- , k;
1400
-
1401
- // remove escaped newlines
1402
- data = data.replace(/\\\n[ \t]*/g, '');
1403
-
1404
- // remove comments
1405
- data = data.replace(/^#[^\n]+/gm, '');
1406
-
1407
- // split entries
1408
- entries = data.trim().split(/\n+/);
1409
-
1410
- for (i = 0; i < entries.length; i++) {
1411
- fields = entries[i].split(/:+/);
1412
- for (j = 0; j < fields.length; j++) {
1413
- field = fields[j].trim();
1414
- if (!field) continue;
1415
-
1416
- if (j === 0) {
1417
- names = field.split('|');
1418
- term = {
1419
- name: names[0],
1420
- names: names,
1421
- desc: names.pop(),
1422
- file: ~file.indexOf(path.sep)
1423
- ? path.resolve(file)
1424
- : file,
1425
- termcap: true
1426
- };
1427
-
1428
- for (k = 0; k < names.length; k++) {
1429
- terms[names[k]] = term;
1430
- }
1431
-
1432
- term.bools = {};
1433
- term.numbers = {};
1434
- term.strings = {};
1435
-
1436
- continue;
1437
- }
1438
-
1439
- if (~field.indexOf('=')) {
1440
- parts = field.split('=');
1441
- term.strings[parts[0]] = parts.slice(1).join('=');
1442
- } else if (~field.indexOf('#')) {
1443
- parts = field.split('#');
1444
- term.numbers[parts[0]] = +parts.slice(1).join('#');
1445
- } else {
1446
- term.bools[field] = true;
1447
- }
1448
- }
1449
- }
1450
-
1451
- return terms;
1452
- };
1453
-
1454
- /**
1455
- * Termcap Compiler
1456
- * man termcap
1457
- */
1458
-
1459
- Tput.prototype.translateTermcap = function(info) {
1460
- var self = this
1461
- , out = {};
1462
-
1463
- if (!info) return;
1464
-
1465
- this._debug(info);
1466
-
1467
- ['name', 'names', 'desc', 'file', 'termcap'].forEach(function(key) {
1468
- out[key] = info[key];
1469
- });
1470
-
1471
- // Separate aliases for termcap
1472
- var map = (function() {
1473
- var out = {};
1474
-
1475
- Object.keys(Tput.alias).forEach(function(key) {
1476
- var aliases = Tput.alias[key];
1477
- out[aliases.termcap] = key;
1478
- });
1479
-
1480
- return out;
1481
- })();
1482
-
1483
- // Translate termcap cap names to terminfo cap names.
1484
- // e.g. `up` -> `cursor_up`
1485
- ['bools', 'numbers', 'strings'].forEach(function(key) {
1486
- out[key] = {};
1487
- Object.keys(info[key]).forEach(function(cap) {
1488
- if (key === 'strings') {
1489
- info.strings[cap] = self._captoinfo(cap, info.strings[cap], 1);
1490
- }
1491
- if (map[cap]) {
1492
- out[key][map[cap]] = info[key][cap];
1493
- } else {
1494
- // NOTE: Possibly include all termcap names
1495
- // in a separate alias.js file. Some are
1496
- // missing from the terminfo alias.js file
1497
- // which is why we have to do this:
1498
- // See: $ man termcap
1499
- out[key][cap] = info[key][cap];
1500
- }
1501
- });
1502
- });
1503
-
1504
- return out;
1505
- };
1506
-
1507
- Tput.prototype.compileTermcap = function(term) {
1508
- return this.compile(this.readTermcap(term));
1509
- };
1510
-
1511
- Tput.prototype.injectTermcap = function(term) {
1512
- return this.inject(this.compileTermcap(term));
1513
- };
1514
-
1515
- /**
1516
- * _nc_captoinfo - ported to javascript directly from ncurses.
1517
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.
1518
- * See: ~/ncurses/ncurses/tinfo/captoinfo.c
1519
- *
1520
- * Convert a termcap string to terminfo format.
1521
- * 'cap' is the relevant terminfo capability index.
1522
- * 's' is the string value of the capability.
1523
- * 'parameterized' tells what type of translations to do:
1524
- * % translations if 1
1525
- * pad translations if >=0
1526
- */
1527
-
1528
- Tput.prototype._captoinfo = function(cap, s, parameterized) {
1529
- var self = this;
1530
-
1531
- var capstart;
1532
-
1533
- if (parameterized == null) {
1534
- parameterized = 0;
1535
- }
1536
-
1537
- var MAX_PUSHED = 16
1538
- , stack = [];
1539
-
1540
- var stackptr = 0
1541
- , onstack = 0
1542
- , seenm = 0
1543
- , seenn = 0
1544
- , seenr = 0
1545
- , param = 1
1546
- , i = 0
1547
- , out = '';
1548
-
1549
- function warn() {
1550
- var args = Array.prototype.slice.call(arguments);
1551
- args[0] = 'captoinfo: ' + (args[0] || '');
1552
- return self._debug.apply(self, args);
1553
- }
1554
-
1555
- function isdigit(ch) {
1556
- return ch >= '0' && ch <= '9';
1557
- }
1558
-
1559
- function isgraph(ch) {
1560
- return ch > ' ' && ch <= '~';
1561
- }
1562
-
1563
- // convert a character to a terminfo push
1564
- function cvtchar(sp) {
1565
- var c = '\0'
1566
- , len;
1567
-
1568
- var j = i;
1569
-
1570
- switch (sp[j]) {
1571
- case '\\':
1572
- switch (sp[++j]) {
1573
- case '\'':
1574
- case '$':
1575
- case '\\':
1576
- case '%':
1577
- c = sp[j];
1578
- len = 2;
1579
- break;
1580
- case '\0':
1581
- c = '\\';
1582
- len = 1;
1583
- break;
1584
- case '0':
1585
- case '1':
1586
- case '2':
1587
- case '3':
1588
- len = 1;
1589
- while (isdigit(sp[j])) {
1590
- c = String.fromCharCode(8 * c.charCodeAt(0)
1591
- + (sp[j++].charCodeAt(0) - '0'.charCodeAt(0)));
1592
- len++;
1593
- }
1594
- break;
1595
- default:
1596
- c = sp[j];
1597
- len = 2;
1598
- break;
1599
- }
1600
- break;
1601
- case '^':
1602
- c = String.fromCharCode(sp[++j].charCodeAt(0) & 0x1f);
1603
- len = 2;
1604
- break;
1605
- default:
1606
- c = sp[j];
1607
- len = 1;
1608
- }
1609
- if (isgraph(c) && c !== ',' && c !== '\'' && c !== '\\' && c !== ':') {
1610
- out += '%\'';
1611
- out += c;
1612
- out += '\'';
1613
- } else {
1614
- out += '%{';
1615
- if (c.charCodeAt(0) > 99) {
1616
- out += String.fromCharCode(
1617
- (c.charCodeAt(0) / 100 | 0) + '0'.charCodeAt(0));
1618
- }
1619
- if (c.charCodeAt(0) > 9) {
1620
- out += String.fromCharCode(
1621
- (c.charCodeAt(0) / 10 | 0) % 10 + '0'.charCodeAt(0));
1622
- }
1623
- out += String.fromCharCode(
1624
- c.charCodeAt(0) % 10 + '0'.charCodeAt(0));
1625
- out += '}';
1626
- }
1627
-
1628
- return len;
1629
- }
1630
-
1631
- // push n copies of param on the terminfo stack if not already there
1632
- function getparm(parm, n) {
1633
- if (seenr) {
1634
- if (parm === 1) {
1635
- parm = 2;
1636
- } else if (parm === 2) {
1637
- parm = 1;
1638
- }
1639
- }
1640
-
1641
- if (onstack === parm) {
1642
- if (n > 1) {
1643
- warn('string may not be optimal');
1644
- out += '%Pa';
1645
- while (n--) {
1646
- out += '%ga';
1647
- }
1648
- }
1649
- return;
1650
- }
1651
-
1652
- if (onstack !== 0) {
1653
- push();
1654
- }
1655
-
1656
- onstack = parm;
1657
-
1658
- while (n--) {
1659
- out += '%p';
1660
- out += String.fromCharCode('0'.charCodeAt(0) + parm);
1661
- }
1662
-
1663
- if (seenn && parm < 3) {
1664
- out += '%{96}%^';
1665
- }
1666
-
1667
- if (seenm && parm < 3) {
1668
- out += '%{127}%^';
1669
- }
1670
- }
1671
-
1672
- // push onstack on to the stack
1673
- function push() {
1674
- if (stackptr >= MAX_PUSHED) {
1675
- warn('string too complex to convert');
1676
- } else {
1677
- stack[stackptr++] = onstack;
1678
- }
1679
- }
1680
-
1681
- // pop the top of the stack into onstack
1682
- function pop() {
1683
- if (stackptr === 0) {
1684
- if (onstack === 0) {
1685
- warn('I\'m confused');
1686
- } else {
1687
- onstack = 0;
1688
- }
1689
- } else {
1690
- onstack = stack[--stackptr];
1691
- }
1692
- param++;
1693
- }
1694
-
1695
- function see03() {
1696
- getparm(param, 1);
1697
- out += '%3d';
1698
- pop();
1699
- }
1700
-
1701
- function invalid() {
1702
- out += '%';
1703
- i--;
1704
- warn('unknown %% code %s (%#x) in %s',
1705
- JSON.stringify(s[i]), s[i].charCodeAt(0), cap);
1706
- }
1707
-
1708
- // skip the initial padding (if we haven't been told not to)
1709
- capstart = null;
1710
- if (s == null) s = '';
1711
-
1712
- if (parameterized >= 0 && isdigit(s[i])) {
1713
- for (capstart = i;; i++) {
1714
- if (!(isdigit(s[i]) || s[i] === '*' || s[i] === '.')) {
1715
- break;
1716
- }
1717
- }
1718
- }
1719
-
1720
- while (s[i]) {
1721
- switch (s[i]) {
1722
- case '%':
1723
- i++;
1724
- if (parameterized < 1) {
1725
- out += '%';
1726
- break;
1727
- }
1728
- switch (s[i++]) {
1729
- case '%':
1730
- out += '%';
1731
- break;
1732
- case 'r':
1733
- if (seenr++ === 1) {
1734
- warn('saw %%r twice in %s', cap);
1735
- }
1736
- break;
1737
- case 'm':
1738
- if (seenm++ === 1) {
1739
- warn('saw %%m twice in %s', cap);
1740
- }
1741
- break;
1742
- case 'n':
1743
- if (seenn++ === 1) {
1744
- warn('saw %%n twice in %s', cap);
1745
- }
1746
- break;
1747
- case 'i':
1748
- out += '%i';
1749
- break;
1750
- case '6':
1751
- case 'B':
1752
- getparm(param, 1);
1753
- out += '%{10}%/%{16}%*';
1754
- getparm(param, 1);
1755
- out += '%{10}%m%+';
1756
- break;
1757
- case '8':
1758
- case 'D':
1759
- getparm(param, 2);
1760
- out += '%{2}%*%-';
1761
- break;
1762
- case '>':
1763
- getparm(param, 2);
1764
- // %?%{x}%>%t%{y}%+%;
1765
- out += '%?';
1766
- i += cvtchar(s);
1767
- out += '%>%t';
1768
- i += cvtchar(s);
1769
- out += '%+%;';
1770
- break;
1771
- case 'a':
1772
- if ((s[i] === '=' || s[i] === '+' || s[i] === '-'
1773
- || s[i] === '*' || s[i] === '/')
1774
- && (s[i + 1] === 'p' || s[i + 1] === 'c')
1775
- && s[i + 2] !== '\0' && s[i + 2]) {
1776
- var l;
1777
- l = 2;
1778
- if (s[i] !== '=') {
1779
- getparm(param, 1);
1780
- }
1781
- if (s[i + 1] === 'p') {
1782
- getparm(param + s[i + 2].charCodeAt(0) - '@'.charCodeAt(0), 1);
1783
- if (param !== onstack) {
1784
- pop();
1785
- param--;
1786
- }
1787
- l++;
1788
- } else {
1789
- i += 2, l += cvtchar(s), i -= 2;
1790
- }
1791
- switch (s[i]) {
1792
- case '+':
1793
- out += '%+';
1794
- break;
1795
- case '-':
1796
- out += '%-';
1797
- break;
1798
- case '*':
1799
- out += '%*';
1800
- break;
1801
- case '/':
1802
- out += '%/';
1803
- break;
1804
- case '=':
1805
- if (seenr) {
1806
- if (param === 1) {
1807
- onstack = 2;
1808
- } else if (param === 2) {
1809
- onstack = 1;
1810
- } else {
1811
- onstack = param;
1812
- }
1813
- } else {
1814
- onstack = param;
1815
- }
1816
- break;
1817
- }
1818
- i += l;
1819
- break;
1820
- }
1821
- getparm(param, 1);
1822
- i += cvtchar(s);
1823
- out += '%+';
1824
- break;
1825
- case '+':
1826
- getparm(param, 1);
1827
- i += cvtchar(s);
1828
- out += '%+%c';
1829
- pop();
1830
- break;
1831
- case 's':
1832
- // #ifdef WATERLOO
1833
- // i += cvtchar(s);
1834
- // getparm(param, 1);
1835
- // out += '%-';
1836
- // #else
1837
- getparm(param, 1);
1838
- out += '%s';
1839
- pop();
1840
- // #endif /* WATERLOO */
1841
- break;
1842
- case '-':
1843
- i += cvtchar(s);
1844
- getparm(param, 1);
1845
- out += '%-%c';
1846
- pop();
1847
- break;
1848
- case '.':
1849
- getparm(param, 1);
1850
- out += '%c';
1851
- pop();
1852
- break;
1853
- case '0': // not clear any of the historical termcaps did this
1854
- if (s[i] === '3') {
1855
- see03(); // goto
1856
- break;
1857
- } else if (s[i] !== '2') {
1858
- invalid(); // goto
1859
- break;
1860
- }
1861
- // FALLTHRU
1862
- case '2':
1863
- getparm(param, 1);
1864
- out += '%2d';
1865
- pop();
1866
- break;
1867
- case '3':
1868
- see03();
1869
- break;
1870
- case 'd':
1871
- getparm(param, 1);
1872
- out += '%d';
1873
- pop();
1874
- break;
1875
- case 'f':
1876
- param++;
1877
- break;
1878
- case 'b':
1879
- param--;
1880
- break;
1881
- case '\\':
1882
- out += '%\\';
1883
- break;
1884
- default:
1885
- invalid();
1886
- break;
1887
- }
1888
- break;
1889
- // #ifdef REVISIBILIZE
1890
- // case '\\':
1891
- // out += s[i++];
1892
- // out += s[i++];
1893
- // break;
1894
- // case '\n':
1895
- // out += '\\n';
1896
- // i++;
1897
- // break;
1898
- // case '\t':
1899
- // out += '\\t';
1900
- // i++;
1901
- // break;
1902
- // case '\r':
1903
- // out += '\\r';
1904
- // i++;
1905
- // break;
1906
- // case '\200':
1907
- // out += '\\0';
1908
- // i++;
1909
- // break;
1910
- // case '\f':
1911
- // out += '\\f';
1912
- // i++;
1913
- // break;
1914
- // case '\b':
1915
- // out += '\\b';
1916
- // i++;
1917
- // break;
1918
- // case ' ':
1919
- // out += '\\s';
1920
- // i++;
1921
- // break;
1922
- // case '^':
1923
- // out += '\\^';
1924
- // i++;
1925
- // break;
1926
- // case ':':
1927
- // out += '\\:';
1928
- // i++;
1929
- // break;
1930
- // case ',':
1931
- // out += '\\,';
1932
- // i++;
1933
- // break;
1934
- // default:
1935
- // if (s[i] === '\033') {
1936
- // out += '\\E';
1937
- // i++;
1938
- // } else if (s[i].charCodeAt(0) > 0 && s[i].charCodeAt(0) < 32) {
1939
- // out += '^';
1940
- // out += String.fromCharCode(s[i].charCodeAt(0) + '@'.charCodeAt(0));
1941
- // i++;
1942
- // } else if (s[i].charCodeAt(0) <= 0 || s[i].charCodeAt(0) >= 127) {
1943
- // out += '\\';
1944
- // out += String.fromCharCode(
1945
- // ((s[i].charCodeAt(0) & 0300) >> 6) + '0'.charCodeAt(0));
1946
- // out += String.fromCharCode(
1947
- // ((s[i].charCodeAt(0) & 0070) >> 3) + '0'.charCodeAt(0));
1948
- // out += String.fromCharCode(
1949
- // (s[i].charCodeAt(0) & 0007) + '0'.charCodeAt(0));
1950
- // i++;
1951
- // } else {
1952
- // out += s[i++];
1953
- // }
1954
- // break;
1955
- // #else
1956
- default:
1957
- out += s[i++];
1958
- break;
1959
- // #endif
1960
- }
1961
- }
1962
-
1963
- // Now, if we stripped off some leading padding, add it at the end
1964
- // of the string as mandatory padding.
1965
- if (capstart != null) {
1966
- out += '$<';
1967
- for (i = capstart;; i++) {
1968
- if (isdigit(s[i]) || s[i] === '*' || s[i] === '.') {
1969
- out += s[i];
1970
- } else {
1971
- break;
1972
- }
1973
- }
1974
- out += '/>';
1975
- }
1976
-
1977
- if (s !== out) {
1978
- warn('Translating %s from %s to %s.',
1979
- cap, JSON.stringify(s), JSON.stringify(out));
1980
- }
1981
-
1982
- return out;
1983
- };
1984
-
1985
- /**
1986
- * Compile All Terminfo
1987
- */
1988
-
1989
- Tput.prototype.getAll = function() {
1990
- var dir = this._prefix()
1991
- , list = asort(fs.readdirSync(dir))
1992
- , infos = [];
1993
-
1994
- list.forEach(function(letter) {
1995
- var terms = asort(fs.readdirSync(path.resolve(dir, letter)));
1996
- infos.push.apply(infos, terms);
1997
- });
1998
-
1999
- function asort(obj) {
2000
- return obj.sort(function(a, b) {
2001
- a = a.toLowerCase().charCodeAt(0);
2002
- b = b.toLowerCase().charCodeAt(0);
2003
- return a - b;
2004
- });
2005
- }
2006
-
2007
- return infos;
2008
- };
2009
-
2010
- Tput.prototype.compileAll = function(start) {
2011
- var self = this
2012
- , all = {};
2013
-
2014
- this.getAll().forEach(function(name) {
2015
- if (start && name !== start) {
2016
- return;
2017
- } else {
2018
- start = null;
2019
- }
2020
- all[name] = self.compileTerminfo(name);
2021
- });
2022
-
2023
- return all;
2024
- };
2025
-
2026
- /**
2027
- * Detect Features / Quirks
2028
- */
2029
-
2030
- Tput.prototype.detectFeatures = function(info) {
2031
- var data = this.parseACS(info);
2032
- info.features = {
2033
- unicode: this.detectUnicode(info),
2034
- brokenACS: this.detectBrokenACS(info),
2035
- PCRomSet: this.detectPCRomSet(info),
2036
- magicCookie: this.detectMagicCookie(info),
2037
- padding: this.detectPadding(info),
2038
- setbuf: this.detectSetbuf(info),
2039
- acsc: data.acsc,
2040
- acscr: data.acscr
2041
- };
2042
- return info.features;
2043
- };
2044
-
2045
- Tput.prototype.detectUnicode = function() {
2046
- if (this.options.forceUnicode != null) {
2047
- return this.options.forceUnicode;
2048
- }
2049
-
2050
- var LANG = process.env.LANG
2051
- + ':' + process.env.LANGUAGE
2052
- + ':' + process.env.LC_ALL
2053
- + ':' + process.env.LC_CTYPE;
2054
-
2055
- return /utf-?8/i.test(LANG) || (this.GetConsoleCP() === 65001);
2056
- };
2057
-
2058
- // For some reason TERM=linux has smacs/rmacs, but it maps to `^[[11m`
2059
- // and it does not switch to the DEC SCLD character set. What the hell?
2060
- // xterm: \x1b(0, screen: \x0e, linux: \x1b[11m (doesn't work)
2061
- // `man console_codes` says:
2062
- // 11 select null mapping, set display control flag, reset tog‐
2063
- // gle meta flag (ECMA-48 says "first alternate font").
2064
- // See ncurses:
2065
- // ~/ncurses/ncurses/base/lib_set_term.c
2066
- // ~/ncurses/ncurses/tinfo/lib_acs.c
2067
- // ~/ncurses/ncurses/tinfo/tinfo_driver.c
2068
- // ~/ncurses/ncurses/tinfo/lib_setup.c
2069
- Tput.prototype.detectBrokenACS = function(info) {
2070
- // ncurses-compatible env variable.
2071
- if (process.env.NCURSES_NO_UTF8_ACS != null) {
2072
- return !!+process.env.NCURSES_NO_UTF8_ACS;
2073
- }
2074
-
2075
- // If the terminal supports unicode, we don't need ACS.
2076
- if (info.numbers.U8 >= 0) {
2077
- return !!info.numbers.U8;
2078
- }
2079
-
2080
- // The linux console is just broken for some reason.
2081
- // Apparently the Linux console does not support ACS,
2082
- // but it does support the PC ROM character set.
2083
- if (info.name === 'linux') {
2084
- return true;
2085
- }
2086
-
2087
- // PC alternate charset
2088
- // if (acsc.indexOf('+\x10,\x11-\x18.\x190') === 0) {
2089
- if (this.detectPCRomSet(info)) {
2090
- return true;
2091
- }
2092
-
2093
- // screen termcap is bugged?
2094
- if (this.termcap
2095
- && info.name.indexOf('screen') === 0
2096
- && process.env.TERMCAP
2097
- && ~process.env.TERMCAP.indexOf('screen')
2098
- && ~process.env.TERMCAP.indexOf('hhII00')) {
2099
- if (~info.strings.enter_alt_charset_mode.indexOf('\016')
2100
- || ~info.strings.enter_alt_charset_mode.indexOf('\017')
2101
- || ~info.strings.set_attributes.indexOf('\016')
2102
- || ~info.strings.set_attributes.indexOf('\017')) {
2103
- return true;
2104
- }
2105
- }
2106
-
2107
- return false;
2108
- };
2109
-
2110
- // If enter_pc_charset is the same as enter_alt_charset,
2111
- // the terminal does not support SCLD as ACS.
2112
- // See: ~/ncurses/ncurses/tinfo/lib_acs.c
2113
- Tput.prototype.detectPCRomSet = function(info) {
2114
- var s = info.strings;
2115
- if (s.enter_pc_charset_mode && s.enter_alt_charset_mode
2116
- && s.enter_pc_charset_mode === s.enter_alt_charset_mode
2117
- && s.exit_pc_charset_mode === s.exit_alt_charset_mode) {
2118
- return true;
2119
- }
2120
- return false;
2121
- };
2122
-
2123
- Tput.prototype.detectMagicCookie = function() {
2124
- return process.env.NCURSES_NO_MAGIC_COOKIE == null;
2125
- };
2126
-
2127
- Tput.prototype.detectPadding = function() {
2128
- return process.env.NCURSES_NO_PADDING == null;
2129
- };
2130
-
2131
- Tput.prototype.detectSetbuf = function() {
2132
- return process.env.NCURSES_NO_SETBUF == null;
2133
- };
2134
-
2135
- Tput.prototype.parseACS = function(info) {
2136
- var data = {};
2137
-
2138
- data.acsc = {};
2139
- data.acscr = {};
2140
-
2141
- // Possibly just return an empty object, as done here, instead of
2142
- // specifically saying ACS is "broken" above. This would be more
2143
- // accurate to ncurses logic. But it doesn't really matter.
2144
- if (this.detectPCRomSet(info)) {
2145
- return data;
2146
- }
2147
-
2148
- // See: ~/ncurses/ncurses/tinfo/lib_acs.c: L208
2149
- Object.keys(Tput.acsc).forEach(function(ch) {
2150
- var acs_chars = info.strings.acs_chars || ''
2151
- , i = acs_chars.indexOf(ch)
2152
- , next = acs_chars[i + 1];
2153
-
2154
- if (!next || i === -1 || !Tput.acsc[next]) {
2155
- return;
2156
- }
2157
-
2158
- data.acsc[ch] = Tput.acsc[next];
2159
- data.acscr[Tput.acsc[next]] = ch;
2160
- });
2161
-
2162
- return data;
2163
- };
2164
-
2165
- Tput.prototype.GetConsoleCP = function() {
2166
- var ccp;
2167
-
2168
- if (process.platform !== 'win32') {
2169
- return -1;
2170
- }
2171
-
2172
- // Allow unicode on all windows consoles for now:
2173
- if (+process.env.NCURSES_UNICODE !== 0) {
2174
- return 65001;
2175
- }
2176
-
2177
- // cp.execSync('chcp 65001', { stdio: 'ignore', timeout: 1500 });
2178
-
2179
- try {
2180
- // Produces something like: 'Active code page: 437\n\n'
2181
- ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], {
2182
- stdio: ['ignore', 'pipe', 'ignore'],
2183
- encoding: 'ascii',
2184
- timeout: 1500
2185
- });
2186
- // ccp = cp.execSync('chcp', {
2187
- // stdio: ['ignore', 'pipe', 'ignore'],
2188
- // encoding: 'ascii',
2189
- // timeout: 1500
2190
- // });
2191
- } catch (e) {
2192
- ;
2193
- }
2194
-
2195
- ccp = /\d+/.exec(ccp);
2196
-
2197
- if (!ccp) {
2198
- return -1;
2199
- }
2200
-
2201
- ccp = +ccp[0];
2202
-
2203
- return ccp;
2204
- };
2205
-
2206
- /**
2207
- * Helpers
2208
- */
2209
-
2210
- function noop() {
2211
- return '';
2212
- }
2213
-
2214
- noop.unsupported = true;
2215
-
2216
- function merge(a, b) {
2217
- Object.keys(b).forEach(function(key) {
2218
- a[key] = b[key];
2219
- });
2220
- return a;
2221
- }
2222
-
2223
- function write(data) {
2224
- return process.stdout.write(data);
2225
- }
2226
-
2227
- function tryRead(file) {
2228
- if (Array.isArray(file)) {
2229
- for (var i = 0; i < file.length; i++) {
2230
- var data = tryRead(file[i]);
2231
- if (data) return data;
2232
- }
2233
- return '';
2234
- }
2235
- if (!file) return '';
2236
- file = path.resolve.apply(path, arguments);
2237
- try {
2238
- return fs.readFileSync(file, 'utf8');
2239
- } catch (e) {
2240
- return '';
2241
- }
2242
- }
2243
-
2244
- /**
2245
- * sprintf
2246
- * http://www.cplusplus.com/reference/cstdio/printf/
2247
- */
2248
-
2249
- function sprintf(src) {
2250
- var params = Array.prototype.slice.call(arguments, 1)
2251
- , rule = /%([\-+# ]{1,4})?(\d+(?:\.\d+)?)?([doxXsc])/g
2252
- , i = 0;
2253
-
2254
- return src.replace(rule, function(_, flag, width, type) {
2255
- var flags = (flag || '').split('')
2256
- , param = params[i] != null ? params[i] : ''
2257
- , initial = param
2258
- // , width = +width
2259
- , opt = {}
2260
- , pre = '';
2261
-
2262
- i++;
2263
-
2264
- switch (type) {
2265
- case 'd': // signed int
2266
- param = (+param).toString(10);
2267
- break;
2268
- case 'o': // unsigned octal
2269
- param = (+param).toString(8);
2270
- break;
2271
- case 'x': // unsigned hex int
2272
- param = (+param).toString(16);
2273
- break;
2274
- case 'X': // unsigned hex int uppercase
2275
- param = (+param).toString(16).toUppercase();
2276
- break;
2277
- case 's': // string
2278
- break;
2279
- case 'c': // char
2280
- param = isFinite(param)
2281
- ? String.fromCharCode(param || 0o200)
2282
- : '';
2283
- break;
2284
- }
2285
-
2286
- flags.forEach(function(flag) {
2287
- switch (flag) {
2288
- // left-justify by width
2289
- case '-':
2290
- opt.left = true;
2291
- break;
2292
- // always precede numbers with their signs
2293
- case '+':
2294
- opt.signs = true;
2295
- break;
2296
- // used with o, x, X - value is preceded with 0, 0x, or 0X respectively.
2297
- // used with a, A, e, E, f, F, g, G - forces written output to contain
2298
- // a decimal point even if no more digits follow
2299
- case '#':
2300
- opt.hexpoint = true;
2301
- break;
2302
- // if no sign is going to be written, black space in front of the value
2303
- case ' ':
2304
- opt.space = true;
2305
- break;
2306
- }
2307
- });
2308
-
2309
- width = +width.split('.')[0];
2310
-
2311
- // Should this be for opt.left too?
2312
- // Example: %2.2X - turns 0 into 00
2313
- if (width && !opt.left) {
2314
- param = param + '';
2315
- while (param.length < width) {
2316
- param = '0' + param;
2317
- }
2318
- }
2319
-
2320
- if (opt.signs) {
2321
- if (+initial >= 0) {
2322
- pre += '+';
2323
- }
2324
- }
2325
-
2326
- if (opt.space) {
2327
- if (!opt.signs && +initial >= 0) {
2328
- pre += ' ';
2329
- }
2330
- }
2331
-
2332
- if (opt.hexpoint) {
2333
- switch (type) {
2334
- case 'o': // unsigned octal
2335
- pre += '0';
2336
- break;
2337
- case 'x': // unsigned hex int
2338
- pre += '0x';
2339
- break;
2340
- case 'X': // unsigned hex int uppercase
2341
- pre += '0X';
2342
- break;
2343
- }
2344
- }
2345
-
2346
- if (opt.left) {
2347
- if (width > (pre.length + param.length)) {
2348
- width -= pre.length + param.length;
2349
- pre = Array(width + 1).join(' ') + pre;
2350
- }
2351
- }
2352
-
2353
- return pre + param;
2354
- });
2355
- }
2356
-
2357
- /**
2358
- * Aliases
2359
- */
2360
-
2361
- Tput._alias = require('./alias');
2362
-
2363
- Tput.alias = {};
2364
-
2365
- ['bools', 'numbers', 'strings'].forEach(function(type) {
2366
- Object.keys(Tput._alias[type]).forEach(function(key) {
2367
- var aliases = Tput._alias[type][key];
2368
- Tput.alias[key] = [aliases[0]];
2369
- Tput.alias[key].terminfo = aliases[0];
2370
- Tput.alias[key].termcap = aliases[1];
2371
- });
2372
- });
2373
-
2374
- // Bools
2375
- Tput.alias.no_esc_ctlc.push('beehive_glitch');
2376
- Tput.alias.dest_tabs_magic_smso.push('teleray_glitch');
2377
-
2378
- // Numbers
2379
- Tput.alias.micro_col_size.push('micro_char_size');
2380
-
2381
- /**
2382
- * Feature Checking
2383
- */
2384
-
2385
- Tput.aliasMap = {};
2386
-
2387
- Object.keys(Tput.alias).forEach(function(key) {
2388
- Tput.aliasMap[key] = key;
2389
- Tput.alias[key].forEach(function(k) {
2390
- Tput.aliasMap[k] = key;
2391
- });
2392
- });
2393
-
2394
- Tput.prototype.has = function(name) {
2395
- name = Tput.aliasMap[name];
2396
-
2397
- var val = this.all[name];
2398
-
2399
- if (!name) return false;
2400
-
2401
- if (typeof val === 'number') {
2402
- return val !== -1;
2403
- }
2404
-
2405
- return !!val;
2406
- };
2407
-
2408
- /**
2409
- * Fallback Termcap Entry
2410
- */
2411
-
2412
- Tput.termcap = ''
2413
- + 'vt102|dec vt102:'
2414
- + ':do=^J:co#80:li#24:cl=50\\E[;H\\E[2J:'
2415
- + ':le=^H:bs:cm=5\\E[%i%d;%dH:nd=2\\E[C:up=2\\E[A:'
2416
- + ':ce=3\\E[K:cd=50\\E[J:so=2\\E[7m:se=2\\E[m:us=2\\E[4m:ue=2\\E[m:'
2417
- + ':md=2\\E[1m:mr=2\\E[7m:mb=2\\E[5m:me=2\\E[m:is=\\E[1;24r\\E[24;1H:'
2418
- + ':rs=\\E>\\E[?3l\\E[?4l\\E[?5l\\E[?7h\\E[?8h:ks=\\E[?1h\\E=:ke=\\E[?1l\\E>:'
2419
- + ':ku=\\EOA:kd=\\EOB:kr=\\EOC:kl=\\EOD:kb=^H:\\\n'
2420
- + ':ho=\\E[H:k1=\\EOP:k2=\\EOQ:k3=\\EOR:k4=\\EOS:pt:sr=5\\EM:vt#3:'
2421
- + ':sc=\\E7:rc=\\E8:cs=\\E[%i%d;%dr:vs=\\E[?7l:ve=\\E[?7h:'
2422
- + ':mi:al=\\E[L:dc=\\E[P:dl=\\E[M:ei=\\E[4l:im=\\E[4h:';
2423
-
2424
- /**
2425
- * Terminfo Data
2426
- */
2427
-
2428
- Tput.bools = [
2429
- 'auto_left_margin',
2430
- 'auto_right_margin',
2431
- 'no_esc_ctlc',
2432
- 'ceol_standout_glitch',
2433
- 'eat_newline_glitch',
2434
- 'erase_overstrike',
2435
- 'generic_type',
2436
- 'hard_copy',
2437
- 'has_meta_key',
2438
- 'has_status_line',
2439
- 'insert_null_glitch',
2440
- 'memory_above',
2441
- 'memory_below',
2442
- 'move_insert_mode',
2443
- 'move_standout_mode',
2444
- 'over_strike',
2445
- 'status_line_esc_ok',
2446
- 'dest_tabs_magic_smso',
2447
- 'tilde_glitch',
2448
- 'transparent_underline',
2449
- 'xon_xoff',
2450
- 'needs_xon_xoff',
2451
- 'prtr_silent',
2452
- 'hard_cursor',
2453
- 'non_rev_rmcup',
2454
- 'no_pad_char',
2455
- 'non_dest_scroll_region',
2456
- 'can_change',
2457
- 'back_color_erase',
2458
- 'hue_lightness_saturation',
2459
- 'col_addr_glitch',
2460
- 'cr_cancels_micro_mode',
2461
- 'has_print_wheel',
2462
- 'row_addr_glitch',
2463
- 'semi_auto_right_margin',
2464
- 'cpi_changes_res',
2465
- 'lpi_changes_res',
2466
-
2467
- // #ifdef __INTERNAL_CAPS_VISIBLE
2468
- 'backspaces_with_bs',
2469
- 'crt_no_scrolling',
2470
- 'no_correctly_working_cr',
2471
- 'gnu_has_meta_key',
2472
- 'linefeed_is_newline',
2473
- 'has_hardware_tabs',
2474
- 'return_does_clr_eol'
2475
- ];
2476
-
2477
- Tput.numbers = [
2478
- 'columns',
2479
- 'init_tabs',
2480
- 'lines',
2481
- 'lines_of_memory',
2482
- 'magic_cookie_glitch',
2483
- 'padding_baud_rate',
2484
- 'virtual_terminal',
2485
- 'width_status_line',
2486
- 'num_labels',
2487
- 'label_height',
2488
- 'label_width',
2489
- 'max_attributes',
2490
- 'maximum_windows',
2491
- 'max_colors',
2492
- 'max_pairs',
2493
- 'no_color_video',
2494
- 'buffer_capacity',
2495
- 'dot_vert_spacing',
2496
- 'dot_horz_spacing',
2497
- 'max_micro_address',
2498
- 'max_micro_jump',
2499
- 'micro_col_size',
2500
- 'micro_line_size',
2501
- 'number_of_pins',
2502
- 'output_res_char',
2503
- 'output_res_line',
2504
- 'output_res_horz_inch',
2505
- 'output_res_vert_inch',
2506
- 'print_rate',
2507
- 'wide_char_size',
2508
- 'buttons',
2509
- 'bit_image_entwining',
2510
- 'bit_image_type',
2511
-
2512
- // #ifdef __INTERNAL_CAPS_VISIBLE
2513
- 'magic_cookie_glitch_ul',
2514
- 'carriage_return_delay',
2515
- 'new_line_delay',
2516
- 'backspace_delay',
2517
- 'horizontal_tab_delay',
2518
- 'number_of_function_keys'
2519
- ];
2520
-
2521
- Tput.strings = [
2522
- 'back_tab',
2523
- 'bell',
2524
- 'carriage_return',
2525
- 'change_scroll_region',
2526
- 'clear_all_tabs',
2527
- 'clear_screen',
2528
- 'clr_eol',
2529
- 'clr_eos',
2530
- 'column_address',
2531
- 'command_character',
2532
- 'cursor_address',
2533
- 'cursor_down',
2534
- 'cursor_home',
2535
- 'cursor_invisible',
2536
- 'cursor_left',
2537
- 'cursor_mem_address',
2538
- 'cursor_normal',
2539
- 'cursor_right',
2540
- 'cursor_to_ll',
2541
- 'cursor_up',
2542
- 'cursor_visible',
2543
- 'delete_character',
2544
- 'delete_line',
2545
- 'dis_status_line',
2546
- 'down_half_line',
2547
- 'enter_alt_charset_mode',
2548
- 'enter_blink_mode',
2549
- 'enter_bold_mode',
2550
- 'enter_ca_mode',
2551
- 'enter_delete_mode',
2552
- 'enter_dim_mode',
2553
- 'enter_insert_mode',
2554
- 'enter_secure_mode',
2555
- 'enter_protected_mode',
2556
- 'enter_reverse_mode',
2557
- 'enter_standout_mode',
2558
- 'enter_underline_mode',
2559
- 'erase_chars',
2560
- 'exit_alt_charset_mode',
2561
- 'exit_attribute_mode',
2562
- 'exit_ca_mode',
2563
- 'exit_delete_mode',
2564
- 'exit_insert_mode',
2565
- 'exit_standout_mode',
2566
- 'exit_underline_mode',
2567
- 'flash_screen',
2568
- 'form_feed',
2569
- 'from_status_line',
2570
- 'init_1string',
2571
- 'init_2string',
2572
- 'init_3string',
2573
- 'init_file',
2574
- 'insert_character',
2575
- 'insert_line',
2576
- 'insert_padding',
2577
- 'key_backspace',
2578
- 'key_catab',
2579
- 'key_clear',
2580
- 'key_ctab',
2581
- 'key_dc',
2582
- 'key_dl',
2583
- 'key_down',
2584
- 'key_eic',
2585
- 'key_eol',
2586
- 'key_eos',
2587
- 'key_f0',
2588
- 'key_f1',
2589
- 'key_f10',
2590
- 'key_f2',
2591
- 'key_f3',
2592
- 'key_f4',
2593
- 'key_f5',
2594
- 'key_f6',
2595
- 'key_f7',
2596
- 'key_f8',
2597
- 'key_f9',
2598
- 'key_home',
2599
- 'key_ic',
2600
- 'key_il',
2601
- 'key_left',
2602
- 'key_ll',
2603
- 'key_npage',
2604
- 'key_ppage',
2605
- 'key_right',
2606
- 'key_sf',
2607
- 'key_sr',
2608
- 'key_stab',
2609
- 'key_up',
2610
- 'keypad_local',
2611
- 'keypad_xmit',
2612
- 'lab_f0',
2613
- 'lab_f1',
2614
- 'lab_f10',
2615
- 'lab_f2',
2616
- 'lab_f3',
2617
- 'lab_f4',
2618
- 'lab_f5',
2619
- 'lab_f6',
2620
- 'lab_f7',
2621
- 'lab_f8',
2622
- 'lab_f9',
2623
- 'meta_off',
2624
- 'meta_on',
2625
- 'newline',
2626
- 'pad_char',
2627
- 'parm_dch',
2628
- 'parm_delete_line',
2629
- 'parm_down_cursor',
2630
- 'parm_ich',
2631
- 'parm_index',
2632
- 'parm_insert_line',
2633
- 'parm_left_cursor',
2634
- 'parm_right_cursor',
2635
- 'parm_rindex',
2636
- 'parm_up_cursor',
2637
- 'pkey_key',
2638
- 'pkey_local',
2639
- 'pkey_xmit',
2640
- 'print_screen',
2641
- 'prtr_off',
2642
- 'prtr_on',
2643
- 'repeat_char',
2644
- 'reset_1string',
2645
- 'reset_2string',
2646
- 'reset_3string',
2647
- 'reset_file',
2648
- 'restore_cursor',
2649
- 'row_address',
2650
- 'save_cursor',
2651
- 'scroll_forward',
2652
- 'scroll_reverse',
2653
- 'set_attributes',
2654
- 'set_tab',
2655
- 'set_window',
2656
- 'tab',
2657
- 'to_status_line',
2658
- 'underline_char',
2659
- 'up_half_line',
2660
- 'init_prog',
2661
- 'key_a1',
2662
- 'key_a3',
2663
- 'key_b2',
2664
- 'key_c1',
2665
- 'key_c3',
2666
- 'prtr_non',
2667
- 'char_padding',
2668
- 'acs_chars',
2669
- 'plab_norm',
2670
- 'key_btab',
2671
- 'enter_xon_mode',
2672
- 'exit_xon_mode',
2673
- 'enter_am_mode',
2674
- 'exit_am_mode',
2675
- 'xon_character',
2676
- 'xoff_character',
2677
- 'ena_acs',
2678
- 'label_on',
2679
- 'label_off',
2680
- 'key_beg',
2681
- 'key_cancel',
2682
- 'key_close',
2683
- 'key_command',
2684
- 'key_copy',
2685
- 'key_create',
2686
- 'key_end',
2687
- 'key_enter',
2688
- 'key_exit',
2689
- 'key_find',
2690
- 'key_help',
2691
- 'key_mark',
2692
- 'key_message',
2693
- 'key_move',
2694
- 'key_next',
2695
- 'key_open',
2696
- 'key_options',
2697
- 'key_previous',
2698
- 'key_print',
2699
- 'key_redo',
2700
- 'key_reference',
2701
- 'key_refresh',
2702
- 'key_replace',
2703
- 'key_restart',
2704
- 'key_resume',
2705
- 'key_save',
2706
- 'key_suspend',
2707
- 'key_undo',
2708
- 'key_sbeg',
2709
- 'key_scancel',
2710
- 'key_scommand',
2711
- 'key_scopy',
2712
- 'key_screate',
2713
- 'key_sdc',
2714
- 'key_sdl',
2715
- 'key_select',
2716
- 'key_send',
2717
- 'key_seol',
2718
- 'key_sexit',
2719
- 'key_sfind',
2720
- 'key_shelp',
2721
- 'key_shome',
2722
- 'key_sic',
2723
- 'key_sleft',
2724
- 'key_smessage',
2725
- 'key_smove',
2726
- 'key_snext',
2727
- 'key_soptions',
2728
- 'key_sprevious',
2729
- 'key_sprint',
2730
- 'key_sredo',
2731
- 'key_sreplace',
2732
- 'key_sright',
2733
- 'key_srsume',
2734
- 'key_ssave',
2735
- 'key_ssuspend',
2736
- 'key_sundo',
2737
- 'req_for_input',
2738
- 'key_f11',
2739
- 'key_f12',
2740
- 'key_f13',
2741
- 'key_f14',
2742
- 'key_f15',
2743
- 'key_f16',
2744
- 'key_f17',
2745
- 'key_f18',
2746
- 'key_f19',
2747
- 'key_f20',
2748
- 'key_f21',
2749
- 'key_f22',
2750
- 'key_f23',
2751
- 'key_f24',
2752
- 'key_f25',
2753
- 'key_f26',
2754
- 'key_f27',
2755
- 'key_f28',
2756
- 'key_f29',
2757
- 'key_f30',
2758
- 'key_f31',
2759
- 'key_f32',
2760
- 'key_f33',
2761
- 'key_f34',
2762
- 'key_f35',
2763
- 'key_f36',
2764
- 'key_f37',
2765
- 'key_f38',
2766
- 'key_f39',
2767
- 'key_f40',
2768
- 'key_f41',
2769
- 'key_f42',
2770
- 'key_f43',
2771
- 'key_f44',
2772
- 'key_f45',
2773
- 'key_f46',
2774
- 'key_f47',
2775
- 'key_f48',
2776
- 'key_f49',
2777
- 'key_f50',
2778
- 'key_f51',
2779
- 'key_f52',
2780
- 'key_f53',
2781
- 'key_f54',
2782
- 'key_f55',
2783
- 'key_f56',
2784
- 'key_f57',
2785
- 'key_f58',
2786
- 'key_f59',
2787
- 'key_f60',
2788
- 'key_f61',
2789
- 'key_f62',
2790
- 'key_f63',
2791
- 'clr_bol',
2792
- 'clear_margins',
2793
- 'set_left_margin',
2794
- 'set_right_margin',
2795
- 'label_format',
2796
- 'set_clock',
2797
- 'display_clock',
2798
- 'remove_clock',
2799
- 'create_window',
2800
- 'goto_window',
2801
- 'hangup',
2802
- 'dial_phone',
2803
- 'quick_dial',
2804
- 'tone',
2805
- 'pulse',
2806
- 'flash_hook',
2807
- 'fixed_pause',
2808
- 'wait_tone',
2809
- 'user0',
2810
- 'user1',
2811
- 'user2',
2812
- 'user3',
2813
- 'user4',
2814
- 'user5',
2815
- 'user6',
2816
- 'user7',
2817
- 'user8',
2818
- 'user9',
2819
- 'orig_pair',
2820
- 'orig_colors',
2821
- 'initialize_color',
2822
- 'initialize_pair',
2823
- 'set_color_pair',
2824
- 'set_foreground',
2825
- 'set_background',
2826
- 'change_char_pitch',
2827
- 'change_line_pitch',
2828
- 'change_res_horz',
2829
- 'change_res_vert',
2830
- 'define_char',
2831
- 'enter_doublewide_mode',
2832
- 'enter_draft_quality',
2833
- 'enter_italics_mode',
2834
- 'enter_leftward_mode',
2835
- 'enter_micro_mode',
2836
- 'enter_near_letter_quality',
2837
- 'enter_normal_quality',
2838
- 'enter_shadow_mode',
2839
- 'enter_subscript_mode',
2840
- 'enter_superscript_mode',
2841
- 'enter_upward_mode',
2842
- 'exit_doublewide_mode',
2843
- 'exit_italics_mode',
2844
- 'exit_leftward_mode',
2845
- 'exit_micro_mode',
2846
- 'exit_shadow_mode',
2847
- 'exit_subscript_mode',
2848
- 'exit_superscript_mode',
2849
- 'exit_upward_mode',
2850
- 'micro_column_address',
2851
- 'micro_down',
2852
- 'micro_left',
2853
- 'micro_right',
2854
- 'micro_row_address',
2855
- 'micro_up',
2856
- 'order_of_pins',
2857
- 'parm_down_micro',
2858
- 'parm_left_micro',
2859
- 'parm_right_micro',
2860
- 'parm_up_micro',
2861
- 'select_char_set',
2862
- 'set_bottom_margin',
2863
- 'set_bottom_margin_parm',
2864
- 'set_left_margin_parm',
2865
- 'set_right_margin_parm',
2866
- 'set_top_margin',
2867
- 'set_top_margin_parm',
2868
- 'start_bit_image',
2869
- 'start_char_set_def',
2870
- 'stop_bit_image',
2871
- 'stop_char_set_def',
2872
- 'subscript_characters',
2873
- 'superscript_characters',
2874
- 'these_cause_cr',
2875
- 'zero_motion',
2876
- 'char_set_names',
2877
- 'key_mouse',
2878
- 'mouse_info',
2879
- 'req_mouse_pos',
2880
- 'get_mouse',
2881
- 'set_a_foreground',
2882
- 'set_a_background',
2883
- 'pkey_plab',
2884
- 'device_type',
2885
- 'code_set_init',
2886
- 'set0_des_seq',
2887
- 'set1_des_seq',
2888
- 'set2_des_seq',
2889
- 'set3_des_seq',
2890
- 'set_lr_margin',
2891
- 'set_tb_margin',
2892
- 'bit_image_repeat',
2893
- 'bit_image_newline',
2894
- 'bit_image_carriage_return',
2895
- 'color_names',
2896
- 'define_bit_image_region',
2897
- 'end_bit_image_region',
2898
- 'set_color_band',
2899
- 'set_page_length',
2900
- 'display_pc_char',
2901
- 'enter_pc_charset_mode',
2902
- 'exit_pc_charset_mode',
2903
- 'enter_scancode_mode',
2904
- 'exit_scancode_mode',
2905
- 'pc_term_options',
2906
- 'scancode_escape',
2907
- 'alt_scancode_esc',
2908
- 'enter_horizontal_hl_mode',
2909
- 'enter_left_hl_mode',
2910
- 'enter_low_hl_mode',
2911
- 'enter_right_hl_mode',
2912
- 'enter_top_hl_mode',
2913
- 'enter_vertical_hl_mode',
2914
- 'set_a_attributes',
2915
- 'set_pglen_inch',
2916
-
2917
- // #ifdef __INTERNAL_CAPS_VISIBLE
2918
- 'termcap_init2',
2919
- 'termcap_reset',
2920
- 'linefeed_if_not_lf',
2921
- 'backspace_if_not_bs',
2922
- 'other_non_function_keys',
2923
- 'arrow_key_map',
2924
- 'acs_ulcorner',
2925
- 'acs_llcorner',
2926
- 'acs_urcorner',
2927
- 'acs_lrcorner',
2928
- 'acs_ltee',
2929
- 'acs_rtee',
2930
- 'acs_btee',
2931
- 'acs_ttee',
2932
- 'acs_hline',
2933
- 'acs_vline',
2934
- 'acs_plus',
2935
- 'memory_lock',
2936
- 'memory_unlock',
2937
- 'box_chars_1'
2938
- ];
2939
-
2940
- // DEC Special Character and Line Drawing Set.
2941
- // Taken from tty.js.
2942
- Tput.acsc = { // (0
2943
- '`': '\u25c6', // '◆'
2944
- 'a': '\u2592', // '▒'
2945
- 'b': '\u0009', // '\t'
2946
- 'c': '\u000c', // '\f'
2947
- 'd': '\u000d', // '\r'
2948
- 'e': '\u000a', // '\n'
2949
- 'f': '\u00b0', // '°'
2950
- 'g': '\u00b1', // '±'
2951
- 'h': '\u2424', // '\u2424' (NL)
2952
- 'i': '\u000b', // '\v'
2953
- 'j': '\u2518', // '┘'
2954
- 'k': '\u2510', // '┐'
2955
- 'l': '\u250c', // '┌'
2956
- 'm': '\u2514', // '└'
2957
- 'n': '\u253c', // '┼'
2958
- 'o': '\u23ba', // '⎺'
2959
- 'p': '\u23bb', // '⎻'
2960
- 'q': '\u2500', // '─'
2961
- 'r': '\u23bc', // '⎼'
2962
- 's': '\u23bd', // '⎽'
2963
- 't': '\u251c', // '├'
2964
- 'u': '\u2524', // '┤'
2965
- 'v': '\u2534', // '┴'
2966
- 'w': '\u252c', // '┬'
2967
- 'x': '\u2502', // '│'
2968
- 'y': '\u2264', // '≤'
2969
- 'z': '\u2265', // '≥'
2970
- '{': '\u03c0', // 'π'
2971
- '|': '\u2260', // '≠'
2972
- '}': '\u00a3', // '£'
2973
- '~': '\u00b7' // '·'
2974
- };
2975
-
2976
- // Convert ACS unicode characters to the
2977
- // most similar-looking ascii characters.
2978
- Tput.utoa = Tput.prototype.utoa = {
2979
- '\u25c6': '*', // '◆'
2980
- '\u2592': ' ', // '▒'
2981
- // '\u0009': '\t', // '\t'
2982
- // '\u000c': '\f', // '\f'
2983
- // '\u000d': '\r', // '\r'
2984
- // '\u000a': '\n', // '\n'
2985
- '\u00b0': '*', // '°'
2986
- '\u00b1': '+', // '±'
2987
- '\u2424': '\n', // '\u2424' (NL)
2988
- // '\u000b': '\v', // '\v'
2989
- '\u2518': '+', // '┘'
2990
- '\u2510': '+', // '┐'
2991
- '\u250c': '+', // '┌'
2992
- '\u2514': '+', // '└'
2993
- '\u253c': '+', // '┼'
2994
- '\u23ba': '-', // '⎺'
2995
- '\u23bb': '-', // '⎻'
2996
- '\u2500': '-', // '─'
2997
- '\u23bc': '-', // '⎼'
2998
- '\u23bd': '_', // '⎽'
2999
- '\u251c': '+', // '├'
3000
- '\u2524': '+', // '┤'
3001
- '\u2534': '+', // '┴'
3002
- '\u252c': '+', // '┬'
3003
- '\u2502': '|', // '│'
3004
- '\u2264': '<', // '≤'
3005
- '\u2265': '>', // '≥'
3006
- '\u03c0': '?', // 'π'
3007
- '\u2260': '=', // '≠'
3008
- '\u00a3': '?', // '£'
3009
- '\u00b7': '*' // '·'
3010
- };
3011
-
3012
- /**
3013
- * Expose
3014
- */
3015
-
3016
- exports = Tput;
3017
- exports.sprintf = sprintf;
3018
- exports.tryRead = tryRead;
3019
-
3020
- module.exports = exports;