@emulsify/cli 2.0.0 → 2.1.1

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 (303) hide show
  1. package/README.md +131 -12
  2. package/dist/handlers/componentInstall.js +65 -4
  3. package/dist/index.js +2 -0
  4. package/dist/node_modules/.package-lock.json +6 -216
  5. package/dist/node_modules/@types/node/README.md +1 -1
  6. package/dist/node_modules/@types/node/http2.d.ts +1 -0
  7. package/dist/node_modules/@types/node/package.json +2 -2
  8. package/dist/package-lock.json +61 -42
  9. package/dist/package.json +5 -6
  10. package/dist/schemas/emulsifyProjectConfig.json +80 -0
  11. package/dist/util/fs/executeScript.js +10 -4
  12. package/dist/util/fs/loadJsonFile.js +14 -4
  13. package/dist/util/fs/safeResolveWithin.js +22 -0
  14. package/dist/util/getRepositoryLatestTag.js +96 -13
  15. package/dist/util/project/buildComponentDependencyList.js +35 -10
  16. package/dist/util/project/generateComponent.js +52 -23
  17. package/dist/util/project/getEmulsifyConfig.js +35 -1
  18. package/dist/util/project/installComponentFromCache.js +3 -2
  19. package/dist/util/project/installGeneralAssetsFromCache.js +4 -2
  20. package/dist/util/system/getAvailableSystems.js +0 -5
  21. package/package.json +5 -6
  22. package/dist/node_modules/@babel/code-frame/LICENSE +0 -22
  23. package/dist/node_modules/@babel/code-frame/README.md +0 -19
  24. package/dist/node_modules/@babel/code-frame/lib/index.js +0 -217
  25. package/dist/node_modules/@babel/code-frame/lib/index.js.map +0 -1
  26. package/dist/node_modules/@babel/code-frame/package.json +0 -32
  27. package/dist/node_modules/@babel/helper-validator-identifier/LICENSE +0 -22
  28. package/dist/node_modules/@babel/helper-validator-identifier/README.md +0 -19
  29. package/dist/node_modules/@babel/helper-validator-identifier/lib/identifier.js +0 -70
  30. package/dist/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +0 -1
  31. package/dist/node_modules/@babel/helper-validator-identifier/lib/index.js +0 -57
  32. package/dist/node_modules/@babel/helper-validator-identifier/lib/index.js.map +0 -1
  33. package/dist/node_modules/@babel/helper-validator-identifier/lib/keyword.js +0 -35
  34. package/dist/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +0 -1
  35. package/dist/node_modules/@babel/helper-validator-identifier/package.json +0 -31
  36. package/dist/node_modules/@types/progress/LICENSE +0 -21
  37. package/dist/node_modules/@types/progress/README.md +0 -15
  38. package/dist/node_modules/@types/progress/index.d.ts +0 -143
  39. package/dist/node_modules/@types/progress/package.json +0 -27
  40. package/dist/node_modules/argparse/CHANGELOG.md +0 -216
  41. package/dist/node_modules/argparse/LICENSE +0 -254
  42. package/dist/node_modules/argparse/README.md +0 -84
  43. package/dist/node_modules/argparse/argparse.js +0 -3707
  44. package/dist/node_modules/argparse/lib/sub.js +0 -67
  45. package/dist/node_modules/argparse/lib/textwrap.js +0 -440
  46. package/dist/node_modules/argparse/package.json +0 -31
  47. package/dist/node_modules/callsites/index.d.ts +0 -96
  48. package/dist/node_modules/callsites/index.js +0 -13
  49. package/dist/node_modules/callsites/license +0 -9
  50. package/dist/node_modules/callsites/package.json +0 -39
  51. package/dist/node_modules/callsites/readme.md +0 -48
  52. package/dist/node_modules/cosmiconfig/LICENSE +0 -22
  53. package/dist/node_modules/cosmiconfig/README.md +0 -782
  54. package/dist/node_modules/cosmiconfig/dist/Explorer.d.ts +0 -2
  55. package/dist/node_modules/cosmiconfig/dist/Explorer.js +0 -174
  56. package/dist/node_modules/cosmiconfig/dist/ExplorerBase.d.ts +0 -2
  57. package/dist/node_modules/cosmiconfig/dist/ExplorerBase.js +0 -126
  58. package/dist/node_modules/cosmiconfig/dist/ExplorerSync.d.ts +0 -2
  59. package/dist/node_modules/cosmiconfig/dist/ExplorerSync.js +0 -188
  60. package/dist/node_modules/cosmiconfig/dist/defaults.d.ts +0 -25
  61. package/dist/node_modules/cosmiconfig/dist/defaults.js +0 -105
  62. package/dist/node_modules/cosmiconfig/dist/index.d.ts +0 -6
  63. package/dist/node_modules/cosmiconfig/dist/index.js +0 -148
  64. package/dist/node_modules/cosmiconfig/dist/loaders.d.ts +0 -8
  65. package/dist/node_modules/cosmiconfig/dist/loaders.js +0 -150
  66. package/dist/node_modules/cosmiconfig/dist/merge.d.ts +0 -9
  67. package/dist/node_modules/cosmiconfig/dist/merge.js +0 -44
  68. package/dist/node_modules/cosmiconfig/dist/types.d.ts +0 -98
  69. package/dist/node_modules/cosmiconfig/dist/types.js +0 -3
  70. package/dist/node_modules/cosmiconfig/dist/util.d.ts +0 -2
  71. package/dist/node_modules/cosmiconfig/dist/util.js +0 -108
  72. package/dist/node_modules/cosmiconfig/package.json +0 -103
  73. package/dist/node_modules/env-paths/index.d.ts +0 -101
  74. package/dist/node_modules/env-paths/index.js +0 -74
  75. package/dist/node_modules/env-paths/license +0 -9
  76. package/dist/node_modules/env-paths/package.json +0 -45
  77. package/dist/node_modules/env-paths/readme.md +0 -115
  78. package/dist/node_modules/error-ex/LICENSE +0 -21
  79. package/dist/node_modules/error-ex/README.md +0 -144
  80. package/dist/node_modules/error-ex/index.js +0 -141
  81. package/dist/node_modules/error-ex/package.json +0 -46
  82. package/dist/node_modules/import-fresh/index.d.ts +0 -30
  83. package/dist/node_modules/import-fresh/index.js +0 -34
  84. package/dist/node_modules/import-fresh/license +0 -9
  85. package/dist/node_modules/import-fresh/node_modules/resolve-from/index.js +0 -47
  86. package/dist/node_modules/import-fresh/node_modules/resolve-from/license +0 -9
  87. package/dist/node_modules/import-fresh/node_modules/resolve-from/package.json +0 -34
  88. package/dist/node_modules/import-fresh/node_modules/resolve-from/readme.md +0 -72
  89. package/dist/node_modules/import-fresh/package.json +0 -48
  90. package/dist/node_modules/import-fresh/readme.md +0 -54
  91. package/dist/node_modules/is-arrayish/.editorconfig +0 -18
  92. package/dist/node_modules/is-arrayish/.istanbul.yml +0 -4
  93. package/dist/node_modules/is-arrayish/.travis.yml +0 -17
  94. package/dist/node_modules/is-arrayish/LICENSE +0 -21
  95. package/dist/node_modules/is-arrayish/README.md +0 -16
  96. package/dist/node_modules/is-arrayish/index.js +0 -10
  97. package/dist/node_modules/is-arrayish/package.json +0 -34
  98. package/dist/node_modules/js-tokens/CHANGELOG.md +0 -151
  99. package/dist/node_modules/js-tokens/LICENSE +0 -21
  100. package/dist/node_modules/js-tokens/README.md +0 -240
  101. package/dist/node_modules/js-tokens/index.js +0 -23
  102. package/dist/node_modules/js-tokens/package.json +0 -30
  103. package/dist/node_modules/js-yaml/LICENSE +0 -21
  104. package/dist/node_modules/js-yaml/README.md +0 -231
  105. package/dist/node_modules/js-yaml/bin/js-yaml.js +0 -117
  106. package/dist/node_modules/js-yaml/dist/js-yaml.js +0 -2404
  107. package/dist/node_modules/js-yaml/dist/js-yaml.js.map +0 -1
  108. package/dist/node_modules/js-yaml/dist/js-yaml.min.js +0 -33
  109. package/dist/node_modules/js-yaml/dist/js-yaml.min.js.map +0 -1
  110. package/dist/node_modules/js-yaml/dist/js-yaml.mjs +0 -2382
  111. package/dist/node_modules/js-yaml/dist/js-yaml.mjs.map +0 -1
  112. package/dist/node_modules/js-yaml/index.js +0 -44
  113. package/dist/node_modules/js-yaml/lib/common.js +0 -50
  114. package/dist/node_modules/js-yaml/lib/dumper.js +0 -937
  115. package/dist/node_modules/js-yaml/lib/exception.js +0 -51
  116. package/dist/node_modules/js-yaml/lib/index_vite_proxy.tmp.mjs +0 -37
  117. package/dist/node_modules/js-yaml/lib/loader.js +0 -1794
  118. package/dist/node_modules/js-yaml/lib/schema/core.js +0 -9
  119. package/dist/node_modules/js-yaml/lib/schema/default.js +0 -20
  120. package/dist/node_modules/js-yaml/lib/schema/failsafe.js +0 -14
  121. package/dist/node_modules/js-yaml/lib/schema/json.js +0 -17
  122. package/dist/node_modules/js-yaml/lib/schema.js +0 -109
  123. package/dist/node_modules/js-yaml/lib/snippet.js +0 -96
  124. package/dist/node_modules/js-yaml/lib/type/binary.js +0 -122
  125. package/dist/node_modules/js-yaml/lib/type/bool.js +0 -35
  126. package/dist/node_modules/js-yaml/lib/type/float.js +0 -99
  127. package/dist/node_modules/js-yaml/lib/type/int.js +0 -142
  128. package/dist/node_modules/js-yaml/lib/type/map.js +0 -8
  129. package/dist/node_modules/js-yaml/lib/type/merge.js +0 -12
  130. package/dist/node_modules/js-yaml/lib/type/null.js +0 -35
  131. package/dist/node_modules/js-yaml/lib/type/omap.js +0 -45
  132. package/dist/node_modules/js-yaml/lib/type/pairs.js +0 -50
  133. package/dist/node_modules/js-yaml/lib/type/seq.js +0 -8
  134. package/dist/node_modules/js-yaml/lib/type/set.js +0 -29
  135. package/dist/node_modules/js-yaml/lib/type/str.js +0 -8
  136. package/dist/node_modules/js-yaml/lib/type/timestamp.js +0 -88
  137. package/dist/node_modules/js-yaml/lib/type.js +0 -66
  138. package/dist/node_modules/js-yaml/package.json +0 -77
  139. package/dist/node_modules/json-parse-even-better-errors/CHANGELOG.md +0 -50
  140. package/dist/node_modules/json-parse-even-better-errors/LICENSE.md +0 -25
  141. package/dist/node_modules/json-parse-even-better-errors/README.md +0 -96
  142. package/dist/node_modules/json-parse-even-better-errors/index.js +0 -121
  143. package/dist/node_modules/json-parse-even-better-errors/package.json +0 -33
  144. package/dist/node_modules/lines-and-columns/LICENSE +0 -21
  145. package/dist/node_modules/lines-and-columns/README.md +0 -33
  146. package/dist/node_modules/lines-and-columns/build/index.d.ts +0 -13
  147. package/dist/node_modules/lines-and-columns/build/index.js +0 -62
  148. package/dist/node_modules/lines-and-columns/package.json +0 -49
  149. package/dist/node_modules/parent-module/index.js +0 -37
  150. package/dist/node_modules/parent-module/license +0 -9
  151. package/dist/node_modules/parent-module/package.json +0 -46
  152. package/dist/node_modules/parent-module/readme.md +0 -67
  153. package/dist/node_modules/parse-json/index.js +0 -54
  154. package/dist/node_modules/parse-json/license +0 -9
  155. package/dist/node_modules/parse-json/package.json +0 -45
  156. package/dist/node_modules/parse-json/readme.md +0 -119
  157. package/dist/node_modules/picocolors/LICENSE +0 -15
  158. package/dist/node_modules/picocolors/README.md +0 -21
  159. package/dist/node_modules/picocolors/package.json +0 -25
  160. package/dist/node_modules/picocolors/picocolors.browser.js +0 -4
  161. package/dist/node_modules/picocolors/picocolors.d.ts +0 -5
  162. package/dist/node_modules/picocolors/picocolors.js +0 -75
  163. package/dist/node_modules/picocolors/types.d.ts +0 -51
  164. package/dist/node_modules/typescript/LICENSE.txt +0 -55
  165. package/dist/node_modules/typescript/README.md +0 -50
  166. package/dist/node_modules/typescript/SECURITY.md +0 -39
  167. package/dist/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
  168. package/dist/node_modules/typescript/bin/tsc +0 -2
  169. package/dist/node_modules/typescript/bin/tsserver +0 -2
  170. package/dist/node_modules/typescript/lib/_tsc.js +0 -134465
  171. package/dist/node_modules/typescript/lib/_tsserver.js +0 -659
  172. package/dist/node_modules/typescript/lib/_typingsInstaller.js +0 -222
  173. package/dist/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -2129
  174. package/dist/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -2125
  175. package/dist/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -2129
  176. package/dist/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -2129
  177. package/dist/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -2125
  178. package/dist/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -2129
  179. package/dist/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -2129
  180. package/dist/node_modules/typescript/lib/lib.d.ts +0 -20
  181. package/dist/node_modules/typescript/lib/lib.decorators.d.ts +0 -382
  182. package/dist/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -20
  183. package/dist/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -18
  184. package/dist/node_modules/typescript/lib/lib.dom.d.ts +0 -45125
  185. package/dist/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -18
  186. package/dist/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -150
  187. package/dist/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -595
  188. package/dist/node_modules/typescript/lib/lib.es2015.d.ts +0 -26
  189. package/dist/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -75
  190. package/dist/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -603
  191. package/dist/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -79
  192. package/dist/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -126
  193. package/dist/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -142
  194. package/dist/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -44
  195. package/dist/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -324
  196. package/dist/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -114
  197. package/dist/node_modules/typescript/lib/lib.es2016.d.ts +0 -19
  198. package/dist/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -21
  199. package/dist/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -29
  200. package/dist/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -19
  201. package/dist/node_modules/typescript/lib/lib.es2017.d.ts +0 -24
  202. package/dist/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -29
  203. package/dist/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -21
  204. package/dist/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -42
  205. package/dist/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -47
  206. package/dist/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -133
  207. package/dist/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -43
  208. package/dist/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -51
  209. package/dist/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -75
  210. package/dist/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -51
  211. package/dist/node_modules/typescript/lib/lib.es2018.d.ts +0 -22
  212. package/dist/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -22
  213. package/dist/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -81
  214. package/dist/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -28
  215. package/dist/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -35
  216. package/dist/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -77
  217. package/dist/node_modules/typescript/lib/lib.es2019.d.ts +0 -22
  218. package/dist/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -22
  219. package/dist/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -21
  220. package/dist/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -31
  221. package/dist/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -35
  222. package/dist/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -22
  223. package/dist/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -763
  224. package/dist/node_modules/typescript/lib/lib.es2020.d.ts +0 -25
  225. package/dist/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -40
  226. package/dist/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -22
  227. package/dist/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -472
  228. package/dist/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -26
  229. package/dist/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -45
  230. package/dist/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -97
  231. package/dist/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -42
  232. package/dist/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -39
  233. package/dist/node_modules/typescript/lib/lib.es2021.d.ts +0 -21
  234. package/dist/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -22
  235. package/dist/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -164
  236. package/dist/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -46
  237. package/dist/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -31
  238. package/dist/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -76
  239. package/dist/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -119
  240. package/dist/node_modules/typescript/lib/lib.es2022.d.ts +0 -23
  241. package/dist/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -73
  242. package/dist/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -22
  243. package/dist/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -143
  244. package/dist/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -24
  245. package/dist/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -37
  246. package/dist/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -23
  247. package/dist/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -922
  248. package/dist/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -19
  249. package/dist/node_modules/typescript/lib/lib.es2023.d.ts +0 -20
  250. package/dist/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -22
  251. package/dist/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -62
  252. package/dist/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -63
  253. package/dist/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -27
  254. package/dist/node_modules/typescript/lib/lib.es2024.d.ts +0 -24
  255. package/dist/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -22
  256. package/dist/node_modules/typescript/lib/lib.es2024.object.d.ts +0 -27
  257. package/dist/node_modules/typescript/lib/lib.es2024.promise.d.ts +0 -33
  258. package/dist/node_modules/typescript/lib/lib.es2024.regexp.d.ts +0 -23
  259. package/dist/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +0 -66
  260. package/dist/node_modules/typescript/lib/lib.es2024.string.d.ts +0 -27
  261. package/dist/node_modules/typescript/lib/lib.es2025.collection.d.ts +0 -94
  262. package/dist/node_modules/typescript/lib/lib.es2025.d.ts +0 -23
  263. package/dist/node_modules/typescript/lib/lib.es2025.float16.d.ts +0 -443
  264. package/dist/node_modules/typescript/lib/lib.es2025.full.d.ts +0 -22
  265. package/dist/node_modules/typescript/lib/lib.es2025.intl.d.ts +0 -200
  266. package/dist/node_modules/typescript/lib/lib.es2025.iterator.d.ts +0 -146
  267. package/dist/node_modules/typescript/lib/lib.es2025.promise.d.ts +0 -32
  268. package/dist/node_modules/typescript/lib/lib.es2025.regexp.d.ts +0 -30
  269. package/dist/node_modules/typescript/lib/lib.es5.d.ts +0 -4599
  270. package/dist/node_modules/typescript/lib/lib.es6.d.ts +0 -21
  271. package/dist/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -33
  272. package/dist/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -47
  273. package/dist/node_modules/typescript/lib/lib.esnext.d.ts +0 -27
  274. package/dist/node_modules/typescript/lib/lib.esnext.date.d.ts +0 -21
  275. package/dist/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -26
  276. package/dist/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -191
  277. package/dist/node_modules/typescript/lib/lib.esnext.error.d.ts +0 -22
  278. package/dist/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -22
  279. package/dist/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -107
  280. package/dist/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +0 -23
  281. package/dist/node_modules/typescript/lib/lib.esnext.temporal.d.ts +0 -485
  282. package/dist/node_modules/typescript/lib/lib.esnext.typedarrays.d.ts +0 -90
  283. package/dist/node_modules/typescript/lib/lib.scripthost.d.ts +0 -320
  284. package/dist/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -18
  285. package/dist/node_modules/typescript/lib/lib.webworker.d.ts +0 -15606
  286. package/dist/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -21
  287. package/dist/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -18
  288. package/dist/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -2129
  289. package/dist/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -2129
  290. package/dist/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -2125
  291. package/dist/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -2129
  292. package/dist/node_modules/typescript/lib/tsc.js +0 -8
  293. package/dist/node_modules/typescript/lib/tsserver.js +0 -8
  294. package/dist/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
  295. package/dist/node_modules/typescript/lib/tsserverlibrary.js +0 -21
  296. package/dist/node_modules/typescript/lib/typesMap.json +0 -497
  297. package/dist/node_modules/typescript/lib/typescript.d.ts +0 -11448
  298. package/dist/node_modules/typescript/lib/typescript.js +0 -201039
  299. package/dist/node_modules/typescript/lib/typingsInstaller.js +0 -8
  300. package/dist/node_modules/typescript/lib/watchGuard.js +0 -53
  301. package/dist/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -2129
  302. package/dist/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -2125
  303. package/dist/node_modules/typescript/package.json +0 -118
