@emulsify/cli 2.0.0 → 2.1.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 (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 +9 -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,782 +0,0 @@
1
- # cosmiconfig
2
-
3
- [![codecov](https://codecov.io/gh/cosmiconfig/cosmiconfig/branch/main/graph/badge.svg)](https://codecov.io/gh/cosmiconfig/cosmiconfig)
4
-
5
- Cosmiconfig searches for and loads configuration for your program.
6
-
7
- It features smart defaults based on conventional expectations in the JavaScript ecosystem.
8
- But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.
9
-
10
- By default, Cosmiconfig will check the current directory for the following:
11
-
12
- - a `package.json` property
13
- - a JSON or YAML, extensionless "rc file"
14
- - an "rc file" with the extensions `.json`, `.yaml`, `.yml`, `.js`, `.ts`, `.mjs`, or `.cjs`
15
- - any of the above two inside a `.config` subdirectory
16
- - a `.config.js`, `.config.ts`, `.config.mjs`, or `.config.cjs` file
17
-
18
- For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:
19
-
20
- - a `myapp` property in `package.json`
21
- - a `.myapprc` file in JSON or YAML format
22
- - a `.myapprc.json`, `.myapprc.yaml`, `.myapprc.yml`, `.myapprc.js`, `.myapprc.ts`, `.myapprc.mjs`, or `.myapprc.cjs` file
23
- - a `myapprc`, `myapprc.json`, `myapprc.yaml`, `myapprc.yml`, `myapprc.js`, `myapprc.ts`, `myapprc.mjs`, or `myapprc.cjs` file inside a `.config` subdirectory
24
- - a `myapp.config.js`, `myapp.config.ts`, `myapp.config.mjs`, or `myapp.config.cjs` file
25
-
26
- Optionally, you can tell it to search up the directory tree using [search strategies],
27
- checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory).
28
-
29
- ## Table of contents
30
-
31
- - [Installation](#installation)
32
- - [Usage for tooling developers](#usage-for-tooling-developers)
33
- - [Result](#result)
34
- - [Asynchronous API](#asynchronous-api)
35
- - [cosmiconfig()](#cosmiconfig-1)
36
- - [explorer.search()](#explorersearch)
37
- - [explorer.load()](#explorerload)
38
- - [explorer.clearLoadCache()](#explorerclearloadcache)
39
- - [explorer.clearSearchCache()](#explorerclearsearchcache)
40
- - [explorer.clearCaches()](#explorerclearcaches)
41
- - [Synchronous API](#synchronous-api)
42
- - [cosmiconfigSync()](#cosmiconfigsync)
43
- - [explorerSync.search()](#explorersyncsearch)
44
- - [explorerSync.load()](#explorersyncload)
45
- - [explorerSync.clearLoadCache()](#explorersyncclearloadcache)
46
- - [explorerSync.clearSearchCache()](#explorersyncclearsearchcache)
47
- - [explorerSync.clearCaches()](#explorersyncclearcaches)
48
- - [cosmiconfigOptions](#cosmiconfigoptions)
49
- - [searchStrategy](#searchstrategy)
50
- - [searchPlaces](#searchplaces)
51
- - [loaders](#loaders)
52
- - [packageProp](#packageprop)
53
- - [stopDir](#stopdir)
54
- - [cache](#cache)
55
- - [transform](#transform)
56
- - [ignoreEmptySearchPlaces](#ignoreemptysearchplaces)
57
- - [Loading JS modules](#loading-js-modules)
58
- - [Caching](#caching)
59
- - [Differences from rc](#differences-from-rc)
60
- - [Usage for end users](#usage-for-end-users)
61
- - [Imports](#imports)
62
- - [Contributing & Development](#contributing--development)
63
-
64
- ## Installation
65
-
66
- ```
67
- npm install cosmiconfig
68
- ```
69
-
70
- Tested in Node 14+.
71
-
72
- ## Usage for tooling developers
73
-
74
- *If you are an end user (i.e. a user of a tool that uses cosmiconfig, like `prettier` or `stylelint`),
75
- you can skip down to [the end user section](#usage-for-end-users).*
76
-
77
- Create a Cosmiconfig explorer, then either `search` for or directly `load` a configuration file.
78
-
79
- ```js
80
- const { cosmiconfig, cosmiconfigSync } = require('cosmiconfig');
81
- // ...
82
- const explorer = cosmiconfig(moduleName);
83
-
84
- // Search for a configuration by walking up directories.
85
- // See documentation for search, below.
86
- explorer.search()
87
- .then((result) => {
88
- // result.config is the parsed configuration object.
89
- // result.filepath is the path to the config file that was found.
90
- // result.isEmpty is true if there was nothing to parse in the config file.
91
- })
92
- .catch((error) => {
93
- // Do something constructive.
94
- });
95
-
96
- // Load a configuration directly when you know where it should be.
97
- // The result object is the same as for search.
98
- // See documentation for load, below.
99
- explorer.load(pathToConfig).then(/* ... */);
100
-
101
- // You can also search and load synchronously.
102
- const explorerSync = cosmiconfigSync(moduleName);
103
-
104
- const searchedFor = explorerSync.search();
105
- const loaded = explorerSync.load(pathToConfig);
106
- ```
107
-
108
- ## Result
109
-
110
- The result object you get from `search` or `load` has the following properties:
111
-
112
- - **config:** The parsed configuration object. `undefined` if the file is empty.
113
- - **filepath:** The path to the configuration file that was found.
114
- - **isEmpty:** `true` if the configuration file is empty. This property will not be present if the configuration file is not empty.
115
-
116
- ## Asynchronous API
117
-
118
- ### cosmiconfig()
119
-
120
- ```js
121
- const { cosmiconfig } = require('cosmiconfig');
122
- const explorer = cosmiconfig(moduleName, /* optional */ cosmiconfigOptions)
123
- ```
124
-
125
- Creates a cosmiconfig instance ("explorer") configured according to the arguments, and initializes its caches.
126
-
127
- #### moduleName
128
-
129
- Type: `string`. **Required.**
130
-
131
- Your module name. This is used to create the default [`searchPlaces`] and [`packageProp`].
132
-
133
- If your [`searchPlaces`] value will include files, as it does by default (e.g. `${moduleName}rc`), your `moduleName` must consist of characters allowed in filenames. That means you should not copy scoped package names, such as `@my-org/my-package`, directly into `moduleName`.
134
-
135
- **[`cosmiconfigOptions`] are documented below.**
136
- You may not need them, and should first read about the functions you'll use.
137
-
138
- ### explorer.search()
139
-
140
- ```js
141
- explorer.search([searchFrom]).then(result => { /* ... */ })
142
- ```
143
-
144
- Searches for a configuration file. Returns a Promise that resolves with a [result] or with `null`, if no configuration file is found.
145
-
146
- You can do the same thing synchronously with [`explorerSync.search()`].
147
-
148
- Let's say your module name is `goldengrahams` so you initialized with `const explorer = cosmiconfig('goldengrahams');`.
149
- Here's how your default [`search()`] will work:
150
-
151
- - Starting from `process.cwd()` (or some other directory defined by the `searchFrom` argument to [`search()`]), look for configuration objects in the following places:
152
- 1. A `goldengrahams` property in a `package.json` file.
153
- 2. A `.goldengrahamsrc` file with JSON or YAML syntax.
154
- 3. A `.goldengrahamsrc.json`, `.goldengrahamsrc.yaml`, `.goldengrahamsrc.yml`, `.goldengrahamsrc.js`, `.goldengrahamsrc.ts`, `.goldengrahamsrc.mjs`, or `.goldengrahamsrc.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
155
- 4. A `goldengrahamsrc`, `goldengrahamsrc.json`, `goldengrahamsrc.yaml`, `goldengrahamsrc.yml`, `goldengrahamsrc.js`, `goldengrahamsrc.ts`, `goldengrahamsrc.mjs`, or `goldengrahamsrc.cjs` file in the `.config` subdirectory.
156
- 5. A `goldengrahams.config.js`, `goldengrahams.config.ts`, `goldengrahams.config.mjs`, or `goldengrahams.config.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
157
- - If none of those searches reveal a configuration object, continue depending on the current search strategy:
158
- - If it's `none` (which is the default if you don't specify a [`stopDir`] option), stop here and return/resolve with `null`.
159
- - If it's `global` (which is the default if you specify a [`stopDir`] option), move up one directory level and try again,
160
- recursing until arriving at the configured [`stopDir`] option, which defaults to the user's home directory.
161
- - After arriving at the [`stopDir`], the global configuration directory (as defined by [`env-paths`] without prefix) is also checked,
162
- looking at the files `config`, `config.json`, `config.yaml`, `config.yml`, `config.js`, `config.ts`, `config.cjs`, and `config.mjs`
163
- in the directory `~/.config/goldengrahams/` (on Linux; see [`env-paths`] documentation for other OSs).
164
- - If it's `project`, check whether a `package.json` file is present in the current directory, and if not,
165
- move up one directory level and try again, recursing until there is one.
166
- - If at any point a parsable configuration is found, the [`search()`] Promise resolves with its [result] \(or, with [`explorerSync.search()`], the [result] is returned).
167
- - If no configuration object is found, the [`search()`] Promise resolves with `null` (or, with [`explorerSync.search()`], `null` is returned).
168
- - If a configuration object is found *but is malformed* (causing a parsing error), the [`search()`] Promise rejects with that error (so you should `.catch()` it). (Or, with [`explorerSync.search()`], the error is thrown.)
169
-
170
- **If you know exactly where your configuration file should be, you can use [`load()`], instead.**
171
-
172
- **The search process is highly customizable.**
173
- Use the cosmiconfig options [`searchPlaces`] and [`loaders`] to precisely define where you want to look for configurations and how you want to load them.
174
-
175
- #### searchFrom
176
-
177
- Type: `string`.
178
- Default: `process.cwd()`.
179
-
180
- A filename.
181
- [`search()`] will start its search here.
182
-
183
- If the value is a directory, that's where the search starts.
184
- If it's a file, the search starts in that file's directory.
185
-
186
- ### explorer.load()
187
-
188
- ```js
189
- explorer.load(loadPath).then(result => { /* ... */ })
190
- ```
191
-
192
- Loads a configuration file. Returns a Promise that resolves with a [result] or rejects with an error (if the file does not exist or cannot be loaded).
193
-
194
- Use `load` if you already know where the configuration file is and you just need to load it.
195
-
196
- ```js
197
- explorer.load('load/this/file.json'); // Tries to load load/this/file.json.
198
- ```
199
-
200
- If you load a `package.json` file, the result will be derived from whatever property is specified as your [`packageProp`].
201
- `package.yaml` will work as well if you specify these file names in your [`searchPlaces`].
202
-
203
- You can do the same thing synchronously with [`explorerSync.load()`].
204
-
205
- ### explorer.clearLoadCache()
206
-
207
- Clears the cache used in [`load()`].
208
-
209
- ### explorer.clearSearchCache()
210
-
211
- Clears the cache used in [`search()`].
212
-
213
- ### explorer.clearCaches()
214
-
215
- Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
216
-
217
- ## Synchronous API
218
-
219
- ### cosmiconfigSync()
220
-
221
- ```js
222
- const { cosmiconfigSync } = require('cosmiconfig');
223
- const explorerSync = cosmiconfigSync(moduleName, /* optional */ cosmiconfigOptions)
224
- ```
225
-
226
- Creates a *synchronous* cosmiconfig instance ("explorerSync") configured according to the arguments, and initializes its caches.
227
-
228
- See [`cosmiconfig()`](#cosmiconfig-1).
229
-
230
- ### explorerSync.search()
231
-
232
- ```js
233
- const result = explorerSync.search([searchFrom]);
234
- ```
235
-
236
- Synchronous version of [`explorer.search()`].
237
-
238
- Returns a [result] or `null`.
239
-
240
- ### explorerSync.load()
241
-
242
- ```js
243
- const result = explorerSync.load(loadPath);
244
- ```
245
-
246
- Synchronous version of [`explorer.load()`].
247
-
248
- Returns a [result].
249
-
250
- ### explorerSync.clearLoadCache()
251
-
252
- Clears the cache used in [`load()`].
253
-
254
- ### explorerSync.clearSearchCache()
255
-
256
- Clears the cache used in [`search()`].
257
-
258
- ### explorerSync.clearCaches()
259
-
260
- Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
261
-
262
- ## cosmiconfigOptions
263
-
264
- Type: `Object`.
265
-
266
- Possible options are documented below.
267
-
268
- ### searchStrategy
269
-
270
- Type: `string`
271
- Default: `global` if [`stopDir`] is specified, `none` otherwise.
272
-
273
- The strategy that should be used to determine which directories to check for configuration files.
274
-
275
- - `none`: Only checks in the current working directory.
276
- - `project`: Starts in the current working directory, traversing upwards until a `package.{json,yaml}` file is found.
277
- - `global`: Starts in the current working directory, traversing upwards until the configured [`stopDir`]
278
- (or the current user's home directory if none is given). Then, if no configuration is found, also look in the
279
- operating system's default configuration directory (according to [`env-paths`] without prefix),
280
- where a different set of file names is checked:
281
-
282
- ```js
283
- [
284
- `config`,
285
- `config.json`,
286
- `config.yaml`,
287
- `config.yml`,
288
- `config.js`,
289
- `config.ts`,
290
- `config.cjs`,
291
- `config.mjs`
292
- ]
293
- ```
294
-
295
- ### searchPlaces
296
-
297
- Type: `Array<string>`.
298
- Default: See below.
299
-
300
- An array of places that [`search()`] will check in each directory as it moves up the directory tree.
301
- Each place is relative to the directory being searched, and the places are checked in the specified order.
302
-
303
- **Default `searchPlaces`:**
304
-
305
- For the [asynchronous API](#asynchronous-api), these are the default `searchPlaces`:
306
-
307
- ```js
308
- [
309
- 'package.json',
310
- `.${moduleName}rc`,
311
- `.${moduleName}rc.json`,
312
- `.${moduleName}rc.yaml`,
313
- `.${moduleName}rc.yml`,
314
- `.${moduleName}rc.js`,
315
- `.${moduleName}rc.ts`,
316
- `.${moduleName}rc.mjs`,
317
- `.${moduleName}rc.cjs`,
318
- `.config/${moduleName}rc`,
319
- `.config/${moduleName}rc.json`,
320
- `.config/${moduleName}rc.yaml`,
321
- `.config/${moduleName}rc.yml`,
322
- `.config/${moduleName}rc.js`,
323
- `.config/${moduleName}rc.ts`,
324
- `.config/${moduleName}rc.mjs`,
325
- `.config/${moduleName}rc.cjs`,
326
- `${moduleName}.config.js`,
327
- `${moduleName}.config.ts`,
328
- `${moduleName}.config.mjs`,
329
- `${moduleName}.config.cjs`,
330
- ];
331
- ```
332
-
333
- For the [synchronous API](#synchronous-api), the only difference is that `.mjs` files are not included. See ["Loading JS modules"] for more information.
334
-
335
- Create your own array to search more, fewer, or altogether different places.
336
-
337
- Every item in `searchPlaces` needs to have a loader in [`loaders`] that corresponds to its extension.
338
- (Common extensions are covered by default loaders.)
339
- Read more about [`loaders`] below.
340
-
341
- `package.json` is a special value: When it is included in `searchPlaces`, Cosmiconfig will always parse it as JSON and load a property within it, not the whole file.
342
- That property is defined with the [`packageProp`] option, and defaults to your module name.
343
-
344
- `package.yaml` (used by pnpm) works the same way.
345
-
346
- Examples, with a module named `porgy`:
347
-
348
- ```js
349
- // Disallow extensions on rc files:
350
- ['package.json', '.porgyrc', 'porgy.config.js']
351
- ```
352
-
353
- ```js
354
- // Limit the options dramatically:
355
- ['package.json', '.porgyrc']
356
- ```
357
-
358
- ```js
359
- // Maybe you want to look for a wide variety of JS flavors:
360
- [
361
- 'porgy.config.js',
362
- 'porgy.config.mjs',
363
- 'porgy.config.ts',
364
- 'porgy.config.coffee'
365
- ]
366
- // ^^ You will need to designate a custom loader to tell
367
- // Cosmiconfig how to handle `.coffee` files.
368
- ```
369
-
370
- ```js
371
- // Look within a .config/ subdirectory of every searched directory:
372
- [
373
- 'package.json',
374
- '.porgyrc',
375
- '.config/.porgyrc',
376
- '.porgyrc.json',
377
- '.config/.porgyrc.json'
378
- ]
379
- ```
380
-
381
- ### loaders
382
-
383
- Type: `Object`.
384
- Default: See below.
385
-
386
- An object that maps extensions to the loader functions responsible for loading and parsing files with those extensions.
387
-
388
- Cosmiconfig exposes its default loaders on the named export `defaultLoaders` and `defaultLoadersSync`.
389
-
390
- **Default `loaders`:**
391
-
392
- ```js
393
- const { defaultLoaders, defaultLoadersSync } = require('cosmiconfig');
394
-
395
- console.log(Object.entries(defaultLoaders));
396
- // [
397
- // [ '.mjs', [Function: loadJs] ],
398
- // [ '.cjs', [Function: loadJs] ],
399
- // [ '.js', [Function: loadJs] ],
400
- // [ '.ts', [Function: loadTs] ],
401
- // [ '.json', [Function: loadJson] ],
402
- // [ '.yaml', [Function: loadYaml] ],
403
- // [ '.yml', [Function: loadYaml] ],
404
- // [ 'noExt', [Function: loadYaml] ]
405
- // ]
406
-
407
- console.log(Object.entries(defaultLoadersSync));
408
- // [
409
- // [ '.cjs', [Function: loadJsSync] ],
410
- // [ '.js', [Function: loadJsSync] ],
411
- // [ '.ts', [Function: loadTsSync] ],
412
- // [ '.json', [Function: loadJson] ],
413
- // [ '.yaml', [Function: loadYaml] ],
414
- // [ '.yml', [Function: loadYaml] ],
415
- // [ 'noExt', [Function: loadYaml] ]
416
- // ]
417
- ```
418
-
419
- (YAML is a superset of JSON; which means YAML parsers can parse JSON; which is how extensionless files can be either YAML *or* JSON with only one parser.)
420
-
421
- **If you provide a `loaders` object, your object will be *merged* with the defaults.**
422
- So you can override one or two without having to override them all.
423
-
424
- **Keys in `loaders`** are extensions (starting with a period), or `noExt` to specify the loader for files *without* extensions, like `.myapprc`.
425
-
426
- **Values in `loaders`** are a loader function (described below) whose values are loader functions.
427
-
428
- **The most common use case for custom loaders value is to load extensionless `rc` files as strict JSON**, instead of JSON *or* YAML (the default).
429
- To accomplish that, provide the following `loaders` value:
430
-
431
- ```js
432
- {
433
- noExt: defaultLoaders['.json'];
434
- }
435
- ```
436
-
437
- If you want to load files that are not handled by the loader functions Cosmiconfig exposes, you can write a custom loader function or use one from NPM if it exists.
438
-
439
- **Use cases for custom loader function:**
440
-
441
- - Allow configuration syntaxes that aren't handled by Cosmiconfig's defaults, like JSON5, INI, or XML.
442
- - Parse JS files with Babel before deriving the configuration.
443
-
444
- **Custom loader functions** have the following signature:
445
-
446
- ```ts
447
- // Sync
448
- type SyncLoader = (filepath: string, content: string) => Object | null
449
-
450
- // Async
451
- type AsyncLoader = (filepath: string, content: string) => Object | null | Promise<Object | null>
452
- ```
453
-
454
- Cosmiconfig reads the file when it checks whether the file exists, so it will provide you with both the file's path and its content.
455
- Do whatever you need to, and return either a configuration object or `null` (or, for async-only loaders, a Promise that resolves with one of those).
456
- `null` indicates that no real configuration was found and the search should continue.
457
-
458
- A few things to note:
459
-
460
- - If you use a custom loader, be aware of whether it's sync or async: you cannot use async customer loaders with the sync API ([`cosmiconfigSync()`]).
461
- - **Special JS syntax can also be handled by using a `require` hook**, because `defaultLoaders['.js']` just uses `require`.
462
- Whether you use custom loaders or a `require` hook is up to you.
463
-
464
- Examples:
465
-
466
- ```js
467
- // Allow JSON5 syntax:
468
- cosmiconfig('foo', {
469
- loaders: {
470
- '.json': json5Loader
471
- }
472
- });
473
-
474
- // Allow a special configuration syntax of your own creation:
475
- cosmiconfig('foo', {
476
- loaders: {
477
- '.special': specialLoader
478
- }
479
- });
480
-
481
- // Allow many flavors of JS, using custom loaders:
482
- cosmiconfig('foo', {
483
- loaders: {
484
- '.coffee': coffeeScriptLoader
485
- }
486
- });
487
-
488
- // Allow many flavors of JS but rely on require hooks:
489
- cosmiconfig('foo', {
490
- loaders: {
491
- '.coffee': defaultLoaders['.js']
492
- }
493
- });
494
- ```
495
-
496
- ### packageProp
497
-
498
- Type: `string | Array<string>`.
499
- Default: `` `${moduleName}` ``.
500
-
501
- Name of the property in `package.json` (or `package.yaml`) to look for.
502
-
503
- Use a period-delimited string or an array of strings to describe a path to nested properties.
504
-
505
- For example, the value `'configs.myPackage'` or `['configs', 'myPackage']` will get you the `"myPackage"` value in a `package.json` like this:
506
-
507
- ```json
508
- {
509
- "configs": {
510
- "myPackage": {"option": "value"}
511
- }
512
- }
513
- ```
514
-
515
- If nested property names within the path include periods, you need to use an array of strings. For example, the value `['configs', 'foo.bar', 'baz']` will get you the `"baz"` value in a `package.json` like this:
516
-
517
- ```json
518
- {
519
- "configs": {
520
- "foo.bar": {
521
- "baz": {"option": "value"}
522
- }
523
- }
524
- }
525
- ```
526
-
527
- If a string includes period but corresponds to a top-level property name, it will not be interpreted as a period-delimited path. For example, the value `'one.two'` will get you the `"three"` value in a `package.json` like this:
528
-
529
- ```json
530
- {
531
- "one.two": "three",
532
- "one": {
533
- "two": "four"
534
- }
535
- }
536
- ```
537
-
538
- ### stopDir
539
-
540
- Type: `string`.
541
- Default: Absolute path to your home directory.
542
-
543
- Directory where the search will stop.
544
-
545
- ### cache
546
-
547
- Type: `boolean`.
548
- Default: `true`.
549
-
550
- If `false`, no caches will be used.
551
- Read more about ["Caching"](#caching) below.
552
-
553
- ### transform
554
-
555
- Type: `(Result) => Promise<Result> | Result`.
556
-
557
- A function that transforms the parsed configuration. Receives the [result].
558
-
559
- If using [`search()`] or [`load()`] \(which are async), the transform function can return the transformed result or return a Promise that resolves with the transformed result.
560
- If using `cosmiconfigSync`, [`search()`] or [`load()`], the function must be synchronous and return the transformed result.
561
-
562
- The reason you might use this option — instead of simply applying your transform function some other way — is that *the transformed result will be cached*. If your transformation involves additional filesystem I/O or other potentially slow processing, you can use this option to avoid repeating those steps every time a given configuration is searched or loaded.
563
-
564
- ### ignoreEmptySearchPlaces
565
-
566
- Type: `boolean`.
567
- Default: `true`.
568
-
569
- By default, if [`search()`] encounters an empty file (containing nothing but whitespace) in one of the [`searchPlaces`], it will ignore the empty file and move on.
570
- If you'd like to load empty configuration files, instead, set this option to `false`.
571
-
572
- Why might you want to load empty configuration files?
573
- If you want to throw an error, or if an empty configuration file means something to your program.
574
-
575
- ## Loading JS modules
576
-
577
- Your end users can provide JS configuration files as ECMAScript modules (ESM) under the following conditions:
578
-
579
- - You (the cosmiconfig user) use cosmiconfig's [asynchronous API](#asynchronous-api).
580
- - Your end user runs a version of Node that supports ESM ([>=12.17.0](https://nodejs.org/en/blog/release/v12.17.0/), or earlier with the `--experimental-modules` flag).
581
- - Your end user provides an `.mjs` configuration file, or a `.js` file whose nearest parent `package.json` file contains `"type": "module"`. (See [Node's method for determining a file's module system](https://nodejs.org/api/packages.html#packages_determining_module_system).)
582
-
583
- With cosmiconfig's [asynchronous API](#asynchronous-api), the default [`searchPlaces`] include `.js`, `.ts`, `.mjs`, and `.cjs` files. Cosmiconfig loads all these file types with the [dynamic `import` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports).
584
-
585
- With the [synchronous API](#synchronous-api), JS configuration files are always treated as CommonJS, and `.mjs` files are ignored, because there is no synchronous API for the dynamic `import` function.
586
-
587
- ## Caching
588
-
589
- As of v2, cosmiconfig uses caching to reduce the need for repetitious reading of the filesystem or expensive transforms. Every new cosmiconfig instance (created with `cosmiconfig()`) has its own caches.
590
-
591
- To avoid or work around caching, you can do the following:
592
-
593
- - Set the `cosmiconfig` option [`cache`] to `false`.
594
- - Use the cache-clearing methods [`clearLoadCache()`], [`clearSearchCache()`], and [`clearCaches()`].
595
- - Create separate instances of cosmiconfig (separate "explorers").
596
-
597
- ## Differences from [rc](https://github.com/dominictarr/rc)
598
-
599
- [rc](https://github.com/dominictarr/rc) serves its focused purpose well. cosmiconfig differs in a few key ways — making it more useful for some projects, less useful for others:
600
-
601
- - Looks for configuration in some different places: in a `package.json` property, an rc file, a `.config.js` file, and rc files with extensions.
602
- - Built-in support for JSON, YAML, and CommonJS formats.
603
- - Stops at the first configuration found, instead of finding all that can be found up the directory tree and merging them automatically.
604
- - Options.
605
- - Asynchronous by default (though can be run synchronously).
606
-
607
- ## Usage for end users
608
-
609
- When configuring a tool, you can use multiple file formats and put these in multiple places.
610
-
611
- Usually, a tool would mention this in its own README file,
612
- but by default, these are the following places, where `{NAME}` represents the name of the tool:
613
-
614
- ```
615
- package.json
616
- .{NAME}rc
617
- .{NAME}rc.json
618
- .{NAME}rc.yaml
619
- .{NAME}rc.yml
620
- .{NAME}rc.js
621
- .{NAME}rc.ts
622
- .{NAME}rc.cjs
623
- .config/{NAME}rc
624
- .config/{NAME}rc.json
625
- .config/{NAME}rc.yaml
626
- .config/{NAME}rc.yml
627
- .config/{NAME}rc.js
628
- .config/{NAME}rc.ts
629
- .config/{NAME}rc.mjs
630
- .config/{NAME}rc.cjs
631
- {NAME}.config.js
632
- {NAME}.config.ts
633
- {NAME}.config.mjs
634
- {NAME}.config.cjs
635
- ```
636
-
637
- The contents of these files are defined by the tool.
638
- For example, you can configure prettier to enforce semicolons at the end of the line
639
- using a file named `.config/prettierrc.yml`:
640
-
641
- ```yaml
642
- semi: true
643
- ```
644
-
645
- Additionally, you have the option to put a property named after the tool in your `package.json` file,
646
- with the contents of that property being the same as the file contents. To use the same example as above:
647
-
648
- ```json
649
- {
650
- "name": "your-project",
651
- "dependencies": {},
652
- "prettier": {
653
- "semi": true
654
- }
655
- }
656
- ```
657
-
658
- This has the advantage that you can put the configuration of all tools
659
- (at least the ones that use cosmiconfig) in one file.
660
-
661
- You can also add a `cosmiconfig` key within your `package.json` file or create one of the following files
662
- to configure `cosmiconfig` itself:
663
-
664
- ```
665
- .config/config.json
666
- .config/config.yaml
667
- .config/config.yml
668
- .config/config.js
669
- .config/config.ts
670
- .config/config.cjs
671
- ```
672
-
673
- The following properties are currently actively supported in these places:
674
-
675
- ```yaml
676
- cosmiconfig:
677
- # adds places where configuration files are being searched
678
- searchPlaces:
679
- - .config/{name}.yml
680
- # to enforce a custom naming convention and format, don't merge the above with the tool-defined search places
681
- # (`true` is the default setting)
682
- mergeSearchPlaces: false
683
- ```
684
-
685
- > **Note:** technically, you can overwrite all options described in [cosmiconfigOptions](#cosmiconfigoptions) here,
686
- > but everything not listed above should be used at your own risk, as it has not been tested explicitly.
687
- > The only exceptions to this are the `loaders` property, which is explicitly not supported at this time,
688
- > and the `searchStrategy` property, which is intentionally disallowed.
689
-
690
- You can also add more root properties outside the `cosmiconfig` property
691
- to configure your tools, entirely eliminating the need to look for additional configuration files:
692
-
693
- ```yaml
694
- cosmiconfig:
695
- searchPlaces: []
696
-
697
- prettier:
698
- semi: true
699
- ```
700
-
701
- ### Imports
702
-
703
- Wherever you put your configuration (the package.json file, a root config file or a package-specific config file),
704
- you can use the special `$import` key to import another file as a base.
705
-
706
- For example, you can import from an npm package (in this example, `@foocorp/config`).
707
-
708
- `.prettierrc.base.yml` in said npm package could define some company-wide defaults:
709
-
710
- ```yaml
711
- printWidth: 120
712
- semi: true
713
- tabWidth: 2
714
- ```
715
-
716
- And then, the `.prettierrc.yml` file in the project itself would just reference that file,
717
- optionally overriding the defaults with project-specific settings:
718
-
719
- ```yaml
720
- $import: node_modules/@foocorp/config/.prettierrc.base.yml
721
- # we want more space!
722
- printWidth: 200
723
- ```
724
-
725
- It is possible to import multiple base files by specifying an array of paths,
726
- which will be processed in declaration order;
727
- that means that the last entry will win if there are conflicting properties.
728
-
729
- It is also possible to import file formats other than the importing format
730
- as long as they are supported by the loaders specified by the developer of the tool you're configuring.
731
-
732
- ```yaml
733
- $import: [first.yml, second.json, third.config.js]
734
- ```
735
-
736
- ## Contributing & Development
737
-
738
- Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
739
-
740
- And please do participate!
741
-
742
- [result]: #result
743
-
744
- [`load()`]: #explorerload
745
-
746
- [`search()`]: #explorersearch
747
-
748
- [`clearloadcache()`]: #explorerclearloadcache
749
-
750
- [`clearsearchcache()`]: #explorerclearsearchcache
751
-
752
- [`cosmiconfig()`]: #cosmiconfig
753
-
754
- [`cosmiconfigSync()`]: #cosmiconfigsync
755
-
756
- [`clearcaches()`]: #explorerclearcaches
757
-
758
- [`packageprop`]: #packageprop
759
-
760
- [`cache`]: #cache
761
-
762
- [`stopdir`]: #stopdir
763
-
764
- [`searchplaces`]: #searchplaces
765
-
766
- [`loaders`]: #loaders
767
-
768
- [`cosmiconfigoptions`]: #cosmiconfigoptions
769
-
770
- [`explorerSync.search()`]: #explorersyncsearch
771
-
772
- [`explorerSync.load()`]: #explorersyncload
773
-
774
- [`explorer.search()`]: #explorersearch
775
-
776
- [`explorer.load()`]: #explorerload
777
-
778
- ["Loading JS modules"]: #loading-js-modules
779
-
780
- [`env-paths`]: https://github.com/sindresorhus/env-paths
781
-
782
- [search strategies]: #searchstrategy