@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,1757 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * tng.js - png reader
5
- * Copyright (c) 2015, Christopher Jeffrey (MIT License).
6
- * https://github.com/chjj/tng
7
- */
8
-
9
- var fs = require('fs')
10
- , util = require('util')
11
- , path = require('path')
12
- , zlib = require('zlib')
13
- , assert = require('assert')
14
- , cp = require('child_process')
15
- , exec = cp.execFileSync;
16
-
17
- /**
18
- * PNG
19
- */
20
-
21
- function PNG(file, options) {
22
- var buf
23
- , chunks
24
- , idat
25
- , pixels;
26
-
27
- if (!(this instanceof PNG)) {
28
- return new PNG(file, options);
29
- }
30
-
31
- if (!file) throw new Error('no file');
32
-
33
- this.options = options || {};
34
- this.colors = options.colors || require('blessed/lib/colors');
35
- this.optimization = this.options.optimization || 'mem';
36
- this.speed = this.options.speed || 1;
37
-
38
- if (Buffer.isBuffer(file)) {
39
- this.file = this.options.filename || null;
40
- buf = file;
41
- } else {
42
- this.options.filename = file;
43
- this.file = path.resolve(process.cwd(), file);
44
- buf = fs.readFileSync(this.file);
45
- }
46
-
47
- this.format = buf.readUInt32BE(0) === 0x89504e47 ? 'png'
48
- : buf.slice(0, 3).toString('ascii') === 'GIF' ? 'gif'
49
- : buf.readUInt16BE(0) === 0xffd8 ? 'jpg'
50
- : path.extname(this.file).slice(1).toLowerCase() || 'png';
51
-
52
- if (this.format !== 'png') {
53
- try {
54
- return this.toPNG(buf);
55
- } catch (e) {
56
- throw e;
57
- }
58
- }
59
-
60
- chunks = this.parseRaw(buf);
61
- idat = this.parseChunks(chunks);
62
- pixels = this.parseLines(idat);
63
-
64
- this.bmp = this.createBitmap(pixels);
65
- this.cellmap = this.createCellmap(this.bmp);
66
- this.frames = this.compileFrames(this.frames);
67
- }
68
-
69
- PNG.prototype.parseRaw = function(buf) {
70
- var chunks = []
71
- , index = 0
72
- , i = 0
73
- , buf
74
- , len
75
- , type
76
- , name
77
- , data
78
- , crc
79
- , check
80
- , critical
81
- , public_
82
- , conforming
83
- , copysafe
84
- , pos;
85
-
86
- this._debug(this.file);
87
-
88
- if (buf.readUInt32BE(0) !== 0x89504e47
89
- || buf.readUInt32BE(4) !== 0x0d0a1a0a) {
90
- throw new Error('bad header');
91
- }
92
-
93
- i += 8;
94
-
95
- while (i < buf.length) {
96
- try {
97
- len = buf.readUInt32BE(i);
98
- i += 4;
99
- pos = i;
100
- type = buf.slice(i, i + 4);
101
- name = type.toString('ascii');
102
- i += 4;
103
- data = buf.slice(i, i + len);
104
- i += len;
105
- check = this.crc32(buf.slice(pos, i));
106
- crc = buf.readInt32BE(i);
107
- i += 4;
108
- critical = !!(~type[0] & 32);
109
- public_ = !!(~type[1] & 32);
110
- conforming = !!(~type[2] & 32);
111
- copysafe = !!(~type[3] & 32);
112
- if (crc !== check) {
113
- throw new Error(name + ': bad crc');
114
- }
115
- } catch (e) {
116
- if (this.options.debug) throw e;
117
- break;
118
- }
119
- chunks.push({
120
- index: index++,
121
- id: name.toLowerCase(),
122
- len: len,
123
- pos: pos,
124
- end: i,
125
- type: type,
126
- name: name,
127
- data: data,
128
- crc: crc,
129
- check: check,
130
- raw: buf.slice(pos, i),
131
- flags: {
132
- critical: critical,
133
- public_: public_,
134
- conforming: conforming,
135
- copysafe: copysafe
136
- }
137
- });
138
- }
139
-
140
- return chunks;
141
- };
142
-
143
- PNG.prototype.parseChunks = function(chunks) {
144
- var i
145
- , chunk
146
- , name
147
- , data
148
- , p
149
- , idat
150
- , info;
151
-
152
- for (i = 0; i < chunks.length; i++) {
153
- chunk = chunks[i];
154
- name = chunk.id;
155
- data = chunk.data;
156
- info = {};
157
- switch (name) {
158
- case 'ihdr': {
159
- this.width = info.width = data.readUInt32BE(0);
160
- this.height = info.height = data.readUInt32BE(4);
161
- this.bitDepth = info.bitDepth = data.readUInt8(8);
162
- this.colorType = info.colorType = data.readUInt8(9);
163
- this.compression = info.compression = data.readUInt8(10);
164
- this.filter = info.filter = data.readUInt8(11);
165
- this.interlace = info.interlace = data.readUInt8(12);
166
- switch (this.bitDepth) {
167
- case 1: case 2: case 4: case 8: case 16: case 24: case 32: break;
168
- default: throw new Error('bad bit depth: ' + this.bitDepth);
169
- }
170
- switch (this.colorType) {
171
- case 0: case 2: case 3: case 4: case 6: break;
172
- default: throw new Error('bad color: ' + this.colorType);
173
- }
174
- switch (this.compression) {
175
- case 0: break;
176
- default: throw new Error('bad compression: ' + this.compression);
177
- }
178
- switch (this.filter) {
179
- case 0: case 1: case 2: case 3: case 4: break;
180
- default: throw new Error('bad filter: ' + this.filter);
181
- }
182
- switch (this.interlace) {
183
- case 0: case 1: break;
184
- default: throw new Error('bad interlace: ' + this.interlace);
185
- }
186
- break;
187
- }
188
- case 'plte': {
189
- this.palette = info.palette = [];
190
- for (p = 0; p < data.length; p += 3) {
191
- this.palette.push({
192
- r: data[p + 0],
193
- g: data[p + 1],
194
- b: data[p + 2],
195
- a: 255
196
- });
197
- }
198
- break;
199
- }
200
- case 'idat': {
201
- this.size = this.size || 0;
202
- this.size += data.length;
203
- this.idat = this.idat || [];
204
- this.idat.push(data);
205
- info.size = data.length;
206
- break;
207
- }
208
- case 'iend': {
209
- this.end = true;
210
- break;
211
- }
212
- case 'trns': {
213
- this.alpha = info.alpha = Array.prototype.slice.call(data);
214
- if (this.palette) {
215
- for (p = 0; p < data.length; p++) {
216
- if (!this.palette[p]) break;
217
- this.palette[p].a = data[p];
218
- }
219
- }
220
- break;
221
- }
222
- // https://wiki.mozilla.org/APNG_Specification
223
- case 'actl': {
224
- this.actl = info = {};
225
- this.frames = [];
226
- this.actl.numFrames = data.readUInt32BE(0);
227
- this.actl.numPlays = data.readUInt32BE(4);
228
- break;
229
- }
230
- case 'fctl': {
231
- // IDAT is the first frame depending on the order:
232
- // IDAT is a frame: acTL->fcTL->IDAT->[fcTL]->fdAT
233
- // IDAT is not a frame: acTL->IDAT->[fcTL]->fdAT
234
- if (!this.idat) {
235
- this.idat = [];
236
- this.frames.push({
237
- idat: true,
238
- fctl: info,
239
- fdat: this.idat
240
- });
241
- } else {
242
- this.frames.push({
243
- fctl: info,
244
- fdat: []
245
- });
246
- }
247
- info.sequenceNumber = data.readUInt32BE(0);
248
- info.width = data.readUInt32BE(4);
249
- info.height = data.readUInt32BE(8);
250
- info.xOffset = data.readUInt32BE(12);
251
- info.yOffset = data.readUInt32BE(16);
252
- info.delayNum = data.readUInt16BE(20);
253
- info.delayDen = data.readUInt16BE(22);
254
- info.disposeOp = data.readUInt8(24);
255
- info.blendOp = data.readUInt8(25);
256
- break;
257
- }
258
- case 'fdat': {
259
- info.sequenceNumber = data.readUInt32BE(0);
260
- info.data = data.slice(4);
261
- this.frames[this.frames.length - 1].fdat.push(info.data);
262
- break;
263
- }
264
- }
265
- chunk.info = info;
266
- }
267
-
268
- this._debug(chunks);
269
-
270
- if (this.frames) {
271
- this.frames = this.frames.map(function(frame, i) {
272
- frame.fdat = this.decompress(frame.fdat);
273
- if (!frame.fdat.length) throw new Error('no data');
274
- return frame;
275
- }, this);
276
- }
277
-
278
- idat = this.decompress(this.idat);
279
- if (!idat.length) throw new Error('no data');
280
-
281
- return idat;
282
- };
283
-
284
- PNG.prototype.parseLines = function(data) {
285
- var pixels = []
286
- , x
287
- , p
288
- , prior
289
- , line
290
- , filter
291
- , samples
292
- , pendingSamples
293
- , ch
294
- , shiftStart
295
- , i
296
- , toShift
297
- , sample;
298
-
299
- this.sampleDepth =
300
- this.colorType === 0 ? 1
301
- : this.colorType === 2 ? 3
302
- : this.colorType === 3 ? 1
303
- : this.colorType === 4 ? 2
304
- : this.colorType === 6 ? 4
305
- : 1;
306
- this.bitsPerPixel = this.bitDepth * this.sampleDepth;
307
- this.bytesPerPixel = Math.ceil(this.bitsPerPixel / 8);
308
- this.wastedBits = ((this.width * this.bitsPerPixel) / 8) - ((this.width * this.bitsPerPixel / 8) | 0);
309
- this.byteWidth = Math.ceil(this.width * (this.bitsPerPixel / 8));
310
-
311
- this.shiftStart = ((this.bitDepth + (8 / this.bitDepth - this.bitDepth)) - 1) | 0;
312
- this.shiftMult = this.bitDepth >= 8 ? 0 : this.bitDepth;
313
- this.mask = this.bitDepth === 32 ? 0xffffffff : (1 << this.bitDepth) - 1;
314
-
315
- if (this.interlace === 1) {
316
- samples = this.sampleInterlacedLines(data);
317
- for (i = 0; i < samples.length; i += this.sampleDepth) {
318
- pixels.push(samples.slice(i, i + this.sampleDepth));
319
- }
320
- return pixels;
321
- }
322
-
323
- for (p = 0; p < data.length; p += this.byteWidth) {
324
- prior = line || [];
325
- filter = data[p++];
326
- line = data.slice(p, p + this.byteWidth);
327
- line = this.unfilterLine(filter, line, prior);
328
- samples = this.sampleLine(line);
329
- for (i = 0; i < samples.length; i += this.sampleDepth) {
330
- pixels.push(samples.slice(i, i + this.sampleDepth));
331
- }
332
- }
333
-
334
- return pixels;
335
- };
336
-
337
- PNG.prototype.unfilterLine = function(filter, line, prior) {
338
- for (var x = 0; x < line.length; x++) {
339
- if (filter === 0) {
340
- break;
341
- } else if (filter === 1) {
342
- line[x] = this.filters.sub(x, line, prior, this.bytesPerPixel);
343
- } else if (filter === 2) {
344
- line[x] = this.filters.up(x, line, prior, this.bytesPerPixel);
345
- } else if (filter === 3) {
346
- line[x] = this.filters.average(x, line, prior, this.bytesPerPixel);
347
- } else if (filter === 4) {
348
- line[x] = this.filters.paeth(x, line, prior, this.bytesPerPixel);
349
- }
350
- }
351
- return line;
352
- };
353
-
354
- PNG.prototype.sampleLine = function(line, width) {
355
- var samples = []
356
- , x = 0
357
- , pendingSamples
358
- , ch
359
- , i
360
- , sample
361
- , shiftStart
362
- , toShift;
363
-
364
- while (x < line.length) {
365
- pendingSamples = this.sampleDepth;
366
- while (pendingSamples--) {
367
- ch = line[x];
368
- if (this.bitDepth === 16) {
369
- ch = (ch << 8) | line[++x];
370
- } else if (this.bitDepth === 24) {
371
- ch = (ch << 16) | (line[++x] << 8) | line[++x];
372
- } else if (this.bitDepth === 32) {
373
- ch = (ch << 24) | (line[++x] << 16) | (line[++x] << 8) | line[++x];
374
- } else if (this.bitDepth > 32) {
375
- throw new Error('bitDepth ' + this.bitDepth + ' unsupported.');
376
- }
377
- shiftStart = this.shiftStart;
378
- toShift = shiftStart - (x === line.length - 1 ? this.wastedBits : 0);
379
- for (i = 0; i <= toShift; i++) {
380
- sample = (ch >> (this.shiftMult * shiftStart)) & this.mask;
381
- if (this.colorType !== 3) {
382
- if (this.bitDepth < 8) { // <= 8 would work too, doesn't matter
383
- // sample = sample * (0xff / this.mask) | 0; // would work too
384
- sample *= 0xff / this.mask;
385
- sample |= 0;
386
- } else if (this.bitDepth > 8) {
387
- sample = (sample / this.mask) * 255 | 0;
388
- }
389
- }
390
- samples.push(sample);
391
- shiftStart--;
392
- }
393
- x++;
394
- }
395
- }
396
-
397
- // Needed for deinterlacing?
398
- if (width != null) {
399
- samples = samples.slice(0, width * this.sampleDepth);
400
- }
401
-
402
- return samples;
403
- };
404
-
405
- // http://www.w3.org/TR/PNG-Filters.html
406
- PNG.prototype.filters = {
407
- sub: function Sub(x, line, prior, bpp) {
408
- if (x < bpp) return line[x];
409
- return (line[x] + line[x - bpp]) % 256;
410
- },
411
- up: function Up(x, line, prior, bpp) {
412
- return (line[x] + (prior[x] || 0)) % 256;
413
- },
414
- average: function Average(x, line, prior, bpp) {
415
- if (x < bpp) return Math.floor((prior[x] || 0) / 2);
416
- // if (x < bpp) return (prior[x] || 0) >> 1;
417
- return (line[x]
418
- + Math.floor((line[x - bpp] + prior[x]) / 2)
419
- // + ((line[x - bpp] + prior[x]) >> 1)
420
- ) % 256;
421
- },
422
- paeth: function Paeth(x, line, prior, bpp) {
423
- if (x < bpp) return prior[x] || 0;
424
- return (line[x] + this._predictor(
425
- line[x - bpp], prior[x] || 0, prior[x - bpp] || 0
426
- )) % 256;
427
- },
428
- _predictor: function PaethPredictor(a, b, c) {
429
- // a = left, b = above, c = upper left
430
- var p = a + b - c
431
- , pa = Math.abs(p - a)
432
- , pb = Math.abs(p - b)
433
- , pc = Math.abs(p - c);
434
- if (pa <= pb && pa <= pc) return a;
435
- if (pb <= pc) return b;
436
- return c;
437
- }
438
- };
439
-
440
- /**
441
- * Adam7 deinterlacing ported to javascript from PyPNG:
442
- * pypng - Pure Python library for PNG image encoding/decoding
443
- * Copyright (c) 2009-2015, David Jones (MIT License).
444
- * https://github.com/drj11/pypng
445
- *
446
- * Permission is hereby granted, free of charge, to any person
447
- * obtaining a copy of this software and associated documentation files
448
- * (the "Software"), to deal in the Software without restriction,
449
- * including without limitation the rights to use, copy, modify, merge,
450
- * publish, distribute, sublicense, and/or sell copies of the Software,
451
- * and to permit persons to whom the Software is furnished to do so,
452
- * subject to the following conditions:
453
- *
454
- * The above copyright notice and this permission notice shall be
455
- * included in all copies or substantial portions of the Software.
456
- *
457
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
458
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
459
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
460
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
461
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
462
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
463
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
464
- * SOFTWARE.
465
- */
466
-
467
- PNG.prototype.sampleInterlacedLines = function(raw) {
468
- var psize
469
- , vpr
470
- , samples
471
- , source_offset
472
- , i
473
- , pass
474
- , xstart
475
- , ystart
476
- , xstep
477
- , ystep
478
- , recon
479
- , ppr
480
- , row_size
481
- , y
482
- , filter_type
483
- , scanline
484
- , flat
485
- , offset
486
- , k
487
- , end_offset
488
- , skip
489
- , j
490
- , k
491
- , f;
492
-
493
- var adam7 = [
494
- [0, 0, 8, 8],
495
- [4, 0, 8, 8],
496
- [0, 4, 4, 8],
497
- [2, 0, 4, 4],
498
- [0, 2, 2, 4],
499
- [1, 0, 2, 2],
500
- [0, 1, 1, 2]
501
- ];
502
-
503
- // Fractional bytes per pixel
504
- psize = (this.bitDepth / 8) * this.sampleDepth;
505
-
506
- // Values per row (of the target image)
507
- vpr = this.width * this.sampleDepth;
508
-
509
- // Make a result array, and make it big enough. Interleaving
510
- // writes to the output array randomly (well, not quite), so the
511
- // entire output array must be in memory.
512
- samples = new Buffer(vpr * this.height);
513
- samples.fill(0);
514
-
515
- source_offset = 0;
516
-
517
- for (i = 0; i < adam7.length; i++) {
518
- pass = adam7[i];
519
- xstart = pass[0];
520
- ystart = pass[1];
521
- xstep = pass[2];
522
- ystep = pass[3];
523
- if (xstart >= this.width) continue;
524
- // The previous (reconstructed) scanline. Empty array at the
525
- // beginning of a pass to indicate that there is no previous
526
- // line.
527
- recon = [];
528
- // Pixels per row (reduced pass image)
529
- ppr = Math.ceil((this.width - xstart) / xstep);
530
- // Row size in bytes for this pass.
531
- row_size = Math.ceil(psize * ppr);
532
- for (y = ystart; y < this.height; y += ystep) {
533
- filter_type = raw[source_offset];
534
- source_offset += 1;
535
- scanline = raw.slice(source_offset, source_offset + row_size);
536
- source_offset += row_size;
537
- recon = this.unfilterLine(filter_type, scanline, recon);
538
- // Convert so that there is one element per pixel value
539
- flat = this.sampleLine(recon, ppr);
540
- if (xstep === 1) {
541
- assert.equal(xstart, 0);
542
- offset = y * vpr;
543
- for (k = offset, f = 0; k < offset + vpr; k++, f++) {
544
- samples[k] = flat[f];
545
- }
546
- } else {
547
- offset = y * vpr + xstart * this.sampleDepth;
548
- end_offset = (y + 1) * vpr;
549
- skip = this.sampleDepth * xstep;
550
- for (j = 0; j < this.sampleDepth; j++) {
551
- for (k = offset + j, f = j; k < end_offset; k += skip, f += this.sampleDepth) {
552
- samples[k] = flat[f];
553
- }
554
- }
555
- }
556
- }
557
- }
558
-
559
- return samples;
560
- };
561
-
562
- PNG.prototype.createBitmap = function(pixels) {
563
- var bmp = []
564
- , i;
565
-
566
- if (this.colorType === 0) {
567
- pixels = pixels.map(function(sample) {
568
- return { r: sample[0], g: sample[0], b: sample[0], a: 255 };
569
- });
570
- } else if (this.colorType === 2) {
571
- pixels = pixels.map(function(sample) {
572
- return { r: sample[0], g: sample[1], b: sample[2], a: 255 };
573
- });
574
- } else if (this.colorType === 3) {
575
- pixels = pixels.map(function(sample) {
576
- if (!this.palette[sample[0]]) throw new Error('bad palette index');
577
- return this.palette[sample[0]];
578
- }, this);
579
- } else if (this.colorType === 4) {
580
- pixels = pixels.map(function(sample) {
581
- return { r: sample[0], g: sample[0], b: sample[0], a: sample[1] };
582
- });
583
- } else if (this.colorType === 6) {
584
- pixels = pixels.map(function(sample) {
585
- return { r: sample[0], g: sample[1], b: sample[2], a: sample[3] };
586
- });
587
- }
588
-
589
- for (i = 0; i < pixels.length; i += this.width) {
590
- bmp.push(pixels.slice(i, i + this.width));
591
- }
592
-
593
- return bmp;
594
- };
595
-
596
- PNG.prototype.createCellmap = function(bmp, options) {
597
- var bmp = bmp || this.bmp
598
- , options = options || this.options
599
- , cellmap = []
600
- , scale = options.scale || 0.20
601
- , height = bmp.length
602
- , width = bmp[0].length
603
- , cmwidth = options.width
604
- , cmheight = options.height
605
- , line
606
- , x
607
- , y
608
- , xx
609
- , yy
610
- , scale
611
- , xs
612
- , ys;
613
-
614
- if (cmwidth) {
615
- scale = cmwidth / width;
616
- } else if (cmheight) {
617
- scale = cmheight / height;
618
- }
619
-
620
- if (!cmheight) {
621
- cmheight = Math.round(height * scale);
622
- }
623
-
624
- if (!cmwidth) {
625
- cmwidth = Math.round(width * scale);
626
- }
627
-
628
- ys = height / cmheight;
629
- xs = width / cmwidth;
630
-
631
- for (y = 0; y < bmp.length; y += ys) {
632
- line = [];
633
- yy = Math.round(y);
634
- if (!bmp[yy]) break;
635
- for (x = 0; x < bmp[yy].length; x += xs) {
636
- xx = Math.round(x);
637
- if (!bmp[yy][xx]) break;
638
- line.push(bmp[yy][xx]);
639
- }
640
- cellmap.push(line);
641
- }
642
-
643
- return cellmap;
644
- };
645
-
646
- PNG.prototype.renderANSI = function(bmp) {
647
- var self = this
648
- , out = '';
649
-
650
- bmp.forEach(function(line, y) {
651
- line.forEach(function(pixel, x) {
652
- var outch = self.getOutch(x, y, line, pixel);
653
- out += self.pixelToSGR(pixel, outch);
654
- });
655
- out += '\n';
656
- });
657
-
658
- return out;
659
- };
660
-
661
- PNG.prototype.renderContent = function(bmp, el) {
662
- var self = this
663
- , out = '';
664
-
665
- bmp.forEach(function(line, y) {
666
- line.forEach(function(pixel, x) {
667
- var outch = self.getOutch(x, y, line, pixel);
668
- out += self.pixelToTags(pixel, outch);
669
- });
670
- out += '\n';
671
- });
672
-
673
- el.setContent(out);
674
-
675
- return out;
676
- };
677
-
678
- PNG.prototype.renderScreen = function(bmp, screen, xi, xl, yi, yl) {
679
- var self = this
680
- , lines = screen.lines
681
- , cellLines
682
- , y
683
- , yy
684
- , x
685
- , xx
686
- , alpha
687
- , attr
688
- , ch;
689
-
690
- cellLines = bmp.reduce(function(cellLines, line, y) {
691
- var cellLine = [];
692
- line.forEach(function(pixel, x) {
693
- var outch = self.getOutch(x, y, line, pixel)
694
- , cell = self.pixelToCell(pixel, outch);
695
- cellLine.push(cell);
696
- });
697
- cellLines.push(cellLine);
698
- return cellLines;
699
- }, []);
700
-
701
- for (y = yi; y < yl; y++) {
702
- yy = y - yi;
703
- for (x = xi; x < xl; x++) {
704
- xx = x - xi;
705
- if (lines[y] && lines[y][x] && cellLines[yy] && cellLines[yy][xx]) {
706
- alpha = cellLines[yy][xx].pop();
707
- // completely transparent
708
- if (alpha === 0.0) {
709
- continue;
710
- }
711
- // translucency / blending
712
- if (alpha < 1.0) {
713
- attr = cellLines[yy][xx][0];
714
- ch = cellLines[yy][xx][1];
715
- lines[y][x][0] = this.colors.blend(lines[y][x][0], attr, alpha);
716
- if (ch !== ' ') lines[y][x][1] = ch;
717
- lines[y].dirty = true;
718
- continue;
719
- }
720
- // completely opaque
721
- lines[y][x] = cellLines[yy][xx];
722
- lines[y].dirty = true;
723
- }
724
- }
725
- }
726
- };
727
-
728
- PNG.prototype.renderElement = function(bmp, el) {
729
- var xi = el.aleft + el.ileft
730
- , xl = el.aleft + el.width - el.iright
731
- , yi = el.atop + el.itop
732
- , yl = el.atop + el.height - el.ibottom;
733
-
734
- return this.renderScreen(bmp, el.screen, xi, xl, yi, yl);
735
- };
736
-
737
- PNG.prototype.pixelToSGR = function(pixel, ch) {
738
- var bga = 1.0
739
- , fga = 0.5
740
- , a = pixel.a / 255
741
- , bg
742
- , fg;
743
-
744
- bg = this.colors.match(
745
- pixel.r * a * bga | 0,
746
- pixel.g * a * bga | 0,
747
- pixel.b * a * bga | 0);
748
-
749
- if (ch && this.options.ascii) {
750
- fg = this.colors.match(
751
- pixel.r * a * fga | 0,
752
- pixel.g * a * fga | 0,
753
- pixel.b * a * fga | 0);
754
- if (a === 0) {
755
- return '\x1b[38;5;' + fg + 'm' + ch + '\x1b[m';
756
- }
757
- return '\x1b[38;5;' + fg + 'm\x1b[48;5;' + bg + 'm' + ch + '\x1b[m';
758
- }
759
-
760
- if (a === 0) return ' ';
761
-
762
- return '\x1b[48;5;' + bg + 'm \x1b[m';
763
- };
764
-
765
- PNG.prototype.pixelToTags = function(pixel, ch) {
766
- var bga = 1.0
767
- , fga = 0.5
768
- , a = pixel.a / 255
769
- , bg
770
- , fg;
771
-
772
- bg = this.colors.RGBtoHex(
773
- pixel.r * a * bga | 0,
774
- pixel.g * a * bga | 0,
775
- pixel.b * a * bga | 0);
776
-
777
- if (ch && this.options.ascii) {
778
- fg = this.colors.RGBtoHex(
779
- pixel.r * a * fga | 0,
780
- pixel.g * a * fga | 0,
781
- pixel.b * a * fga | 0);
782
- if (a === 0) {
783
- return '{' + fg + '-fg}' + ch + '{/}';
784
- }
785
- return '{' + fg + '-fg}{' + bg + '-bg}' + ch + '{/}';
786
- }
787
-
788
- if (a === 0) return ' ';
789
-
790
- return '{' + bg + '-bg} {/' + bg + '-bg}';
791
- };
792
-
793
- PNG.prototype.pixelToCell = function(pixel, ch) {
794
- var bga = 1.0
795
- , fga = 0.5
796
- , a = pixel.a / 255
797
- , bg
798
- , fg;
799
-
800
- bg = this.colors.match(
801
- pixel.r * bga | 0,
802
- pixel.g * bga | 0,
803
- pixel.b * bga | 0);
804
-
805
- if (ch && this.options.ascii) {
806
- fg = this.colors.match(
807
- pixel.r * fga | 0,
808
- pixel.g * fga | 0,
809
- pixel.b * fga | 0);
810
- } else {
811
- fg = 0x1ff;
812
- ch = null;
813
- }
814
-
815
- // if (a === 0) bg = 0x1ff;
816
-
817
- return [(0 << 18) | (fg << 9) | (bg << 0), ch || ' ', a];
818
- };
819
-
820
- // Taken from libcaca:
821
- PNG.prototype.getOutch = (function() {
822
- var dchars = '????8@8@#8@8##8#MKXWwz$&%x><\\/xo;+=|^-:i\'.`, `. ';
823
-
824
- var luminance = function(pixel) {
825
- var a = pixel.a / 255
826
- , r = pixel.r * a
827
- , g = pixel.g * a
828
- , b = pixel.b * a
829
- , l = 0.2126 * r + 0.7152 * g + 0.0722 * b;
830
-
831
- return l / 255;
832
- };
833
-
834
- return function(x, y, line, pixel) {
835
- var lumi = luminance(pixel)
836
- , outch = dchars[lumi * (dchars.length - 1) | 0];
837
-
838
- return outch;
839
- };
840
- })();
841
-
842
- PNG.prototype.compileFrames = function(frames) {
843
- return this.optimization === 'mem'
844
- ? this.compileFrames_lomem(frames)
845
- : this.compileFrames_locpu(frames);
846
- };
847
-
848
- PNG.prototype.compileFrames_lomem = function(frames) {
849
- if (!this.actl) return;
850
- return frames.map(function(frame, i) {
851
- this.width = frame.fctl.width;
852
- this.height = frame.fctl.height;
853
-
854
- var pixels = frame._pixels || this.parseLines(frame.fdat)
855
- , bmp = frame._bmp || this.createBitmap(pixels)
856
- , fc = frame.fctl;
857
-
858
- return {
859
- actl: this.actl,
860
- fctl: frame.fctl,
861
- delay: (fc.delayNum / (fc.delayDen || 100)) * 1000 | 0,
862
- bmp: bmp
863
- };
864
- }, this);
865
- };
866
-
867
- PNG.prototype.compileFrames_locpu = function(frames) {
868
- if (!this.actl) return;
869
-
870
- this._curBmp = null;
871
- this._lastBmp = null;
872
-
873
- return frames.map(function(frame, i) {
874
- this.width = frame.fctl.width;
875
- this.height = frame.fctl.height;
876
-
877
- var pixels = frame._pixels || this.parseLines(frame.fdat)
878
- , bmp = frame._bmp || this.createBitmap(pixels)
879
- , renderBmp = this.renderFrame(bmp, frame, i)
880
- , cellmap = this.createCellmap(renderBmp)
881
- , fc = frame.fctl;
882
-
883
- return {
884
- actl: this.actl,
885
- fctl: frame.fctl,
886
- delay: (fc.delayNum / (fc.delayDen || 100)) * 1000 | 0,
887
- bmp: renderBmp,
888
- cellmap: cellmap
889
- };
890
- }, this);
891
- };
892
-
893
- PNG.prototype.renderFrame = function(bmp, frame, i) {
894
- var first = this.frames[0]
895
- , last = this.frames[i - 1]
896
- , fc = frame.fctl
897
- , xo = fc.xOffset
898
- , yo = fc.yOffset
899
- , lxo
900
- , lyo
901
- , x
902
- , y
903
- , line
904
- , p;
905
-
906
- if (!this._curBmp) {
907
- this._curBmp = [];
908
- for (y = 0; y < first.fctl.height; y++) {
909
- line = [];
910
- for (x = 0; x < first.fctl.width; x++) {
911
- p = bmp[y][x];
912
- line.push({ r: p.r, g: p.g, b: p.b, a: p.a });
913
- }
914
- this._curBmp.push(line);
915
- }
916
- }
917
-
918
- if (last && last.fctl.disposeOp !== 0) {
919
- lxo = last.fctl.xOffset;
920
- lyo = last.fctl.yOffset;
921
- for (y = 0; y < last.fctl.height; y++) {
922
- for (x = 0; x < last.fctl.width; x++) {
923
- if (last.fctl.disposeOp === 0) {
924
- // none / keep
925
- } else if (last.fctl.disposeOp === 1) {
926
- // background / clear
927
- this._curBmp[lyo + y][lxo + x] = { r: 0, g: 0, b: 0, a: 0 };
928
- } else if (last.fctl.disposeOp === 2) {
929
- // previous / restore
930
- p = this._lastBmp[y][x];
931
- this._curBmp[lyo + y][lxo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
932
- }
933
- }
934
- }
935
- }
936
-
937
- if (frame.fctl.disposeOp === 2) {
938
- this._lastBmp = [];
939
- for (y = 0; y < frame.fctl.height; y++) {
940
- line = [];
941
- for (x = 0; x < frame.fctl.width; x++) {
942
- p = this._curBmp[yo + y][xo + x];
943
- line.push({ r: p.r, g: p.g, b: p.b, a: p.a });
944
- }
945
- this._lastBmp.push(line);
946
- }
947
- } else {
948
- this._lastBmp = null;
949
- }
950
-
951
- for (y = 0; y < frame.fctl.height; y++) {
952
- for (x = 0; x < frame.fctl.width; x++) {
953
- p = bmp[y][x];
954
- if (fc.blendOp === 0) {
955
- // source
956
- this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
957
- } else if (fc.blendOp === 1) {
958
- // over
959
- if (p.a !== 0) {
960
- this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
961
- }
962
- }
963
- }
964
- }
965
-
966
- return this._curBmp;
967
- };
968
-
969
- PNG.prototype._animate = function(callback) {
970
- if (!this.frames) {
971
- return callback(this.bmp, this.cellmap);
972
- }
973
-
974
- var self = this
975
- , numPlays = this.actl.numPlays || Infinity
976
- , running = 0
977
- , i = -1;
978
-
979
- this._curBmp = null;
980
- this._lastBmp = null;
981
-
982
- var next_lomem = function() {
983
- if (!running) return;
984
-
985
- var frame = self.frames[++i];
986
- if (!frame) {
987
- if (!--numPlays) return callback();
988
- i = -1;
989
- // XXX may be able to optimize by only setting the self._curBmp once???
990
- self._curBmp = null;
991
- self._lastBmp = null;
992
- return setImmediate(next);
993
- }
994
-
995
- var bmp = frame.bmp
996
- , renderBmp = self.renderFrame(bmp, frame, i)
997
- , cellmap = self.createCellmap(renderBmp);
998
-
999
- callback(renderBmp, cellmap);
1000
- return setTimeout(next, frame.delay / self.speed | 0);
1001
- };
1002
-
1003
- var next_locpu = function() {
1004
- if (!running) return;
1005
- var frame = self.frames[++i];
1006
- if (!frame) {
1007
- if (!--numPlays) return callback();
1008
- i = -1;
1009
- return setImmediate(next);
1010
- }
1011
- callback(frame.bmp, frame.cellmap);
1012
- return setTimeout(next, frame.delay / self.speed | 0);
1013
- };
1014
-
1015
- var next = this.optimization === 'mem'
1016
- ? next_lomem
1017
- : next_locpu;
1018
-
1019
- this._control = function(state) {
1020
- if (state === -1) {
1021
- i = -1;
1022
- self._curBmp = null;
1023
- self._lastBmp = null;
1024
- running = 0;
1025
- callback(self.frames[0].bmp,
1026
- self.frames[0].cellmap || self.createCellmap(self.frames[0].bmp));
1027
- return;
1028
- }
1029
- if (state === running) return;
1030
- running = state;
1031
- return next();
1032
- };
1033
-
1034
- this._control(1);
1035
- };
1036
-
1037
- PNG.prototype.play = function(callback) {
1038
- if (!this._control || callback) {
1039
- this.stop();
1040
- return this._animate(callback);
1041
- }
1042
- this._control(1);
1043
- };
1044
-
1045
- PNG.prototype.pause = function() {
1046
- if (!this._control) return;
1047
- this._control(0);
1048
- };
1049
-
1050
- PNG.prototype.stop = function() {
1051
- if (!this._control) return;
1052
- this._control(-1);
1053
- };
1054
-
1055
- PNG.prototype.toPNG = function(input) {
1056
- var options = this.options
1057
- , file = this.file
1058
- , format = this.format
1059
- , buf
1060
- , img
1061
- , gif
1062
- , i
1063
- , control
1064
- , disposeOp;
1065
-
1066
- if (format !== 'gif') {
1067
- buf = exec('convert', [format + ':-', 'png:-'],
1068
- { stdio: ['pipe', 'pipe', 'ignore'], input: input });
1069
- img = PNG(buf, options);
1070
- img.file = file;
1071
- return img;
1072
- }
1073
-
1074
- gif = GIF(input, options);
1075
-
1076
- this.width = gif.width;
1077
- this.height = gif.height;
1078
- this.frames = [];
1079
-
1080
- for (i = 0; i < gif.images.length; i++) {
1081
- img = gif.images[i];
1082
- // Convert from gif disposal to png disposal. See:
1083
- // http://www.w3.org/Graphics/GIF/spec-gif89a.txt
1084
- control = img.control || gif;
1085
- disposeOp = Math.max(0, (control.disposeMethod || 0) - 1);
1086
- if (disposeOp > 2) disposeOp = 0;
1087
- this.frames.push({
1088
- fctl: {
1089
- sequenceNumber: i,
1090
- width: img.width,
1091
- height: img.height,
1092
- xOffset: img.left,
1093
- yOffset: img.top,
1094
- delayNum: control.delay,
1095
- delayDen: 100,
1096
- disposeOp: disposeOp,
1097
- blendOp: 1
1098
- },
1099
- fdat: [],
1100
- _pixels: [],
1101
- _bmp: img.bmp
1102
- });
1103
- }
1104
-
1105
- this.bmp = this.frames[0]._bmp;
1106
- this.cellmap = this.createCellmap(this.bmp);
1107
-
1108
- if (this.frames.length > 1) {
1109
- this.actl = { numFrames: gif.images.length, numPlays: gif.numPlays || 0 };
1110
- this.frames = this.compileFrames(this.frames);
1111
- } else {
1112
- this.frames = undefined;
1113
- }
1114
-
1115
- return this;
1116
- };
1117
-
1118
- // Convert a gif to an apng using imagemagick. Unfortunately imagemagick
1119
- // doesn't support apngs, so we coalesce the gif frames into one image and then
1120
- // slice them into frames.
1121
- PNG.prototype.gifMagick = function(input) {
1122
- var options = this.options
1123
- , file = this.file
1124
- , format = this.format
1125
- , buf
1126
- , fmt
1127
- , img
1128
- , frames
1129
- , frame
1130
- , width
1131
- , height
1132
- , iwidth
1133
- , twidth
1134
- , i
1135
- , lines
1136
- , line
1137
- , x
1138
- , y;
1139
-
1140
- buf = exec('convert',
1141
- [format + ':-', '-coalesce', '+append', 'png:-'],
1142
- { stdio: ['pipe', 'pipe', 'ignore'], input: input });
1143
-
1144
- fmt = '{"W":%W,"H":%H,"w":%w,"h":%h,"d":%T,"x":"%X","y":"%Y"},'
1145
- frames = exec('identify', ['-format', fmt, format + ':-'],
1146
- { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'], input: input });
1147
- frames = JSON.parse('[' + frames.trim().slice(0, -1) + ']');
1148
-
1149
- img = PNG(buf, options);
1150
- img.file = file;
1151
- Object.keys(img).forEach(function(key) {
1152
- this[key] = img[key];
1153
- }, this);
1154
-
1155
- width = frames[0].W;
1156
- height = frames[0].H;
1157
- iwidth = 0;
1158
- twidth = 0;
1159
-
1160
- this.width = width;
1161
- this.height = height;
1162
-
1163
- this.frames = [];
1164
-
1165
- for (i = 0; i < frames.length; i++) {
1166
- frame = frames[i];
1167
- frame.x = +frame.x;
1168
- frame.y = +frame.y;
1169
-
1170
- iwidth = twidth;
1171
- twidth += width;
1172
-
1173
- lines = [];
1174
- for (y = frame.y; y < height; y++) {
1175
- line = [];
1176
- for (x = iwidth + frame.x; x < twidth; x++) {
1177
- line.push(img.bmp[y][x]);
1178
- }
1179
- lines.push(line);
1180
- }
1181
-
1182
- this.frames.push({
1183
- fctl: {
1184
- sequenceNumber: i,
1185
- width: frame.w,
1186
- height: frame.h,
1187
- xOffset: frame.x,
1188
- yOffset: frame.y,
1189
- delayNum: frame.d,
1190
- delayDen: 100,
1191
- disposeOp: 0,
1192
- blendOp: 0
1193
- },
1194
- fdat: [],
1195
- _pixels: [],
1196
- _bmp: lines
1197
- });
1198
- }
1199
-
1200
- this.bmp = this.frames[0]._bmp;
1201
- this.cellmap = this.createCellmap(this.bmp);
1202
-
1203
- if (this.frames.length > 1) {
1204
- this.actl = { numFrames: frames.length, numPlays: 0 };
1205
- this.frames = this.compileFrames(this.frames);
1206
- } else {
1207
- this.frames = undefined;
1208
- }
1209
-
1210
- return this;
1211
- };
1212
-
1213
- PNG.prototype.decompress = function(buffers) {
1214
- return zlib.inflateSync(new Buffer(buffers.reduce(function(out, data) {
1215
- return out.concat(Array.prototype.slice.call(data));
1216
- }, [])));
1217
- };
1218
-
1219
- /**
1220
- * node-crc
1221
- * https://github.com/alexgorbatchev/node-crc
1222
- * https://github.com/alexgorbatchev/node-crc/blob/master/LICENSE
1223
- *
1224
- * The MIT License (MIT)
1225
- *
1226
- * Copyright 2014 Alex Gorbatchev
1227
- *
1228
- * Permission is hereby granted, free of charge, to any person obtaining
1229
- * a copy of this software and associated documentation files (the
1230
- * "Software"), to deal in the Software without restriction, including
1231
- * without limitation the rights to use, copy, modify, merge, publish,
1232
- * distribute, sublicense, and/or sell copies of the Software, and to
1233
- * permit persons to whom the Software is furnished to do so, subject to
1234
- * the following conditions:
1235
- *
1236
- * The above copyright notice and this permission notice shall be
1237
- * included in all copies or substantial portions of the Software.
1238
- *
1239
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1240
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1241
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1242
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1243
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1244
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1245
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1246
- */
1247
-
1248
- PNG.prototype.crc32 = (function() {
1249
- var crcTable = [
1250
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
1251
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
1252
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
1253
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
1254
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
1255
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
1256
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
1257
- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
1258
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
1259
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
1260
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
1261
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
1262
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
1263
- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
1264
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
1265
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
1266
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
1267
- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
1268
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
1269
- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
1270
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
1271
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
1272
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
1273
- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
1274
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
1275
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
1276
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
1277
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
1278
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
1279
- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
1280
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
1281
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
1282
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
1283
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
1284
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
1285
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
1286
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
1287
- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
1288
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
1289
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
1290
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
1291
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
1292
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
1293
- ];
1294
-
1295
- return function crc32(buf) {
1296
- //var crc = previous === 0 ? 0 : ~~previous ^ -1;
1297
- var crc = -1;
1298
- for (var i = 0, len = buf.length; i < len; i++) {
1299
- crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
1300
- }
1301
- return crc ^ -1;
1302
- };
1303
- })();
1304
-
1305
- PNG.prototype._debug = function() {
1306
- if (!this.options.log) return;
1307
- return this.options.log.apply(null, arguments);
1308
- };
1309
-
1310
- /**
1311
- * GIF
1312
- */
1313
-
1314
- function GIF(file, options) {
1315
- var self = this;
1316
-
1317
- if (!(this instanceof GIF)) {
1318
- return new GIF(file, options);
1319
- }
1320
-
1321
- var info = {}
1322
- , p = 0
1323
- , buf
1324
- , i
1325
- , total
1326
- , sig
1327
- , desc
1328
- , img
1329
- , ext
1330
- , label
1331
- , size;
1332
-
1333
- if (!file) throw new Error('no file');
1334
-
1335
- options = options || {};
1336
-
1337
- this.options = options;
1338
-
1339
- // XXX If the gif is not optimized enough
1340
- // it may OOM the process with too many frames.
1341
- // TODO: Implement in PNG reader.
1342
- this.pixelLimit = this.options.pixelLimit || 7622550;
1343
- this.totalPixels = 0;
1344
-
1345
- if (Buffer.isBuffer(file)) {
1346
- buf = file;
1347
- file = null;
1348
- } else {
1349
- file = path.resolve(process.cwd(), file);
1350
- buf = fs.readFileSync(file);
1351
- }
1352
-
1353
- sig = buf.slice(0, 6).toString('ascii');
1354
- if (sig !== 'GIF87a' && sig !== 'GIF89a') {
1355
- throw new Error('bad header: ' + sig);
1356
- }
1357
-
1358
- this.width = buf.readUInt16LE(6);
1359
- this.height = buf.readUInt16LE(8);
1360
-
1361
- this.flags = buf.readUInt8(10);
1362
- this.gct = !!(this.flags & 0x80);
1363
- this.gctsize = (this.flags & 0x07) + 1;
1364
-
1365
- this.bgIndex = buf.readUInt8(11);
1366
- this.aspect = buf.readUInt8(12);
1367
- p += 13;
1368
-
1369
- if (this.gct) {
1370
- this.colors = [];
1371
- total = 1 << this.gctsize;
1372
- for (i = 0; i < total; i++, p += 3) {
1373
- this.colors.push([buf[p], buf[p + 1], buf[p + 2], 255]);
1374
- }
1375
- }
1376
-
1377
- this.images = [];
1378
- this.extensions = [];
1379
-
1380
- try {
1381
- while (p < buf.length) {
1382
- desc = buf.readUInt8(p);
1383
- p += 1;
1384
- if (desc === 0x2c) {
1385
- img = {};
1386
-
1387
- img.left = buf.readUInt16LE(p);
1388
- p += 2;
1389
- img.top = buf.readUInt16LE(p);
1390
- p += 2;
1391
-
1392
- img.width = buf.readUInt16LE(p);
1393
- p += 2;
1394
- img.height = buf.readUInt16LE(p);
1395
- p += 2;
1396
-
1397
- img.flags = buf.readUInt8(p);
1398
- p += 1;
1399
-
1400
- img.lct = !!(img.flags & 0x80);
1401
- img.ilace = !!(img.flags & 0x40);
1402
- img.lctsize = (img.flags & 0x07) + 1;
1403
-
1404
- if (img.lct) {
1405
- img.lcolors = [];
1406
- total = 1 << img.lctsize;
1407
- for (i = 0; i < total; i++, p += 3) {
1408
- img.lcolors.push([buf[p], buf[p + 1], buf[p + 2], 255]);
1409
- }
1410
- }
1411
-
1412
- img.codeSize = buf.readUInt8(p);
1413
- p += 1;
1414
-
1415
- img.size = buf.readUInt8(p);
1416
- p += 1;
1417
-
1418
- img.lzw = [buf.slice(p, p + img.size)];
1419
- p += img.size;
1420
-
1421
- while (buf[p] !== 0x00) {
1422
- // Some gifs screw up their size.
1423
- // XXX Same for all subblocks?
1424
- if (buf[p] === 0x3b && p === buf.length - 1) {
1425
- p--;
1426
- break;
1427
- }
1428
- size = buf.readUInt8(p);
1429
- p += 1;
1430
- img.lzw.push(buf.slice(p, p + size));
1431
- p += size;
1432
- }
1433
-
1434
- assert.equal(buf.readUInt8(p), 0x00);
1435
- p += 1;
1436
-
1437
- if (ext && ext.label === 0xf9) {
1438
- img.control = ext;
1439
- }
1440
-
1441
- this.totalPixels += img.width * img.height;
1442
-
1443
- this.images.push(img);
1444
-
1445
- if (this.totalPixels >= this.pixelLimit) {
1446
- break;
1447
- }
1448
- } else if (desc === 0x21) {
1449
- // Extensions:
1450
- // http://www.w3.org/Graphics/GIF/spec-gif89a.txt
1451
- ext = {};
1452
- label = buf.readUInt8(p);
1453
- p += 1;
1454
- ext.label = label;
1455
- if (label === 0xf9) {
1456
- size = buf.readUInt8(p);
1457
- assert.equal(size, 0x04);
1458
- p += 1;
1459
- ext.fields = buf.readUInt8(p);
1460
- ext.disposeMethod = (ext.fields >> 2) & 0x07;
1461
- ext.useTransparent = !!(ext.fields & 0x01);
1462
- p += 1;
1463
- ext.delay = buf.readUInt16LE(p);
1464
- p += 2;
1465
- ext.transparentColor = buf.readUInt8(p);
1466
- p += 1;
1467
- while (buf[p] !== 0x00) {
1468
- size = buf.readUInt8(p);
1469
- p += 1;
1470
- p += size;
1471
- }
1472
- assert.equal(buf.readUInt8(p), 0x00);
1473
- p += 1;
1474
- this.delay = ext.delay;
1475
- this.transparentColor = ext.transparentColor;
1476
- this.disposeMethod = ext.disposeMethod;
1477
- this.useTransparent = ext.useTransparent;
1478
- } else if (label === 0xff) {
1479
- // https://wiki.whatwg.org/wiki/GIF#Specifications
1480
- size = buf.readUInt8(p);
1481
- p += 1;
1482
- ext.id = buf.slice(p, p + 8).toString('ascii');
1483
- p += 8;
1484
- ext.auth = buf.slice(p, p + 3).toString('ascii');
1485
- p += 3;
1486
- ext.data = [];
1487
- while (buf[p] !== 0x00) {
1488
- size = buf.readUInt8(p);
1489
- p += 1;
1490
- ext.data.push(buf.slice(p, p + size));
1491
- p += size;
1492
- }
1493
- ext.data = new Buffer(ext.data.reduce(function(out, data) {
1494
- return out.concat(Array.prototype.slice.call(data));
1495
- }, []));
1496
- // AnimExts looping extension (identical to netscape)
1497
- if (ext.id === 'ANIMEXTS' && ext.auth === '1.0') {
1498
- ext.id = 'NETSCAPE';
1499
- ext.auth = '2.0';
1500
- ext.animexts = true;
1501
- }
1502
- // Netscape extensions
1503
- if (ext.id === 'NETSCAPE' && ext.auth === '2.0') {
1504
- if (ext.data.readUInt8(0) === 0x01) {
1505
- // Netscape looping extension
1506
- // http://graphcomp.com/info/specs/ani_gif.html
1507
- ext.numPlays = ext.data.readUInt16LE(1);
1508
- this.numPlays = ext.numPlays;
1509
- } else if (ext.data.readUInt8(0) === 0x02) {
1510
- // Netscape buffering extension
1511
- this.minBuffer = ext.data;
1512
- }
1513
- }
1514
- // Adobe XMP extension
1515
- if (ext.id === 'XMP Data' && ext.auth === 'XMP') {
1516
- ext.xmp = ext.data.toString('utf8');
1517
- this.xmp = ext.xmp;
1518
- }
1519
- // ICC extension
1520
- if (ext.id === 'ICCRGBG1' && ext.auth === '012') {
1521
- // NOTE: Says size is 4 bytes, not 1? Maybe just buffer size?
1522
- this.icc = ext.data;
1523
- }
1524
- // fractint extension
1525
- if (ext.id === 'fractint' && /^00[1-7]$/.test(ext.auth)) {
1526
- // NOTE: Says size is 4 bytes, not 1? Maybe just buffer size?
1527
- // Size: '!\377\013' == [0x00, 0x15, 0xff, 0x0b]
1528
- this.fractint = ext.data;
1529
- }
1530
- assert.equal(buf.readUInt8(p), 0x00);
1531
- p += 1;
1532
- } else {
1533
- ext.data = [];
1534
- while (buf[p] !== 0x00) {
1535
- size = buf.readUInt8(p);
1536
- p += 1;
1537
- ext.data.push(buf.slice(p, p + size));
1538
- p += size;
1539
- }
1540
- assert.equal(buf.readUInt8(p), 0x00);
1541
- p += 1;
1542
- }
1543
- this.extensions.push(ext);
1544
- } else if (desc === 0x3b) {
1545
- break;
1546
- } else if (p === buf.length - 1) {
1547
- // } else if (desc === 0x00 && p === buf.length - 1) {
1548
- break;
1549
- } else {
1550
- throw new Error('unknown block');
1551
- }
1552
- }
1553
- } catch (e) {
1554
- if (options.debug) {
1555
- throw e;
1556
- }
1557
- }
1558
-
1559
- this.images = this.images.map(function(img, imageIndex) {
1560
- var control = img.control || this;
1561
-
1562
- img.lzw = new Buffer(img.lzw.reduce(function(out, data) {
1563
- return out.concat(Array.prototype.slice.call(data));
1564
- }, []));
1565
-
1566
- try {
1567
- img.data = this.decompress(img.lzw, img.codeSize);
1568
- } catch (e) {
1569
- if (options.debug) throw e;
1570
- return;
1571
- }
1572
-
1573
- var interlacing = [
1574
- [ 0, 8 ],
1575
- [ 4, 8 ],
1576
- [ 2, 4 ],
1577
- [ 1, 2 ],
1578
- [ 0, 0 ]
1579
- ];
1580
-
1581
- var table = img.lcolors || this.colors
1582
- , row = 0
1583
- , col = 0
1584
- , ilp = 0
1585
- , p = 0
1586
- , b
1587
- , idx
1588
- , i
1589
- , y
1590
- , x
1591
- , line
1592
- , pixel;
1593
-
1594
- img.samples = [];
1595
- // Rewritten version of:
1596
- // https://github.com/lbv/ka-cs-programs/blob/master/lib/gif-reader.js
1597
- for (;;) {
1598
- b = img.data[p++];
1599
- if (b == null) break;
1600
- idx = (row * img.width + col) * 4;
1601
- if (!table[b]) {
1602
- if (options.debug) throw new Error('bad samples');
1603
- table[b] = [0, 0, 0, 0];
1604
- }
1605
- img.samples[idx] = table[b][0];
1606
- img.samples[idx + 1] = table[b][1];
1607
- img.samples[idx + 2] = table[b][2];
1608
- img.samples[idx + 3] = table[b][3];
1609
- if (control.useTransparent && b === control.transparentColor) {
1610
- img.samples[idx + 3] = 0;
1611
- }
1612
- if (++col >= img.width) {
1613
- col = 0;
1614
- if (img.ilace) {
1615
- row += interlacing[ilp][1];
1616
- if (row >= img.height) {
1617
- row = interlacing[++ilp][0];
1618
- }
1619
- } else {
1620
- row++;
1621
- }
1622
- }
1623
- }
1624
-
1625
- img.pixels = [];
1626
- for (i = 0; i < img.samples.length; i += 4) {
1627
- img.pixels.push(img.samples.slice(i, i + 4));
1628
- }
1629
-
1630
- img.bmp = [];
1631
- for (y = 0, p = 0; y < img.height; y++) {
1632
- line = [];
1633
- for (x = 0; x < img.width; x++) {
1634
- pixel = img.pixels[p++];
1635
- if (!pixel) {
1636
- if (options.debug) throw new Error('no pixel');
1637
- line.push({ r: 0, g: 0, b: 0, a: 0 });
1638
- continue;
1639
- }
1640
- line.push({ r: pixel[0], g: pixel[1], b: pixel[2], a: pixel[3] });
1641
- }
1642
- img.bmp.push(line);
1643
- }
1644
-
1645
- return img;
1646
- }, this).filter(Boolean);
1647
-
1648
- if (!this.images.length) {
1649
- throw new Error('no image data or bad decompress');
1650
- }
1651
- }
1652
-
1653
- // Rewritten version of:
1654
- // https://github.com/lbv/ka-cs-programs/blob/master/lib/gif-reader.js
1655
- GIF.prototype.decompress = function(input, codeSize) {
1656
- var bitDepth = codeSize + 1
1657
- , CC = 1 << codeSize
1658
- , EOI = CC + 1
1659
- , stack = []
1660
- , table = []
1661
- , ntable = 0
1662
- , oldCode = null
1663
- , buffer = 0
1664
- , nbuffer = 0
1665
- , p = 0
1666
- , buf = []
1667
- , bits
1668
- , read
1669
- , ans
1670
- , n
1671
- , code
1672
- , i
1673
- , K
1674
- , b
1675
- , maxElem;
1676
-
1677
- for (;;) {
1678
- if (stack.length === 0) {
1679
- bits = bitDepth;
1680
- read = 0;
1681
- ans = 0;
1682
- while (read < bits) {
1683
- if (nbuffer === 0) {
1684
- if (p >= input.length) return buf;
1685
- buffer = input[p++];
1686
- nbuffer = 8;
1687
- }
1688
- n = Math.min(bits - read, nbuffer);
1689
- ans |= (buffer & ((1 << n) - 1)) << read;
1690
- read += n;
1691
- nbuffer -= n;
1692
- buffer >>= n;
1693
- }
1694
- code = ans;
1695
-
1696
- if (code === EOI) {
1697
- break;
1698
- }
1699
-
1700
- if (code === CC) {
1701
- table = [];
1702
- for (i = 0; i < CC; ++i) {
1703
- table[i] = [i, -1, i];
1704
- }
1705
- bitDepth = codeSize + 1;
1706
- maxElem = 1 << bitDepth;
1707
- ntable = CC + 2;
1708
- oldCode = null;
1709
- continue;
1710
- }
1711
-
1712
- if (oldCode === null) {
1713
- oldCode = code;
1714
- buf.push(table[code][0]);
1715
- continue;
1716
- }
1717
-
1718
- if (code < ntable) {
1719
- for (i = code; i >= 0; i = table[i][1]) {
1720
- stack.push(table[i][0]);
1721
- }
1722
- table[ntable++] = [
1723
- table[code][2],
1724
- oldCode,
1725
- table[oldCode][2]
1726
- ];
1727
- } else {
1728
- K = table[oldCode][2];
1729
- table[ntable++] = [K, oldCode, K];
1730
- for (i = code; i >= 0; i = table[i][1]) {
1731
- stack.push(table[i][0]);
1732
- }
1733
- }
1734
-
1735
- oldCode = code;
1736
- if (ntable === maxElem) {
1737
- maxElem = 1 << (++bitDepth);
1738
- if (bitDepth > 12) bitDepth = 12;
1739
- }
1740
- }
1741
- b = stack.pop();
1742
- if (b == null) break;
1743
- buf.push(b);
1744
- }
1745
-
1746
- return buf;
1747
- };
1748
-
1749
- /**
1750
- * Expose
1751
- */
1752
-
1753
- exports = PNG;
1754
- exports.png = PNG;
1755
- exports.gif = GIF;
1756
-
1757
- module.exports = exports;