@@ -1,240 +0,0 @@
1
- Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens)
2
- ========
3
-
4
- A regex that tokenizes JavaScript.
5
-
6
- ```js
7
- var jsTokens = require("js-tokens").default
8
-
9
- var jsString = "var foo=opts.foo;\n..."
10
-
11
- jsString.match(jsTokens)
12
- // ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...]
13
- ```
14
-
15
-
16
- Installation
17
- ============
18
-
19
- `npm install js-tokens`
20
-
21
- ```js
22
- import jsTokens from "js-tokens"
23
- // or:
24
- var jsTokens = require("js-tokens").default
25
- ```
26
-
27
-
28
- Usage
29
- =====
30
-
31
- ### `jsTokens` ###
32
-
33
- A regex with the `g` flag that matches JavaScript tokens.
34
-
35
- The regex _always_ matches, even invalid JavaScript and the empty string.
36
-
37
- The next match is always directly after the previous.
38
-
39
- ### `var token = matchToToken(match)` ###
40
-
41
- ```js
42
- import {matchToToken} from "js-tokens"
43
- // or:
44
- var matchToToken = require("js-tokens").matchToToken
45
- ```
46
-
47
- Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type:
48
- String, value: String}` object. The following types are available:
49
-
50
- - string
51
- - comment
52
- - regex
53
- - number
54
- - name
55
- - punctuator
56
- - whitespace
57
- - invalid
58
-
59
- Multi-line comments and strings also have a `closed` property indicating if the
60
- token was closed or not (see below).
61
-
62
- Comments and strings both come in several flavors. To distinguish them, check if
63
- the token starts with `//`, `/*`, `'`, `"` or `` ` ``.
64
-
65
- Names are ECMAScript IdentifierNames, that is, including both identifiers and
66
- keywords. You may use [is-keyword-js] to tell them apart.
67
-
68
- Whitespace includes both line terminators and other whitespace.
69
-
70
- [is-keyword-js]: https://github.com/crissdev/is-keyword-js
71
-
72
-
73
- ECMAScript support
74
- ==================
75
-
76
- The intention is to always support the latest ECMAScript version whose feature
77
- set has been finalized.
78
-
79
- If adding support for a newer version requires changes, a new version with a
80
- major verion bump will be released.
81
-
82
- Currently, ECMAScript 2018 is supported.
83
-
84
-
85
- Invalid code handling
86
- =====================
87
-
88
- Unterminated strings are still matched as strings. JavaScript strings cannot
89
- contain (unescaped) newlines, so unterminated strings simply end at the end of
90
- the line. Unterminated template strings can contain unescaped newlines, though,
91
- so they go on to the end of input.
92
-
93
- Unterminated multi-line comments are also still matched as comments. They
94
- simply go on to the end of the input.
95
-
96
- Unterminated regex literals are likely matched as division and whatever is
97
- inside the regex.
98
-
99
- Invalid ASCII characters have their own capturing group.
100
-
101
- Invalid non-ASCII characters are treated as names, to simplify the matching of
102
- names (except unicode spaces which are treated as whitespace). Note: See also
103
- the [ES2018](#es2018) section.
104
-
105
- Regex literals may contain invalid regex syntax. They are still matched as
106
- regex literals. They may also contain repeated regex flags, to keep the regex
107
- simple.
108
-
109
- Strings may contain invalid escape sequences.
110
-
111
-
112
- Limitations
113
- ===========
114
-
115
- Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be
116
- perfect. But that’s not the point either.
117
-
118
- You may compare jsTokens with [esprima] by using `esprima-compare.js`.
119
- See `npm run esprima-compare`!
120
-
121
- [esprima]: http://esprima.org/
122
-
123
- ### Template string interpolation ###
124
-
125
- Template strings are matched as single tokens, from the starting `` ` `` to the
126
- ending `` ` ``, including interpolations (whose tokens are not matched
127
- individually).
128
-
129
- Matching template string interpolations requires recursive balancing of `{` and
130
- `}`—something that JavaScript regexes cannot do. Only one level of nesting is
131
- supported.
132
-
133
- ### Division and regex literals collision ###
134
-
135
- Consider this example:
136
-
137
- ```js
138
- var g = 9.82
139
- var number = bar / 2/g
140
-
141
- var regex = / 2/g
142
- ```
143
-
144
- A human can easily understand that in the `number` line we’re dealing with
145
- division, and in the `regex` line we’re dealing with a regex literal. How come?
146
- Because humans can look at the whole code to put the `/` characters in context.
147
- A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also
148
- look backwards. See the [ES2018](#es2018) section).
149
-
150
- When the `jsTokens` regex scans throught the above, it will see the following
151
- at the end of both the `number` and `regex` rows:
152
-
153
- ```js
154
- / 2/g
155
- ```
156
-
157
- It is then impossible to know if that is a regex literal, or part of an
158
- expression dealing with division.
159
-
160
- Here is a similar case:
161
-
162
- ```js
163
- foo /= 2/g
164
- foo(/= 2/g)
165
- ```
166
-
167
- The first line divides the `foo` variable with `2/g`. The second line calls the
168
- `foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only
169
- sees forwards, it cannot tell the two cases apart.
170
-
171
- There are some cases where we _can_ tell division and regex literals apart,
172
- though.
173
-
174
- First off, we have the simple cases where there’s only one slash in the line:
175
-
176
- ```js
177
- var foo = 2/g
178
- foo /= 2
179
- ```
180
-
181
- Regex literals cannot contain newlines, so the above cases are correctly
182
- identified as division. Things are only problematic when there are more than
183
- one non-comment slash in a single line.
184
-
185
- Secondly, not every character is a valid regex flag.
186
-
187
- ```js
188
- var number = bar / 2/e
189
- ```
190
-
191
- The above example is also correctly identified as division, because `e` is not a
192
- valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*`
193
- (any letter) as flags, but it is not worth it since it increases the amount of
194
- ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are
195
- allowed. This means that the above example will be identified as division as
196
- long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6
197
- characters long.
198
-
199
- Lastly, we can look _forward_ for information.
200
-
201
- - If the token following what looks like a regex literal is not valid after a
202
- regex literal, but is valid in a division expression, then the regex literal
203
- is treated as division instead. For example, a flagless regex cannot be
204
- followed by a string, number or name, but all of those three can be the
205
- denominator of a division.
206
- - Generally, if what looks like a regex literal is followed by an operator, the
207
- regex literal is treated as division instead. This is because regexes are
208
- seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division
209
- could likely be part of such an expression.
210
-
211
- Please consult the regex source and the test cases for precise information on
212
- when regex or division is matched (should you need to know). In short, you
213
- could sum it up as:
214
-
215
- If the end of a statement looks like a regex literal (even if it isn’t), it
216
- will be treated as one. Otherwise it should work as expected (if you write sane
217
- code).
218
-
219
- ### ES2018 ###
220
-
221
- ES2018 added some nice regex improvements to the language.
222
-
223
- - [Unicode property escapes] should allow telling names and invalid non-ASCII
224
- characters apart without blowing up the regex size.
225
- - [Lookbehind assertions] should allow matching telling division and regex
226
- literals apart in more cases.
227
- - [Named capture groups] might simplify some things.
228
-
229
- These things would be nice to do, but are not critical. They probably have to
230
- wait until the oldest maintained Node.js LTS release supports those features.
231
-
232
- [Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html
233
- [Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html
234
- [Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html
235
-
236
-
237
- License
238
- =======
239
-
240
- [MIT](LICENSE).
@@ -1,23 +0,0 @@
1
- // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
2
- // License: MIT. (See LICENSE.)
3
-
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- })
7
-
8
- // This regex comes from regex.coffee, and is inserted here by generate-index.js
9
- // (run `npm run build`).
10
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g
11
-
12
- exports.matchToToken = function(match) {
13
- var token = {type: "invalid", value: match[0], closed: undefined}
14
- if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
15
- else if (match[ 5]) token.type = "comment"
16
- else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
17
- else if (match[ 8]) token.type = "regex"
18
- else if (match[ 9]) token.type = "number"
19
- else if (match[10]) token.type = "name"
20
- else if (match[11]) token.type = "punctuator"
21
- else if (match[12]) token.type = "whitespace"
22
- return token
23
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "js-tokens",
3
- "version": "4.0.0",
4
- "author": "Simon Lydell",
5
- "license": "MIT",
6
- "description": "A regex that tokenizes JavaScript.",
7
- "keywords": [
8
- "JavaScript",
9
- "js",
10
- "token",
11
- "tokenize",
12
- "regex"
13
- ],
14
- "files": [
15
- "index.js"
16
- ],
17
- "repository": "lydell/js-tokens",
18
- "scripts": {
19
- "test": "mocha --ui tdd",
20
- "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js",
21
- "build": "node generate-index.js",
22
- "dev": "npm run build && npm test"
23
- },
24
- "devDependencies": {
25
- "coffeescript": "2.1.1",
26
- "esprima": "4.0.0",
27
- "everything.js": "1.0.3",
28
- "mocha": "5.0.0"
29
- }
30
- }
@@ -1,21 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (C) 2011-2015 by Vitaly Puzrin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,231 +0,0 @@
1
- JS-YAML - YAML 1.2 parser / writer for JavaScript
2
- =================================================
3
-
4
- [![CI](https://github.com/nodeca/js-yaml/actions/workflows/ci.yml/badge.svg)](https://github.com/nodeca/js-yaml/actions/workflows/ci.yml)
5
- [![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml)
6
-
7
- __[Online Demo](https://nodeca.github.io/js-yaml/)__
8
-
9
-
10
- This is an implementation of [YAML](https://yaml.org/), a human-friendly data
11
- serialization language. Started as [PyYAML](https://pyyaml.org/) port, it was
12
- completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
13
-
14
-
15
- Installation
16
- ------------
17
-
18
- ### YAML module for node.js
19
-
20
- ```
21
- npm install js-yaml
22
- ```
23
-
24
-
25
- ### CLI executable
26
-
27
- If you want to inspect your YAML files from CLI, install js-yaml globally:
28
-
29
- ```
30
- npm install -g js-yaml
31
- ```
32
-
33
- #### Usage
34
-
35
- ```
36
- usage: js-yaml [-h] [-v] [-c] [-t] file
37
-
38
- Positional arguments:
39
- file File with YAML document(s)
40
-
41
- Optional arguments:
42
- -h, --help Show this help message and exit.
43
- -v, --version Show program's version number and exit.
44
- -c, --compact Display errors in compact mode
45
- -t, --trace Show stack trace on error
46
- ```
47
-
48
-
49
- API
50
- ---
51
-
52
- Here we cover the most 'useful' methods. If you need advanced details (creating
53
- your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples)
54
- for more info.
55
-
56
- ``` javascript
57
- const yaml = require('js-yaml');
58
- const fs = require('fs');
59
-
60
- // Get document, or throw exception on error
61
- try {
62
- const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
63
- console.log(doc);
64
- } catch (e) {
65
- console.log(e);
66
- }
67
- ```
68
-
69
-
70
- ### load (string [ , options ])
71
-
72
- Parses `string` as single YAML document. Returns either a
73
- plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does
74
- not support regexps, functions and undefined.
75
-
76
- options:
77
-
78
- - `filename` _(default: null)_ - string to be used as a file path in
79
- error/warning messages.
80
- - `onWarning` _(default: null)_ - function to call on warning messages.
81
- Loader will call this function with an instance of `YAMLException` for each warning.
82
- - `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use.
83
- - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
84
- https://www.yaml.org/spec/1.2/spec.html#id2802346
85
- - `JSON_SCHEMA` - all JSON-supported types:
86
- https://www.yaml.org/spec/1.2/spec.html#id2803231
87
- - `CORE_SCHEMA` - same as `JSON_SCHEMA`:
88
- https://www.yaml.org/spec/1.2/spec.html#id2804923
89
- - `DEFAULT_SCHEMA` - all supported YAML types.
90
- - `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
91
- - `maxDepth` _(default: 100)_ - limits nesting depth for collections.
92
- - `maxMergeSeqLength` _(default: 20)_ - limits the number of elements in merge
93
- (`<<`) sequences.
94
-
95
- NOTE: This function **does not** understand multi-document sources, it throws
96
- exception on those.
97
-
98
- NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
99
- So, the JSON schema is not as strictly defined in the YAML specification.
100
- It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
101
- The core schema also has no such restrictions. It allows binary notation for integers.
102
-
103
-
104
- ### loadAll (string [, iterator] [, options ])
105
-
106
- Same as `load()`, but understands multi-document sources. Applies
107
- `iterator` to each document if specified, or returns array of documents.
108
-
109
- ``` javascript
110
- const yaml = require('js-yaml');
111
-
112
- yaml.loadAll(data, function (doc) {
113
- console.log(doc);
114
- });
115
- ```
116
-
117
-
118
- ### dump (object [ , options ])
119
-
120
- Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will
121
- throw an exception if you try to dump regexps or functions. However, you can
122
- disable exceptions by setting the `skipInvalid` option to `true`.
123
-
124
- options:
125
-
126
- - `indent` _(default: 2)_ - indentation width to use (in spaces).
127
- - `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
128
- - `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
129
- in the safe schema) and skip pairs and single values with such types.
130
- - `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from
131
- block to flow style for collections. -1 means block style everwhere
132
- - `styles` - "tag" => "style" map. Each tag may have own set of styles.
133
- - `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use.
134
- - `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
135
- function, use the function to sort the keys.
136
- - `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width.
137
- - `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
138
- - `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
139
- yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
140
- - `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
141
- - `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.
142
- - `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to.
143
- - `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`).
144
-
145
- The following table show availlable styles (e.g. "canonical",
146
- "binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
147
- output is shown on the right side after `=>` (default setting) or `->`:
148
-
149
- ``` none
150
- !!null
151
- "canonical" -> "~"
152
- "lowercase" => "null"
153
- "uppercase" -> "NULL"
154
- "camelcase" -> "Null"
155
- "empty" -> ""
156
-
157
- !!int
158
- "binary" -> "0b1", "0b101010", "0b1110001111010"
159
- "octal" -> "0o1", "0o52", "0o16172"
160
- "decimal" => "1", "42", "7290"
161
- "hexadecimal" -> "0x1", "0x2A", "0x1C7A"
162
-
163
- !!bool
164
- "lowercase" => "true", "false"
165
- "uppercase" -> "TRUE", "FALSE"
166
- "camelcase" -> "True", "False"
167
-
168
- !!float
169
- "lowercase" => ".nan", '.inf'
170
- "uppercase" -> ".NAN", '.INF'
171
- "camelcase" -> ".NaN", '.Inf'
172
- ```
173
-
174
- Example:
175
-
176
- ``` javascript
177
- dump(object, {
178
- 'styles': {
179
- '!!null': 'canonical' // dump null as ~
180
- },
181
- 'sortKeys': true // sort object keys
182
- });
183
- ```
184
-
185
- Supported YAML types
186
- --------------------
187
-
188
- The list of standard YAML tags and corresponding JavaScript types. See also
189
- [YAML tag discussion](https://pyyaml.org/wiki/YAMLTagDiscussion) and
190
- [YAML types repository](https://yaml.org/type/).
191
-
192
- ```
193
- !!null '' # null
194
- !!bool 'yes' # bool
195
- !!int '3...' # number
196
- !!float '3.14...' # number
197
- !!binary '...base64...' # buffer
198
- !!timestamp 'YYYY-...' # date
199
- !!omap [ ... ] # array of key-value pairs
200
- !!pairs [ ... ] # array or array pairs
201
- !!set { ... } # array of objects with given keys and null values
202
- !!str '...' # string
203
- !!seq [ ... ] # array
204
- !!map { ... } # object
205
- ```
206
-
207
- **JavaScript-specific tags**
208
-
209
- See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for
210
- extra types.
211
-
212
-
213
- Caveats
214
- -------
215
-
216
- Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
217
- or arrays as keys, and stringifies (by calling `toString()` method) them at the
218
- moment of adding them.
219
-
220
- ``` yaml
221
- ---
222
- ? [ foo, bar ]
223
- : - baz
224
- ? { foo: bar }
225
- : - baz
226
- - baz
227
- ```
228
-
229
- ``` javascript
230
- { "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
231
- ```
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict'
4
-
5
- const fs = require('fs')
6
- const argparse = require('argparse')
7
- const yaml = require('..')
8
-
9
- /// /////////////////////////////////////////////////////////////////////////////
10
-
11
- const cli = new argparse.ArgumentParser({
12
- prog: 'js-yaml',
13
- add_help: true
14
- })
15
-
16
- cli.add_argument('-v', '--version', {
17
- action: 'version',
18
- version: require('../package.json').version
19
- })
20
-
21
- cli.add_argument('-c', '--compact', {
22
- help: 'Display errors in compact mode',
23
- action: 'store_true'
24
- })
25
-
26
- // deprecated (not needed after we removed output colors)
27
- // option suppressed, but not completely removed for compatibility
28
- cli.add_argument('-j', '--to-json', {
29
- help: argparse.SUPPRESS,
30
- dest: 'json',
31
- action: 'store_true'
32
- })
33
-
34
- cli.add_argument('-t', '--trace', {
35
- help: 'Show stack trace on error',
36
- action: 'store_true'
37
- })
38
-
39
- cli.add_argument('file', {
40
- help: 'File to read, utf-8 encoded without BOM',
41
- nargs: '?',
42
- default: '-'
43
- })
44
-
45
- /// /////////////////////////////////////////////////////////////////////////////
46
-
47
- const options = cli.parse_args()
48
-
49
- /// /////////////////////////////////////////////////////////////////////////////
50
-
51
- function readFile (filename, encoding, callback) {
52
- if (options.file === '-') {
53
- // read from stdin
54
-
55
- const chunks = []
56
-
57
- process.stdin.on('data', function (chunk) {
58
- chunks.push(chunk)
59
- })
60
-
61
- process.stdin.on('end', function () {
62
- return callback(null, Buffer.concat(chunks).toString(encoding))
63
- })
64
- } else {
65
- fs.readFile(filename, encoding, callback)
66
- }
67
- }
68
-
69
- readFile(options.file, 'utf8', function (error, input) {
70
- let output
71
- let isYaml
72
-
73
- if (error) {
74
- if (error.code === 'ENOENT') {
75
- console.error('File not found: ' + options.file)
76
- process.exit(2)
77
- }
78
-
79
- console.error(
80
- (options.trace && error.stack) ||
81
- error.message ||
82
- String(error))
83
-
84
- process.exit(1)
85
- }
86
-
87
- try {
88
- output = JSON.parse(input)
89
- isYaml = false
90
- } catch (err) {
91
- if (err instanceof SyntaxError) {
92
- try {
93
- output = []
94
- yaml.loadAll(input, function (doc) { output.push(doc) }, {})
95
- isYaml = true
96
-
97
- if (output.length === 0) output = null
98
- else if (output.length === 1) output = output[0]
99
- } catch (e) {
100
- if (options.trace && err.stack) console.error(e.stack)
101
- else console.error(e.toString(options.compact))
102
-
103
- process.exit(1)
104
- }
105
- } else {
106
- console.error(
107
- (options.trace && err.stack) ||
108
- err.message ||
109
- String(err))
110
-
111
- process.exit(1)
112
- }
113
- }
114
-
115
- if (isYaml) console.log(JSON.stringify(output, null, ' '))
116
- else console.log(yaml.dump(output))
117
- })