@esportsplus/typescript 0.8.5 → 0.8.7

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 (506) hide show
  1. package/bin/tsc +2 -5
  2. package/bin/tsc-alias +2 -5
  3. package/package.json +2 -4
  4. package/node_modules/.package-lock.json +0 -481
  5. package/node_modules/@nodelib/fs.scandir/LICENSE +0 -21
  6. package/node_modules/@nodelib/fs.scandir/README.md +0 -171
  7. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
  8. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +0 -19
  9. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +0 -4
  10. package/node_modules/@nodelib/fs.scandir/out/constants.js +0 -17
  11. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +0 -12
  12. package/node_modules/@nodelib/fs.scandir/out/index.js +0 -26
  13. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
  14. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +0 -104
  15. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +0 -1
  16. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +0 -13
  17. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +0 -5
  18. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +0 -54
  19. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +0 -20
  20. package/node_modules/@nodelib/fs.scandir/out/settings.js +0 -24
  21. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
  22. package/node_modules/@nodelib/fs.scandir/out/types/index.js +0 -2
  23. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +0 -2
  24. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +0 -19
  25. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +0 -2
  26. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +0 -5
  27. package/node_modules/@nodelib/fs.scandir/package.json +0 -44
  28. package/node_modules/@nodelib/fs.stat/LICENSE +0 -21
  29. package/node_modules/@nodelib/fs.stat/README.md +0 -126
  30. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
  31. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +0 -17
  32. package/node_modules/@nodelib/fs.stat/out/index.d.ts +0 -12
  33. package/node_modules/@nodelib/fs.stat/out/index.js +0 -26
  34. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
  35. package/node_modules/@nodelib/fs.stat/out/providers/async.js +0 -36
  36. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +0 -3
  37. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +0 -23
  38. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +0 -16
  39. package/node_modules/@nodelib/fs.stat/out/settings.js +0 -16
  40. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +0 -4
  41. package/node_modules/@nodelib/fs.stat/out/types/index.js +0 -2
  42. package/node_modules/@nodelib/fs.stat/package.json +0 -37
  43. package/node_modules/@nodelib/fs.walk/LICENSE +0 -21
  44. package/node_modules/@nodelib/fs.walk/README.md +0 -215
  45. package/node_modules/@nodelib/fs.walk/out/index.d.ts +0 -14
  46. package/node_modules/@nodelib/fs.walk/out/index.js +0 -34
  47. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
  48. package/node_modules/@nodelib/fs.walk/out/providers/async.js +0 -30
  49. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +0 -4
  50. package/node_modules/@nodelib/fs.walk/out/providers/index.js +0 -9
  51. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +0 -12
  52. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +0 -34
  53. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +0 -10
  54. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +0 -14
  55. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
  56. package/node_modules/@nodelib/fs.walk/out/readers/async.js +0 -97
  57. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +0 -7
  58. package/node_modules/@nodelib/fs.walk/out/readers/common.js +0 -31
  59. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
  60. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +0 -11
  61. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +0 -15
  62. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +0 -59
  63. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +0 -30
  64. package/node_modules/@nodelib/fs.walk/out/settings.js +0 -26
  65. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +0 -8
  66. package/node_modules/@nodelib/fs.walk/out/types/index.js +0 -2
  67. package/node_modules/@nodelib/fs.walk/package.json +0 -44
  68. package/node_modules/anymatch/LICENSE +0 -15
  69. package/node_modules/anymatch/README.md +0 -87
  70. package/node_modules/anymatch/index.d.ts +0 -20
  71. package/node_modules/anymatch/index.js +0 -104
  72. package/node_modules/anymatch/package.json +0 -48
  73. package/node_modules/array-union/index.d.ts +0 -25
  74. package/node_modules/array-union/index.js +0 -5
  75. package/node_modules/array-union/license +0 -9
  76. package/node_modules/array-union/package.json +0 -38
  77. package/node_modules/array-union/readme.md +0 -34
  78. package/node_modules/binary-extensions/binary-extensions.json +0 -263
  79. package/node_modules/binary-extensions/binary-extensions.json.d.ts +0 -3
  80. package/node_modules/binary-extensions/index.d.ts +0 -14
  81. package/node_modules/binary-extensions/index.js +0 -1
  82. package/node_modules/binary-extensions/license +0 -10
  83. package/node_modules/binary-extensions/package.json +0 -40
  84. package/node_modules/binary-extensions/readme.md +0 -25
  85. package/node_modules/braces/LICENSE +0 -21
  86. package/node_modules/braces/README.md +0 -586
  87. package/node_modules/braces/index.js +0 -170
  88. package/node_modules/braces/lib/compile.js +0 -60
  89. package/node_modules/braces/lib/constants.js +0 -57
  90. package/node_modules/braces/lib/expand.js +0 -113
  91. package/node_modules/braces/lib/parse.js +0 -331
  92. package/node_modules/braces/lib/stringify.js +0 -32
  93. package/node_modules/braces/lib/utils.js +0 -122
  94. package/node_modules/braces/package.json +0 -77
  95. package/node_modules/chokidar/LICENSE +0 -21
  96. package/node_modules/chokidar/README.md +0 -308
  97. package/node_modules/chokidar/index.js +0 -973
  98. package/node_modules/chokidar/lib/constants.js +0 -66
  99. package/node_modules/chokidar/lib/fsevents-handler.js +0 -526
  100. package/node_modules/chokidar/lib/nodefs-handler.js +0 -654
  101. package/node_modules/chokidar/package.json +0 -70
  102. package/node_modules/chokidar/types/index.d.ts +0 -192
  103. package/node_modules/commander/LICENSE +0 -22
  104. package/node_modules/commander/Readme.md +0 -1129
  105. package/node_modules/commander/esm.mjs +0 -16
  106. package/node_modules/commander/index.js +0 -27
  107. package/node_modules/commander/lib/argument.js +0 -147
  108. package/node_modules/commander/lib/command.js +0 -2179
  109. package/node_modules/commander/lib/error.js +0 -45
  110. package/node_modules/commander/lib/help.js +0 -461
  111. package/node_modules/commander/lib/option.js +0 -326
  112. package/node_modules/commander/lib/suggestSimilar.js +0 -100
  113. package/node_modules/commander/package-support.json +0 -16
  114. package/node_modules/commander/package.json +0 -80
  115. package/node_modules/commander/typings/index.d.ts +0 -891
  116. package/node_modules/dir-glob/index.js +0 -75
  117. package/node_modules/dir-glob/license +0 -9
  118. package/node_modules/dir-glob/package.json +0 -38
  119. package/node_modules/dir-glob/readme.md +0 -76
  120. package/node_modules/fast-glob/LICENSE +0 -21
  121. package/node_modules/fast-glob/README.md +0 -830
  122. package/node_modules/fast-glob/out/index.d.ts +0 -40
  123. package/node_modules/fast-glob/out/index.js +0 -102
  124. package/node_modules/fast-glob/out/managers/tasks.d.ts +0 -22
  125. package/node_modules/fast-glob/out/managers/tasks.js +0 -110
  126. package/node_modules/fast-glob/out/providers/async.d.ts +0 -9
  127. package/node_modules/fast-glob/out/providers/async.js +0 -23
  128. package/node_modules/fast-glob/out/providers/filters/deep.d.ts +0 -16
  129. package/node_modules/fast-glob/out/providers/filters/deep.js +0 -62
  130. package/node_modules/fast-glob/out/providers/filters/entry.d.ts +0 -17
  131. package/node_modules/fast-glob/out/providers/filters/entry.js +0 -85
  132. package/node_modules/fast-glob/out/providers/filters/error.d.ts +0 -8
  133. package/node_modules/fast-glob/out/providers/filters/error.js +0 -15
  134. package/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +0 -33
  135. package/node_modules/fast-glob/out/providers/matchers/matcher.js +0 -45
  136. package/node_modules/fast-glob/out/providers/matchers/partial.d.ts +0 -4
  137. package/node_modules/fast-glob/out/providers/matchers/partial.js +0 -38
  138. package/node_modules/fast-glob/out/providers/provider.d.ts +0 -19
  139. package/node_modules/fast-glob/out/providers/provider.js +0 -48
  140. package/node_modules/fast-glob/out/providers/stream.d.ts +0 -11
  141. package/node_modules/fast-glob/out/providers/stream.js +0 -31
  142. package/node_modules/fast-glob/out/providers/sync.d.ts +0 -9
  143. package/node_modules/fast-glob/out/providers/sync.js +0 -23
  144. package/node_modules/fast-glob/out/providers/transformers/entry.d.ts +0 -8
  145. package/node_modules/fast-glob/out/providers/transformers/entry.js +0 -26
  146. package/node_modules/fast-glob/out/readers/async.d.ts +0 -10
  147. package/node_modules/fast-glob/out/readers/async.js +0 -35
  148. package/node_modules/fast-glob/out/readers/reader.d.ts +0 -15
  149. package/node_modules/fast-glob/out/readers/reader.js +0 -33
  150. package/node_modules/fast-glob/out/readers/stream.d.ts +0 -14
  151. package/node_modules/fast-glob/out/readers/stream.js +0 -55
  152. package/node_modules/fast-glob/out/readers/sync.d.ts +0 -12
  153. package/node_modules/fast-glob/out/readers/sync.js +0 -43
  154. package/node_modules/fast-glob/out/settings.d.ts +0 -164
  155. package/node_modules/fast-glob/out/settings.js +0 -59
  156. package/node_modules/fast-glob/out/types/index.d.ts +0 -31
  157. package/node_modules/fast-glob/out/types/index.js +0 -2
  158. package/node_modules/fast-glob/out/utils/array.d.ts +0 -2
  159. package/node_modules/fast-glob/out/utils/array.js +0 -22
  160. package/node_modules/fast-glob/out/utils/errno.d.ts +0 -2
  161. package/node_modules/fast-glob/out/utils/errno.js +0 -7
  162. package/node_modules/fast-glob/out/utils/fs.d.ts +0 -4
  163. package/node_modules/fast-glob/out/utils/fs.js +0 -19
  164. package/node_modules/fast-glob/out/utils/index.d.ts +0 -8
  165. package/node_modules/fast-glob/out/utils/index.js +0 -17
  166. package/node_modules/fast-glob/out/utils/path.d.ts +0 -13
  167. package/node_modules/fast-glob/out/utils/path.js +0 -68
  168. package/node_modules/fast-glob/out/utils/pattern.d.ts +0 -49
  169. package/node_modules/fast-glob/out/utils/pattern.js +0 -206
  170. package/node_modules/fast-glob/out/utils/stream.d.ts +0 -4
  171. package/node_modules/fast-glob/out/utils/stream.js +0 -17
  172. package/node_modules/fast-glob/out/utils/string.d.ts +0 -2
  173. package/node_modules/fast-glob/out/utils/string.js +0 -11
  174. package/node_modules/fast-glob/package.json +0 -81
  175. package/node_modules/fastq/.github/dependabot.yml +0 -11
  176. package/node_modules/fastq/.github/workflows/ci.yml +0 -75
  177. package/node_modules/fastq/LICENSE +0 -13
  178. package/node_modules/fastq/README.md +0 -312
  179. package/node_modules/fastq/SECURITY.md +0 -15
  180. package/node_modules/fastq/bench.js +0 -66
  181. package/node_modules/fastq/example.js +0 -14
  182. package/node_modules/fastq/example.mjs +0 -11
  183. package/node_modules/fastq/index.d.ts +0 -57
  184. package/node_modules/fastq/package.json +0 -53
  185. package/node_modules/fastq/queue.js +0 -311
  186. package/node_modules/fastq/test/example.ts +0 -83
  187. package/node_modules/fastq/test/promise.js +0 -291
  188. package/node_modules/fastq/test/test.js +0 -653
  189. package/node_modules/fastq/test/tsconfig.json +0 -11
  190. package/node_modules/fill-range/LICENSE +0 -21
  191. package/node_modules/fill-range/README.md +0 -237
  192. package/node_modules/fill-range/index.js +0 -248
  193. package/node_modules/fill-range/package.json +0 -74
  194. package/node_modules/get-tsconfig/LICENSE +0 -21
  195. package/node_modules/get-tsconfig/README.md +0 -235
  196. package/node_modules/get-tsconfig/dist/index.cjs +0 -7
  197. package/node_modules/get-tsconfig/dist/index.d.cts +0 -1439
  198. package/node_modules/get-tsconfig/dist/index.d.mts +0 -1439
  199. package/node_modules/get-tsconfig/dist/index.mjs +0 -7
  200. package/node_modules/get-tsconfig/package.json +0 -46
  201. package/node_modules/glob-parent/CHANGELOG.md +0 -110
  202. package/node_modules/glob-parent/LICENSE +0 -15
  203. package/node_modules/glob-parent/README.md +0 -137
  204. package/node_modules/glob-parent/index.js +0 -42
  205. package/node_modules/glob-parent/package.json +0 -48
  206. package/node_modules/globby/gitignore.js +0 -120
  207. package/node_modules/globby/index.d.ts +0 -186
  208. package/node_modules/globby/index.js +0 -181
  209. package/node_modules/globby/license +0 -9
  210. package/node_modules/globby/package.json +0 -82
  211. package/node_modules/globby/readme.md +0 -170
  212. package/node_modules/globby/stream-utils.js +0 -46
  213. package/node_modules/ignore/LICENSE-MIT +0 -21
  214. package/node_modules/ignore/README.md +0 -412
  215. package/node_modules/ignore/index.d.ts +0 -61
  216. package/node_modules/ignore/index.js +0 -636
  217. package/node_modules/ignore/legacy.js +0 -559
  218. package/node_modules/ignore/package.json +0 -74
  219. package/node_modules/is-binary-path/index.d.ts +0 -17
  220. package/node_modules/is-binary-path/index.js +0 -7
  221. package/node_modules/is-binary-path/license +0 -9
  222. package/node_modules/is-binary-path/package.json +0 -40
  223. package/node_modules/is-binary-path/readme.md +0 -34
  224. package/node_modules/is-extglob/LICENSE +0 -21
  225. package/node_modules/is-extglob/README.md +0 -107
  226. package/node_modules/is-extglob/index.js +0 -20
  227. package/node_modules/is-extglob/package.json +0 -69
  228. package/node_modules/is-glob/LICENSE +0 -21
  229. package/node_modules/is-glob/README.md +0 -206
  230. package/node_modules/is-glob/index.js +0 -150
  231. package/node_modules/is-glob/package.json +0 -81
  232. package/node_modules/is-number/LICENSE +0 -21
  233. package/node_modules/is-number/README.md +0 -187
  234. package/node_modules/is-number/index.js +0 -18
  235. package/node_modules/is-number/package.json +0 -82
  236. package/node_modules/merge2/LICENSE +0 -21
  237. package/node_modules/merge2/README.md +0 -144
  238. package/node_modules/merge2/index.js +0 -144
  239. package/node_modules/merge2/package.json +0 -43
  240. package/node_modules/micromatch/LICENSE +0 -21
  241. package/node_modules/micromatch/README.md +0 -1024
  242. package/node_modules/micromatch/index.js +0 -474
  243. package/node_modules/micromatch/package.json +0 -119
  244. package/node_modules/mylas/LICENSE +0 -21
  245. package/node_modules/mylas/README.md +0 -39
  246. package/node_modules/mylas/build/chunk-3EDNT3AM.js +0 -1
  247. package/node_modules/mylas/build/chunk-M3H36CX2.js +0 -3
  248. package/node_modules/mylas/build/index.d.ts +0 -22
  249. package/node_modules/mylas/build/index.js +0 -1
  250. package/node_modules/mylas/build/interfaces.d.ts +0 -201
  251. package/node_modules/mylas/build/register.d.ts +0 -9
  252. package/node_modules/mylas/build/register.js +0 -1
  253. package/node_modules/mylas/build/worker.js +0 -1
  254. package/node_modules/mylas/package.json +0 -65
  255. package/node_modules/normalize-path/LICENSE +0 -21
  256. package/node_modules/normalize-path/README.md +0 -127
  257. package/node_modules/normalize-path/index.js +0 -35
  258. package/node_modules/normalize-path/package.json +0 -77
  259. package/node_modules/path-type/index.d.ts +0 -51
  260. package/node_modules/path-type/index.js +0 -43
  261. package/node_modules/path-type/license +0 -9
  262. package/node_modules/path-type/package.json +0 -45
  263. package/node_modules/path-type/readme.md +0 -72
  264. package/node_modules/picomatch/CHANGELOG.md +0 -136
  265. package/node_modules/picomatch/LICENSE +0 -21
  266. package/node_modules/picomatch/README.md +0 -708
  267. package/node_modules/picomatch/index.js +0 -3
  268. package/node_modules/picomatch/lib/constants.js +0 -179
  269. package/node_modules/picomatch/lib/parse.js +0 -1091
  270. package/node_modules/picomatch/lib/picomatch.js +0 -342
  271. package/node_modules/picomatch/lib/scan.js +0 -391
  272. package/node_modules/picomatch/lib/utils.js +0 -64
  273. package/node_modules/picomatch/package.json +0 -81
  274. package/node_modules/plimit-lit/LICENSE +0 -21
  275. package/node_modules/plimit-lit/README.md +0 -99
  276. package/node_modules/plimit-lit/dist/index.d.ts +0 -6
  277. package/node_modules/plimit-lit/dist/plimit-lit.cjs +0 -91
  278. package/node_modules/plimit-lit/dist/plimit-lit.modern.js +0 -91
  279. package/node_modules/plimit-lit/dist/plimit-lit.module.js +0 -91
  280. package/node_modules/plimit-lit/package.json +0 -55
  281. package/node_modules/queue-lit/LICENSE +0 -21
  282. package/node_modules/queue-lit/README.md +0 -93
  283. package/node_modules/queue-lit/dist/index.d.ts +0 -34
  284. package/node_modules/queue-lit/dist/queue-lit.cjs +0 -110
  285. package/node_modules/queue-lit/dist/queue-lit.modern.js +0 -110
  286. package/node_modules/queue-lit/dist/queue-lit.module.js +0 -110
  287. package/node_modules/queue-lit/package.json +0 -53
  288. package/node_modules/queue-microtask/LICENSE +0 -20
  289. package/node_modules/queue-microtask/README.md +0 -90
  290. package/node_modules/queue-microtask/index.d.ts +0 -2
  291. package/node_modules/queue-microtask/index.js +0 -9
  292. package/node_modules/queue-microtask/package.json +0 -55
  293. package/node_modules/readdirp/LICENSE +0 -21
  294. package/node_modules/readdirp/README.md +0 -122
  295. package/node_modules/readdirp/index.d.ts +0 -43
  296. package/node_modules/readdirp/index.js +0 -287
  297. package/node_modules/readdirp/package.json +0 -122
  298. package/node_modules/resolve-pkg-maps/LICENSE +0 -21
  299. package/node_modules/resolve-pkg-maps/README.md +0 -216
  300. package/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
  301. package/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
  302. package/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
  303. package/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
  304. package/node_modules/resolve-pkg-maps/package.json +0 -42
  305. package/node_modules/reusify/.github/dependabot.yml +0 -7
  306. package/node_modules/reusify/.github/workflows/ci.yml +0 -96
  307. package/node_modules/reusify/LICENSE +0 -22
  308. package/node_modules/reusify/README.md +0 -139
  309. package/node_modules/reusify/SECURITY.md +0 -15
  310. package/node_modules/reusify/benchmarks/createNoCodeFunction.js +0 -30
  311. package/node_modules/reusify/benchmarks/fib.js +0 -13
  312. package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +0 -38
  313. package/node_modules/reusify/eslint.config.js +0 -14
  314. package/node_modules/reusify/package.json +0 -50
  315. package/node_modules/reusify/reusify.d.ts +0 -14
  316. package/node_modules/reusify/reusify.js +0 -33
  317. package/node_modules/reusify/test.js +0 -66
  318. package/node_modules/reusify/tsconfig.json +0 -11
  319. package/node_modules/run-parallel/LICENSE +0 -20
  320. package/node_modules/run-parallel/README.md +0 -85
  321. package/node_modules/run-parallel/index.js +0 -51
  322. package/node_modules/run-parallel/package.json +0 -58
  323. package/node_modules/slash/index.d.ts +0 -25
  324. package/node_modules/slash/index.js +0 -11
  325. package/node_modules/slash/license +0 -9
  326. package/node_modules/slash/package.json +0 -35
  327. package/node_modules/slash/readme.md +0 -44
  328. package/node_modules/to-regex-range/LICENSE +0 -21
  329. package/node_modules/to-regex-range/README.md +0 -305
  330. package/node_modules/to-regex-range/index.js +0 -288
  331. package/node_modules/to-regex-range/package.json +0 -88
  332. package/node_modules/tsc-alias/LICENSE +0 -21
  333. package/node_modules/tsc-alias/README.md +0 -184
  334. package/node_modules/tsc-alias/dist/bin/index.d.ts +0 -2
  335. package/node_modules/tsc-alias/dist/bin/index.js +0 -39
  336. package/node_modules/tsc-alias/dist/bin/index.js.map +0 -1
  337. package/node_modules/tsc-alias/dist/helpers/config.d.ts +0 -5
  338. package/node_modules/tsc-alias/dist/helpers/config.js +0 -181
  339. package/node_modules/tsc-alias/dist/helpers/config.js.map +0 -1
  340. package/node_modules/tsc-alias/dist/helpers/index.d.ts +0 -3
  341. package/node_modules/tsc-alias/dist/helpers/index.js +0 -20
  342. package/node_modules/tsc-alias/dist/helpers/index.js.map +0 -1
  343. package/node_modules/tsc-alias/dist/helpers/path.d.ts +0 -3
  344. package/node_modules/tsc-alias/dist/helpers/path.js +0 -73
  345. package/node_modules/tsc-alias/dist/helpers/path.js.map +0 -1
  346. package/node_modules/tsc-alias/dist/helpers/replacers.d.ts +0 -4
  347. package/node_modules/tsc-alias/dist/helpers/replacers.js +0 -150
  348. package/node_modules/tsc-alias/dist/helpers/replacers.js.map +0 -1
  349. package/node_modules/tsc-alias/dist/index.d.ts +0 -8
  350. package/node_modules/tsc-alias/dist/index.js +0 -74
  351. package/node_modules/tsc-alias/dist/index.js.map +0 -1
  352. package/node_modules/tsc-alias/dist/interfaces.d.ts +0 -87
  353. package/node_modules/tsc-alias/dist/interfaces.js +0 -3
  354. package/node_modules/tsc-alias/dist/interfaces.js.map +0 -1
  355. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.d.ts +0 -2
  356. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.js +0 -33
  357. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.js.map +0 -1
  358. package/node_modules/tsc-alias/dist/replacers/default.replacer.d.ts +0 -2
  359. package/node_modules/tsc-alias/dist/replacers/default.replacer.js +0 -67
  360. package/node_modules/tsc-alias/dist/replacers/default.replacer.js.map +0 -1
  361. package/node_modules/tsc-alias/dist/utils/import-path-resolver.d.ts +0 -19
  362. package/node_modules/tsc-alias/dist/utils/import-path-resolver.js +0 -87
  363. package/node_modules/tsc-alias/dist/utils/import-path-resolver.js.map +0 -1
  364. package/node_modules/tsc-alias/dist/utils/index.d.ts +0 -4
  365. package/node_modules/tsc-alias/dist/utils/index.js +0 -21
  366. package/node_modules/tsc-alias/dist/utils/index.js.map +0 -1
  367. package/node_modules/tsc-alias/dist/utils/output.d.ts +0 -11
  368. package/node_modules/tsc-alias/dist/utils/output.js +0 -44
  369. package/node_modules/tsc-alias/dist/utils/output.js.map +0 -1
  370. package/node_modules/tsc-alias/dist/utils/path-cache.d.ts +0 -12
  371. package/node_modules/tsc-alias/dist/utils/path-cache.js +0 -74
  372. package/node_modules/tsc-alias/dist/utils/path-cache.js.map +0 -1
  373. package/node_modules/tsc-alias/dist/utils/trie.d.ts +0 -9
  374. package/node_modules/tsc-alias/dist/utils/trie.js +0 -81
  375. package/node_modules/tsc-alias/dist/utils/trie.js.map +0 -1
  376. package/node_modules/tsc-alias/package.json +0 -66
  377. package/node_modules/typescript/LICENSE.txt +0 -55
  378. package/node_modules/typescript/README.md +0 -50
  379. package/node_modules/typescript/SECURITY.md +0 -41
  380. package/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
  381. package/node_modules/typescript/bin/tsc +0 -2
  382. package/node_modules/typescript/bin/tsserver +0 -2
  383. package/node_modules/typescript/lib/_tsc.js +0 -132810
  384. package/node_modules/typescript/lib/_tsserver.js +0 -659
  385. package/node_modules/typescript/lib/_typingsInstaller.js +0 -222
  386. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -2105
  387. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -2105
  388. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -2105
  389. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -2105
  390. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -2105
  391. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -2105
  392. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -2105
  393. package/node_modules/typescript/lib/lib.d.ts +0 -22
  394. package/node_modules/typescript/lib/lib.decorators.d.ts +0 -384
  395. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -22
  396. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -41
  397. package/node_modules/typescript/lib/lib.dom.d.ts +0 -29610
  398. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -493
  399. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -147
  400. package/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -597
  401. package/node_modules/typescript/lib/lib.es2015.d.ts +0 -28
  402. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -77
  403. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -605
  404. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -81
  405. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -128
  406. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -144
  407. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -46
  408. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -326
  409. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -116
  410. package/node_modules/typescript/lib/lib.es2016.d.ts +0 -21
  411. package/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -23
  412. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -31
  413. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +0 -21
  414. package/node_modules/typescript/lib/lib.es2017.d.ts +0 -26
  415. package/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -31
  416. package/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -23
  417. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -44
  418. package/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -49
  419. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -135
  420. package/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -45
  421. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -53
  422. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -77
  423. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -53
  424. package/node_modules/typescript/lib/lib.es2018.d.ts +0 -24
  425. package/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -24
  426. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -83
  427. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -30
  428. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -37
  429. package/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -79
  430. package/node_modules/typescript/lib/lib.es2019.d.ts +0 -24
  431. package/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -24
  432. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -23
  433. package/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -33
  434. package/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -37
  435. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -24
  436. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -765
  437. package/node_modules/typescript/lib/lib.es2020.d.ts +0 -27
  438. package/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -42
  439. package/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -24
  440. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -474
  441. package/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -28
  442. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -47
  443. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -99
  444. package/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -44
  445. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -41
  446. package/node_modules/typescript/lib/lib.es2021.d.ts +0 -23
  447. package/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -24
  448. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -166
  449. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -48
  450. package/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -33
  451. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -78
  452. package/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -121
  453. package/node_modules/typescript/lib/lib.es2022.d.ts +0 -25
  454. package/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -75
  455. package/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -24
  456. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -121
  457. package/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -26
  458. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -39
  459. package/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -25
  460. package/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -924
  461. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -21
  462. package/node_modules/typescript/lib/lib.es2023.d.ts +0 -22
  463. package/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -24
  464. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -56
  465. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +0 -65
  466. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +0 -29
  467. package/node_modules/typescript/lib/lib.es2024.d.ts +0 -26
  468. package/node_modules/typescript/lib/lib.es2024.full.d.ts +0 -24
  469. package/node_modules/typescript/lib/lib.es2024.object.d.ts +0 -29
  470. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +0 -35
  471. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +0 -25
  472. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +0 -68
  473. package/node_modules/typescript/lib/lib.es2024.string.d.ts +0 -29
  474. package/node_modules/typescript/lib/lib.es5.d.ts +0 -4594
  475. package/node_modules/typescript/lib/lib.es6.d.ts +0 -23
  476. package/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -35
  477. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -96
  478. package/node_modules/typescript/lib/lib.esnext.d.ts +0 -27
  479. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -28
  480. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -193
  481. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +0 -443
  482. package/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -24
  483. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -21
  484. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +0 -148
  485. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -34
  486. package/node_modules/typescript/lib/lib.scripthost.d.ts +0 -322
  487. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -41
  488. package/node_modules/typescript/lib/lib.webworker.d.ts +0 -9894
  489. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -23
  490. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -287
  491. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -2105
  492. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -2105
  493. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -2105
  494. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -2105
  495. package/node_modules/typescript/lib/tsc.js +0 -8
  496. package/node_modules/typescript/lib/tsserver.js +0 -8
  497. package/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
  498. package/node_modules/typescript/lib/tsserverlibrary.js +0 -21
  499. package/node_modules/typescript/lib/typesMap.json +0 -497
  500. package/node_modules/typescript/lib/typescript.d.ts +0 -11399
  501. package/node_modules/typescript/lib/typescript.js +0 -199120
  502. package/node_modules/typescript/lib/typingsInstaller.js +0 -8
  503. package/node_modules/typescript/lib/watchGuard.js +0 -53
  504. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -2105
  505. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -2105
  506. package/node_modules/typescript/package.json +0 -120
@@ -1,181 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.resolveTsConfigExtendsPath = exports.normalizeTsConfigExtendsOption = exports.loadConfig = exports.prepareConfig = void 0;
13
- const fs_1 = require("fs");
14
- const get_tsconfig_1 = require("get-tsconfig");
15
- const mylas_1 = require("mylas");
16
- const path_1 = require("path");
17
- const utils_1 = require("../utils");
18
- const replacers_1 = require("./replacers");
19
- const normalizePath = require("normalize-path");
20
- function prepareConfig(options) {
21
- var _a, _b, _c, _d, _e, _f;
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const output = (_a = options.output) !== null && _a !== void 0 ? _a : new utils_1.Output(options.verbose, options.debug);
24
- const configFile = !options.configFile
25
- ? (0, path_1.resolve)(process.cwd(), 'tsconfig.json')
26
- : !(0, path_1.isAbsolute)(options.configFile)
27
- ? (0, path_1.resolve)(process.cwd(), options.configFile)
28
- : options.configFile;
29
- output.assert((0, fs_1.existsSync)(configFile), `Invalid file path => ${configFile}`);
30
- const { baseUrl = '', outDir, declarationDir, paths, replacers, resolveFullPaths, verbose, fileExtensions } = (0, exports.loadConfig)(configFile, output);
31
- if ((_b = options === null || options === void 0 ? void 0 : options.fileExtensions) === null || _b === void 0 ? void 0 : _b.inputGlob) {
32
- fileExtensions.inputGlob = options.fileExtensions.inputGlob;
33
- }
34
- if ((_c = options === null || options === void 0 ? void 0 : options.fileExtensions) === null || _c === void 0 ? void 0 : _c.outputCheck) {
35
- fileExtensions.outputCheck = options.fileExtensions.outputCheck;
36
- }
37
- output.verbose = verbose;
38
- if (options.resolveFullPaths || resolveFullPaths) {
39
- output.debug('resolveFullPaths is active');
40
- options.resolveFullPaths = true;
41
- }
42
- const _outDir = (_d = options.outDir) !== null && _d !== void 0 ? _d : outDir;
43
- if (declarationDir && _outDir !== declarationDir) {
44
- (_e = options.declarationDir) !== null && _e !== void 0 ? _e : (options.declarationDir = declarationDir);
45
- }
46
- output.assert(_outDir, 'compilerOptions.outDir is not set');
47
- const configDir = normalizePath((0, path_1.dirname)(configFile));
48
- const projectConfig = {
49
- configFile: configFile,
50
- baseUrl: baseUrl,
51
- outDir: _outDir,
52
- configDir: configDir,
53
- outPath: _outDir,
54
- confDirParentFolderName: (0, path_1.basename)(configDir),
55
- hasExtraModule: false,
56
- configDirInOutPath: null,
57
- relConfDirPathInOutPath: null,
58
- pathCache: new utils_1.PathCache(!options.watch, fileExtensions === null || fileExtensions === void 0 ? void 0 : fileExtensions.outputCheck),
59
- inputGlob: (fileExtensions === null || fileExtensions === void 0 ? void 0 : fileExtensions.inputGlob) || '{mjs,cjs,js,jsx,d.{mts,cts,ts,tsx}}'
60
- };
61
- output.debug('loaded project config:', projectConfig);
62
- const config = Object.assign(Object.assign({}, projectConfig), { output: output, aliasTrie: (_f = options.aliasTrie) !== null && _f !== void 0 ? _f : utils_1.TrieNode.buildAliasTrie(projectConfig, paths), replacers: [] });
63
- output.debug('loaded full config:', config);
64
- yield (0, replacers_1.importReplacers)(config, replacers, options.replacers);
65
- return config;
66
- });
67
- }
68
- exports.prepareConfig = prepareConfig;
69
- function replaceConfigDirPlaceholder(path, configDir) {
70
- return path.replace(/\$\{configDir\}/g, configDir);
71
- }
72
- const loadConfig = (file, output, baseConfigDir = null) => {
73
- var _a, _b, _c, _d, _e;
74
- if (!(0, fs_1.existsSync)(file)) {
75
- output.error(`File ${file} not found`, true);
76
- }
77
- output.debug('Loading config file:', file);
78
- const tsConfig = (0, get_tsconfig_1.parseTsconfig)(file);
79
- const baseTsConfig = mylas_1.Json.loadS(file, true);
80
- const { compilerOptions: { baseUrl, outDir, declarationDir, paths } = {
81
- baseUrl: undefined,
82
- outDir: undefined,
83
- declarationDir: undefined,
84
- paths: undefined
85
- }, 'tsc-alias': tscAliasConfig } = tsConfig;
86
- const configDir = (0, path_1.dirname)(file);
87
- output.debug('configDir', configDir);
88
- const config = {};
89
- if (baseUrl) {
90
- if (baseConfigDir !== null) {
91
- config.baseUrl = replaceConfigDirPlaceholder(baseUrl, baseConfigDir);
92
- }
93
- else {
94
- config.baseUrl = baseUrl;
95
- }
96
- }
97
- if (outDir || ((_a = baseTsConfig === null || baseTsConfig === void 0 ? void 0 : baseTsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.outDir)) {
98
- let replacedOutDir = outDir || ((_b = baseTsConfig === null || baseTsConfig === void 0 ? void 0 : baseTsConfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.outDir);
99
- if (baseConfigDir !== null) {
100
- replacedOutDir = replaceConfigDirPlaceholder(outDir, baseConfigDir);
101
- }
102
- config.outDir = (0, path_1.isAbsolute)(replacedOutDir)
103
- ? replacedOutDir
104
- : (0, path_1.join)(configDir, replacedOutDir);
105
- }
106
- if (paths) {
107
- if (baseConfigDir !== null) {
108
- for (const key in paths) {
109
- paths[key] = paths[key].map((path) => replaceConfigDirPlaceholder(path, baseConfigDir));
110
- }
111
- }
112
- config.paths = paths;
113
- }
114
- if (declarationDir) {
115
- let replacedDeclarationDir = declarationDir;
116
- if (baseConfigDir !== null) {
117
- replacedDeclarationDir = replaceConfigDirPlaceholder(declarationDir, baseConfigDir);
118
- }
119
- config.declarationDir = (0, path_1.isAbsolute)(replacedDeclarationDir)
120
- ? replacedDeclarationDir
121
- : (0, path_1.join)(configDir, replacedDeclarationDir);
122
- }
123
- if (tscAliasConfig === null || tscAliasConfig === void 0 ? void 0 : tscAliasConfig.replacers) {
124
- config.replacers = tscAliasConfig.replacers;
125
- }
126
- if (tscAliasConfig === null || tscAliasConfig === void 0 ? void 0 : tscAliasConfig.resolveFullPaths) {
127
- config.resolveFullPaths = tscAliasConfig.resolveFullPaths;
128
- }
129
- if (tscAliasConfig === null || tscAliasConfig === void 0 ? void 0 : tscAliasConfig.verbose) {
130
- config.verbose = tscAliasConfig.verbose;
131
- }
132
- config.fileExtensions = (_c = tscAliasConfig === null || tscAliasConfig === void 0 ? void 0 : tscAliasConfig.fileExtensions) !== null && _c !== void 0 ? _c : {};
133
- const replacerFile = (_e = (_d = config.replacers) === null || _d === void 0 ? void 0 : _d.pathReplacer) === null || _e === void 0 ? void 0 : _e.file;
134
- if (replacerFile) {
135
- config.replacers.pathReplacer.file = (0, path_1.join)(configDir, replacerFile);
136
- }
137
- output.debug('loaded config (from file):', config);
138
- return config;
139
- };
140
- exports.loadConfig = loadConfig;
141
- function normalizeTsConfigExtendsOption(ext, file) {
142
- if (!ext)
143
- return [];
144
- const configDir = (0, path_1.dirname)(file);
145
- const normExts = (Array.isArray(ext) ? ext : [ext]).map((e) => e.startsWith('.')
146
- ? (0, path_1.join)(configDir, e.endsWith('.json') ? e : `${e}.json`)
147
- : resolveTsConfigExtendsPath(e, file));
148
- return normExts;
149
- }
150
- exports.normalizeTsConfigExtendsOption = normalizeTsConfigExtendsOption;
151
- function resolveTsConfigExtendsPath(ext, file) {
152
- const tsConfigDir = (0, path_1.dirname)(file);
153
- const node_modules = mylas_1.Dir.nodeModules({ cwd: tsConfigDir });
154
- const targetPaths = node_modules.map((v) => (0, path_1.join)(tsConfigDir, v, ext));
155
- for (const targetPath of targetPaths) {
156
- if (ext.endsWith('.json')) {
157
- if ((0, fs_1.existsSync)(targetPath)) {
158
- return targetPath;
159
- }
160
- else {
161
- continue;
162
- }
163
- }
164
- let isDirectory = false;
165
- try {
166
- const stats = (0, fs_1.lstatSync)(targetPath);
167
- isDirectory = stats.isDirectory() || stats.isSymbolicLink();
168
- }
169
- catch (err) { }
170
- if (isDirectory) {
171
- return (0, path_1.join)(targetPath, 'tsconfig.json');
172
- }
173
- else {
174
- if ((0, fs_1.existsSync)(`${targetPath}.json`)) {
175
- return `${targetPath}.json`;
176
- }
177
- }
178
- }
179
- }
180
- exports.resolveTsConfigExtendsPath = resolveTsConfigExtendsPath;
181
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/helpers/config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,2BAA2C;AAC3C,+CAAmE;AACnE,iCAAkC;AAClC,+BAAoE;AASpE,oCAAuD;AACvD,2CAA8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AG,CAAC,OAAO,CAAC;QACxD,CAAC,CAAC,0BAA0B,CAAC,CAAC,EAAE,IAAI,CAAC,CACxC,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAZD,wEAYC;AAQD,SAAgB,0BAA0B,CAAC,GAAW,EAAE,IAAY;IAClE,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;IAClC,MAAM,YAAY,GAAa,WAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAGvE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAEzB,IAAI,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE;gBAC1B,OAAO,UAAU,CAAC;aACnB;iBAAM;gBACL,SAAS;aACV;SACF;QACD,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI;YACF,MAAM,KAAK,GAAG,IAAA,cAAS,EAAC,UAAU,CAAC,CAAC;YACpC,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;SAC7D;QAAC,OAAO,GAAG,EAAE,GAAE;QAChB,IAAI,WAAW,EAAE;YACf,OAAO,IAAA,WAAI,EAAC,UAAU,EAAE,eAAe,CAAC,CAAC;SAC1C;aAAM;YAEL,IAAI,IAAA,eAAU,EAAC,GAAG,UAAU,OAAO,CAAC,EAAE;gBACpC,OAAO,GAAG,UAAU,OAAO,CAAC;aAC7B;SACF;KACF;AACH,CAAC;AA7BD,gEA6BC","sourcesContent":["/**\n * @file\n *\n * This file has all helperfunctions related to configuration.\n */\n\n/** */\nimport { existsSync, lstatSync } from 'fs';\nimport { parseTsconfig, TsConfigJsonResolved } from 'get-tsconfig';\nimport { Dir, Json } from 'mylas';\nimport { basename, dirname, isAbsolute, join, resolve } from 'path';\nimport {\n IConfig,\n IOutput,\n IProjectConfig,\n ITSCAliasConfig,\n ITSConfig,\n ReplaceTscAliasPathsOptions\n} from '../interfaces';\nimport { Output, PathCache, TrieNode } from '../utils';\nimport { importReplacers } from './replacers';\nimport normalizePath = require('normalize-path');\n\n/**\n * prepareConfig prepares a IConfig object for tsc-alias to be used.\n * @param {ReplaceTscAliasPathsOptions} options options that are used to prepare a config object.\n * @returns {Promise<IConfig>} a promise of a IConfig object.\n */\nexport async function prepareConfig(\n options: ReplaceTscAliasPathsOptions\n): Promise<IConfig> {\n const output = options.output ?? new Output(options.verbose, options.debug);\n\n const configFile = !options.configFile\n ? resolve(process.cwd(), 'tsconfig.json')\n : !isAbsolute(options.configFile)\n ? resolve(process.cwd(), options.configFile)\n : options.configFile;\n\n output.assert(existsSync(configFile), `Invalid file path => ${configFile}`);\n\n const {\n baseUrl = '',\n outDir,\n declarationDir,\n paths,\n replacers,\n resolveFullPaths,\n verbose,\n fileExtensions\n } = loadConfig(configFile, output);\n\n if (options?.fileExtensions?.inputGlob) {\n fileExtensions.inputGlob = options.fileExtensions.inputGlob;\n }\n if (options?.fileExtensions?.outputCheck) {\n fileExtensions.outputCheck = options.fileExtensions.outputCheck;\n }\n\n output.verbose = verbose;\n\n if (options.resolveFullPaths || resolveFullPaths) {\n output.debug('resolveFullPaths is active');\n options.resolveFullPaths = true;\n }\n\n const _outDir = options.outDir ?? outDir;\n if (declarationDir && _outDir !== declarationDir) {\n options.declarationDir ??= declarationDir;\n }\n\n output.assert(_outDir, 'compilerOptions.outDir is not set');\n\n const configDir: string = normalizePath(dirname(configFile));\n\n // config with project details and paths\n const projectConfig: IProjectConfig = {\n configFile: configFile,\n baseUrl: baseUrl,\n outDir: _outDir,\n configDir: configDir,\n outPath: _outDir,\n confDirParentFolderName: basename(configDir),\n hasExtraModule: false,\n configDirInOutPath: null,\n relConfDirPathInOutPath: null,\n pathCache: new PathCache(!options.watch, fileExtensions?.outputCheck),\n inputGlob:\n fileExtensions?.inputGlob || '{mjs,cjs,js,jsx,d.{mts,cts,ts,tsx}}'\n };\n output.debug('loaded project config:', projectConfig);\n\n const config: IConfig = {\n ...projectConfig,\n output: output,\n aliasTrie:\n options.aliasTrie ?? TrieNode.buildAliasTrie(projectConfig, paths),\n replacers: []\n };\n output.debug('loaded full config:', config);\n\n // Import replacers.\n await importReplacers(config, replacers, options.replacers);\n return config;\n}\n\nfunction replaceConfigDirPlaceholder(path: string, configDir: string) {\n return path.replace(/\\$\\{configDir\\}/g, configDir);\n}\n\n/**\n * loadConfig loads a config file from fs.\n * @param {string} file file path to the config file that will be loaded.\n * @param {IOutput} output the output instance to log error to.\n * @returns {ITSConfig} a ITSConfig object\n */\nexport const loadConfig = (\n file: string,\n output: IOutput,\n baseConfigDir: string | null = null\n): ITSConfig => {\n if (!existsSync(file)) {\n output.error(`File ${file} not found`, true);\n }\n output.debug('Loading config file:', file);\n\n const tsConfig = parseTsconfig(file);\n const baseTsConfig = Json.loadS<TsConfigJsonResolved>(file, true);\n const {\n compilerOptions: { baseUrl, outDir, declarationDir, paths } = {\n baseUrl: undefined,\n outDir: undefined,\n declarationDir: undefined,\n paths: undefined\n },\n 'tsc-alias': tscAliasConfig\n } = tsConfig as TsConfigJsonResolved & { 'tsc-alias': ITSCAliasConfig };\n\n const configDir = dirname(file);\n output.debug('configDir', configDir);\n const config: ITSConfig = {};\n\n if (baseUrl) {\n if (baseConfigDir !== null) {\n config.baseUrl = replaceConfigDirPlaceholder(baseUrl, baseConfigDir);\n } else {\n config.baseUrl = baseUrl;\n }\n }\n if (outDir || baseTsConfig?.compilerOptions?.outDir) {\n let replacedOutDir = outDir || baseTsConfig?.compilerOptions?.outDir;\n if (baseConfigDir !== null) {\n replacedOutDir = replaceConfigDirPlaceholder(outDir, baseConfigDir);\n }\n config.outDir = isAbsolute(replacedOutDir)\n ? replacedOutDir\n : join(configDir, replacedOutDir);\n }\n if (paths) {\n if (baseConfigDir !== null) {\n for (const key in paths) {\n paths[key] = paths[key].map((path) =>\n replaceConfigDirPlaceholder(path, baseConfigDir)\n );\n }\n }\n config.paths = paths;\n }\n if (declarationDir) {\n let replacedDeclarationDir = declarationDir;\n if (baseConfigDir !== null) {\n replacedDeclarationDir = replaceConfigDirPlaceholder(\n declarationDir,\n baseConfigDir\n );\n }\n config.declarationDir = isAbsolute(replacedDeclarationDir)\n ? replacedDeclarationDir\n : join(configDir, replacedDeclarationDir);\n }\n if (tscAliasConfig?.replacers) {\n config.replacers = tscAliasConfig.replacers;\n }\n if (tscAliasConfig?.resolveFullPaths) {\n config.resolveFullPaths = tscAliasConfig.resolveFullPaths;\n }\n if (tscAliasConfig?.verbose) {\n config.verbose = tscAliasConfig.verbose;\n }\n config.fileExtensions = tscAliasConfig?.fileExtensions ?? {};\n\n const replacerFile = config.replacers?.pathReplacer?.file;\n\n if (replacerFile) {\n config.replacers.pathReplacer.file = join(configDir, replacerFile);\n }\n\n output.debug('loaded config (from file):', config);\n\n return config;\n};\n\n/**\n * normalizeTsConfigExtendsOption normalizes tsconfig extends option to a directly loadable path array\n * @param { string|string[] } ext\n * @param { string } file\n * @returns {string[]}\n */\nexport function normalizeTsConfigExtendsOption(\n ext: string | string[],\n file: string\n): string[] {\n if (!ext) return [];\n const configDir = dirname(file);\n const normExts = (Array.isArray(ext) ? ext : [ext]).map((e) =>\n e.startsWith('.')\n ? join(configDir, e.endsWith('.json') ? e : `${e}.json`)\n : resolveTsConfigExtendsPath(e, file)\n );\n return normExts;\n}\n\n/**\n * resolveTsConfigExtendsPath resolves the path to the config file that is being inherited.\n * @param {string} ext the value of the extends field in the loaded config file.\n * @param {string} file file path to the config file that was loaded.\n * @returns {string} a file path to the config file that is being inherited.\n */\nexport function resolveTsConfigExtendsPath(ext: string, file: string): string {\n const tsConfigDir = dirname(file);\n const node_modules: string[] = Dir.nodeModules({ cwd: tsConfigDir }); // Getting all node_modules directories.\n const targetPaths = node_modules.map((v) => join(tsConfigDir, v, ext)); // Mapping node_modules to target paths.\n\n // Recursively checking ancestor directories for tsconfig.\n for (const targetPath of targetPaths) {\n if (ext.endsWith('.json')) {\n // Check if the file exists.\n if (existsSync(targetPath)) {\n return targetPath;\n } else {\n continue; // Continue checking when ext is a file but not yet found.\n }\n }\n let isDirectory = false;\n try {\n const stats = lstatSync(targetPath);\n isDirectory = stats.isDirectory() || stats.isSymbolicLink();\n } catch (err) {}\n if (isDirectory) {\n return join(targetPath, 'tsconfig.json');\n } else {\n // When target is not a file nor directory check with '.json' extension.\n if (existsSync(`${targetPath}.json`)) {\n return `${targetPath}.json`;\n }\n }\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- export * from './config';
2
- export * from './path';
3
- export * from './replacers';
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config"), exports);
18
- __exportStar(require("./path"), exports);
19
- __exportStar(require("./replacers"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,8CAA4B","sourcesContent":["export * from './config';\nexport * from './path';\nexport * from './replacers';\n"]}
@@ -1,3 +0,0 @@
1
- import { AliasPath, IProjectConfig } from '../interfaces';
2
- export declare function relativeOutPathToConfigDir(config: IProjectConfig): void;
3
- export declare function findBasePathOfAlias(config: IProjectConfig): (path: string) => AliasPath;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findBasePathOfAlias = exports.relativeOutPathToConfigDir = void 0;
4
- const normalizePath = require("normalize-path");
5
- const globby_1 = require("globby");
6
- const path_1 = require("path");
7
- function getProjectDirPathInOutDir(outDir, projectDir) {
8
- const posixOutput = outDir.replace(/\\/g, '/');
9
- const dirs = (0, globby_1.sync)([
10
- `${posixOutput}/**/${projectDir}`,
11
- `!${posixOutput}/**/${projectDir}/**/${projectDir}`,
12
- `!${posixOutput}/**/node_modules`
13
- ], {
14
- dot: true,
15
- onlyDirectories: true
16
- });
17
- return dirs.reduce((prev, curr) => prev.split('/').length > curr.split('/').length ? prev : curr, dirs[0]);
18
- }
19
- function relativeOutPathToConfigDir(config) {
20
- config.configDirInOutPath = getProjectDirPathInOutDir(config.outPath, config.confDirParentFolderName);
21
- if (config.configDirInOutPath) {
22
- config.hasExtraModule = true;
23
- const stepsbackPath = (0, path_1.relative)(config.configDirInOutPath, config.outPath);
24
- const splitStepBackPath = normalizePath(stepsbackPath).split('/');
25
- const nbOfStepBack = splitStepBackPath.length;
26
- const splitConfDirInOutPath = config.configDirInOutPath.split('/');
27
- let i = 1;
28
- const splitRelPath = [];
29
- while (i <= nbOfStepBack) {
30
- splitRelPath.unshift(splitConfDirInOutPath[splitConfDirInOutPath.length - i]);
31
- i++;
32
- }
33
- config.relConfDirPathInOutPath = splitRelPath.join('/');
34
- }
35
- }
36
- exports.relativeOutPathToConfigDir = relativeOutPathToConfigDir;
37
- function findBasePathOfAlias(config) {
38
- return (path) => {
39
- const aliasPath = { path };
40
- if ((0, path_1.normalize)(aliasPath.path).includes('..')) {
41
- const tempBasePath = normalizePath((0, path_1.normalize)(`${config.outDir}/` +
42
- `${config.hasExtraModule && config.relConfDirPathInOutPath
43
- ? config.relConfDirPathInOutPath
44
- : ''}/${config.baseUrl}`));
45
- const absoluteBasePath = normalizePath((0, path_1.normalize)(`${tempBasePath}/${aliasPath.path}`));
46
- if (config.pathCache.existsResolvedAlias(absoluteBasePath)) {
47
- aliasPath.isExtra = false;
48
- aliasPath.basePath = tempBasePath;
49
- }
50
- else {
51
- aliasPath.isExtra = true;
52
- aliasPath.basePath = absoluteBasePath;
53
- }
54
- return aliasPath;
55
- }
56
- if (aliasPath.path.match(/^(\.\/|)node_modules/g)) {
57
- aliasPath.basePath = (0, path_1.resolve)(config.baseUrl, 'node_modules');
58
- aliasPath.isExtra = false;
59
- return aliasPath;
60
- }
61
- if (config.hasExtraModule) {
62
- aliasPath.isExtra = false;
63
- aliasPath.basePath = normalizePath((0, path_1.normalize)(`${config.outDir}/` +
64
- `${config.relConfDirPathInOutPath}/${config.baseUrl}`));
65
- return aliasPath;
66
- }
67
- aliasPath.basePath = config.outDir;
68
- aliasPath.isExtra = false;
69
- return aliasPath;
70
- };
71
- }
72
- exports.findBasePathOfAlias = findBasePathOfAlias;
73
- //# sourceMappingURL=path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/helpers/path.ts"],"names":[],"mappings":";;;AAOA,gDAAiD;AACjD,mCAA8B;AAC9B,+BAAoD;AASpD,SAAS,yBAAyB,CAChC,MAAc,EACd,UAAkB;IAElB,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,IAAA,aAAI,EACf;QACE,GAAG,WAAW,OAAO,UAAU,EAAE;QACjC,IAAI,WAAW,OAAO,UAAU,OAAO,UAAU,EAAE;QACnD,IAAI,WAAW,kBAAkB;KAClC,EACD;QACE,GAAG,EAAE,IAAI;QACT,eAAe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CAAC,MAAM,GAAG;gBACjB,GAAG,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,OAAO,EAAE,CACxD,CACF,CAAC;YACF,OAAO,SAAS,CAAC;SAClB;QAED,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;QACnC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AA5DD,kDA4DC","sourcesContent":["/**\n * @file\n *\n * This file has all helperfunctions related to path resolution.\n */\n\n/** */\nimport normalizePath = require('normalize-path');\nimport { sync } from 'globby';\nimport { normalize, relative, resolve } from 'path';\nimport { AliasPath, IProjectConfig } from '../interfaces';\n\n/**\n * getProjectDirPathInOutDir finds the configDirInOutPath.\n * @param {string} outDir outDir loaded from tsconfig.\n * @param {string} projectDir projectDir loaded from tsconfig.\n * @returns {string} the configDirInOutPath.\n */\nfunction getProjectDirPathInOutDir(\n outDir: string,\n projectDir: string\n): string | undefined {\n const posixOutput = outDir.replace(/\\\\/g, '/');\n const dirs = sync(\n [\n `${posixOutput}/**/${projectDir}`,\n `!${posixOutput}/**/${projectDir}/**/${projectDir}`,\n `!${posixOutput}/**/node_modules`\n ],\n {\n dot: true,\n onlyDirectories: true\n }\n );\n\n // Find the longest path\n return dirs.reduce(\n (prev, curr) =>\n prev.split('/').length > curr.split('/').length ? prev : curr,\n dirs[0]\n );\n}\n\n/**\n * relativeOutPathToConfigDir\n * Finds relative path access of configDir in outPath\n */\nexport function relativeOutPathToConfigDir(config: IProjectConfig) {\n config.configDirInOutPath = getProjectDirPathInOutDir(\n config.outPath,\n config.confDirParentFolderName\n );\n\n // Find relative path access of configDir in outPath\n if (config.configDirInOutPath) {\n config.hasExtraModule = true;\n const stepsbackPath = relative(config.configDirInOutPath, config.outPath);\n const splitStepBackPath = normalizePath(stepsbackPath).split('/');\n const nbOfStepBack = splitStepBackPath.length;\n const splitConfDirInOutPath = config.configDirInOutPath.split('/');\n\n let i = 1;\n const splitRelPath: string[] = [];\n while (i <= nbOfStepBack) {\n splitRelPath.unshift(\n splitConfDirInOutPath[splitConfDirInOutPath.length - i]\n );\n i++;\n }\n config.relConfDirPathInOutPath = splitRelPath.join('/');\n }\n}\n\n/**\n * findBasePathOfAlias finds a basepath for every AliasPath.\n * And checks if isExtra should be true or false.\n * @param {IProjectConfig} config config object with all config values.\n */\nexport function findBasePathOfAlias(config: IProjectConfig) {\n return (path: string) => {\n const aliasPath = { path } as AliasPath;\n\n // If it's an alias that references a file outside the baseUrl\n if (normalize(aliasPath.path).includes('..')) {\n const tempBasePath = normalizePath(\n normalize(\n `${config.outDir}/` +\n `${\n config.hasExtraModule && config.relConfDirPathInOutPath\n ? config.relConfDirPathInOutPath\n : ''\n }/${config.baseUrl}`\n )\n );\n\n const absoluteBasePath = normalizePath(\n normalize(`${tempBasePath}/${aliasPath.path}`)\n );\n\n if (config.pathCache.existsResolvedAlias(absoluteBasePath)) {\n aliasPath.isExtra = false;\n aliasPath.basePath = tempBasePath;\n } else {\n aliasPath.isExtra = true;\n aliasPath.basePath = absoluteBasePath;\n }\n\n return aliasPath;\n }\n\n /**\n * If the alias refers to a file in the node_modules folder\n * located at the same level of baseUrl.\n * Because typescript will not include the node_modules\n * folder in the output folder (outDir).\n */\n if (aliasPath.path.match(/^(\\.\\/|)node_modules/g)) {\n aliasPath.basePath = resolve(config.baseUrl, 'node_modules');\n aliasPath.isExtra = false;\n return aliasPath;\n }\n\n // If the project references another external project\n if (config.hasExtraModule) {\n aliasPath.isExtra = false;\n aliasPath.basePath = normalizePath(\n normalize(\n `${config.outDir}/` +\n `${config.relConfDirPathInOutPath}/${config.baseUrl}`\n )\n );\n return aliasPath;\n }\n\n aliasPath.basePath = config.outDir;\n aliasPath.isExtra = false;\n return aliasPath;\n };\n}\n"]}
@@ -1,4 +0,0 @@
1
- import { IConfig, ReplacerOptions } from '../interfaces';
2
- export declare function importReplacers(config: IConfig, replacers: ReplacerOptions, cmdReplacers?: string[]): Promise<void>;
3
- export declare function replaceAlias(config: IConfig, file: string, resolveFullPath?: boolean, resolveFullExtension?: string): Promise<boolean>;
4
- export declare function replaceAliasString(config: IConfig, file: string, code: string, resolveFullPath?: boolean, resolveFullExtension?: string): string;
@@ -1,150 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __asyncValues = (this && this.__asyncValues) || function (o) {
12
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
- var m = o[Symbol.asyncIterator], i;
14
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.replaceAliasString = exports.replaceAlias = exports.importReplacers = void 0;
20
- const fs_1 = require("fs");
21
- const mylas_1 = require("mylas");
22
- const path_1 = require("path");
23
- const utils_1 = require("../utils");
24
- const normalizePath = require("normalize-path");
25
- function importReplacers(config, replacers, cmdReplacers) {
26
- var _a, e_1, _b, _c;
27
- var _d;
28
- return __awaiter(this, void 0, void 0, function* () {
29
- var _e;
30
- config.output.debug('Started loading replacers');
31
- const dir = process.cwd();
32
- const node_modules = mylas_1.Dir.nodeModules({ cwd: dir });
33
- config.output.debug('Found node_modules:', node_modules);
34
- const defaultReplacers = {
35
- default: {
36
- enabled: true
37
- },
38
- 'base-url': {
39
- enabled: !!config.baseUrl
40
- }
41
- };
42
- let merged = Object.assign(Object.assign({}, defaultReplacers), replacers);
43
- config.output.debug('Added replacers to list from command-line filepaths:', cmdReplacers);
44
- cmdReplacers === null || cmdReplacers === void 0 ? void 0 : cmdReplacers.forEach((v) => {
45
- merged[v] = {
46
- enabled: true,
47
- file: v
48
- };
49
- });
50
- config.output.debug('Reading replacers config');
51
- const entries = Object.entries(merged);
52
- try {
53
- for (var _f = true, entries_1 = __asyncValues(entries), entries_1_1; entries_1_1 = yield entries_1.next(), _a = entries_1_1.done, !_a;) {
54
- _c = entries_1_1.value;
55
- _f = false;
56
- try {
57
- const replacer = _c;
58
- if (replacer[1].enabled) {
59
- if (Object.keys(defaultReplacers).includes(replacer[0])) {
60
- config.output.debug('Loading default replacer:', replacer);
61
- const replacerModule = yield (_e = `../replacers/${replacer[0]}.replacer`, Promise.resolve().then(() => require(_e)));
62
- config.replacers.push(replacerModule.default);
63
- }
64
- const file = (_d = replacer[1]) === null || _d === void 0 ? void 0 : _d.file;
65
- if (!file) {
66
- config.output.debug('Replacer has no file:', replacer);
67
- continue;
68
- }
69
- const tryImportReplacer = (targetPath) => __awaiter(this, void 0, void 0, function* () {
70
- var _j;
71
- const replacerModule = yield (_j = targetPath, Promise.resolve().then(() => require(_j)));
72
- config.output.debug('Imported replacerModule:', replacerModule);
73
- const replacerFunction = replacerModule.default;
74
- if (typeof replacerFunction == 'function') {
75
- config.replacers.push(replacerFunction);
76
- config.output.info(`Added replacer "${file}"`);
77
- }
78
- else {
79
- config.output.error(`Failed to import replacer "${file}", not in replacer format.`);
80
- }
81
- });
82
- const isRelativePath = !(0, path_1.isAbsolute)(file);
83
- const path = isRelativePath ? normalizePath((0, path_1.join)(dir, file)) : file;
84
- if ((0, fs_1.existsSync)(path)) {
85
- try {
86
- yield tryImportReplacer(path);
87
- config.output.debug('Imported replacer:', path);
88
- continue;
89
- }
90
- catch (_g) { }
91
- }
92
- if (isRelativePath) {
93
- for (const targetPath of node_modules.map((v) => (0, path_1.join)(dir, v, file))) {
94
- try {
95
- yield tryImportReplacer(targetPath);
96
- config.output.debug('Imported replacer:', targetPath);
97
- continue;
98
- }
99
- catch (_h) { }
100
- }
101
- }
102
- config.output.error(`Failed to import replacer "${file}"`);
103
- }
104
- }
105
- finally {
106
- _f = true;
107
- }
108
- }
109
- }
110
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
111
- finally {
112
- try {
113
- if (!_f && !_a && (_b = entries_1.return)) yield _b.call(entries_1);
114
- }
115
- finally { if (e_1) throw e_1.error; }
116
- }
117
- config.output.debug('Loaded replacers:', config.replacers);
118
- });
119
- }
120
- exports.importReplacers = importReplacers;
121
- function replaceAlias(config, file, resolveFullPath, resolveFullExtension) {
122
- return __awaiter(this, void 0, void 0, function* () {
123
- config.output.debug('Starting to replace file:', file);
124
- const code = yield fs_1.promises.readFile(file, 'utf8');
125
- const tempCode = replaceAliasString(config, file, code, resolveFullPath, resolveFullExtension);
126
- if (code !== tempCode) {
127
- config.output.debug('replaced file with changes:', file);
128
- yield fs_1.promises.writeFile(file, tempCode, 'utf8');
129
- return true;
130
- }
131
- config.output.debug('replaced file without changes:', file);
132
- return false;
133
- });
134
- }
135
- exports.replaceAlias = replaceAlias;
136
- function replaceAliasString(config, file, code, resolveFullPath, resolveFullExtension) {
137
- config.replacers.forEach((replacer) => {
138
- code = (0, utils_1.replaceSourceImportPaths)(code, file, (orig) => replacer({
139
- orig,
140
- file,
141
- config
142
- }));
143
- });
144
- if (resolveFullPath) {
145
- code = (0, utils_1.resolveFullImportPaths)(code, file, resolveFullExtension);
146
- }
147
- return code;
148
- }
149
- exports.replaceAliasString = replaceAliasString;
150
- //# sourceMappingURL=replacers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replacers.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Ae,EACf,oBAAoB,CACrB,CAAC;QAEF,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;YACzD,MAAM,aAAG,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;SACb;QACD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAvBD,oCAuBC;AAUD,SAAgB,kBAAkB,CAChC,MAAe,EACf,IAAY,EACZ,IAAY,EACZ,eAAyB,EACzB,oBAA6B;IAE7B,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,IAAI,GAAG,IAAA,gCAAwB,EAAC,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CACnD,QAAQ,CAAC;YACP,IAAI;YACJ,IAAI;YACJ,MAAM;SACP,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAIH,IAAI,eAAe,EAAE;QACnB,IAAI,GAAG,IAAA,8BAAsB,EAAC,IAAI,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;KACjE;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAxBD,gDAwBC","sourcesContent":["/**\n * @file\n *\n * This file has all helperfunctions related to replacing.\n */\n\n/** */\nimport { existsSync, promises as fsp } from 'fs';\nimport { Dir } from 'mylas';\nimport { isAbsolute, join } from 'path';\nimport { IConfig, ReplacerOptions } from '../interfaces';\nimport { replaceSourceImportPaths, resolveFullImportPaths } from '../utils';\nimport normalizePath = require('normalize-path');\n\n/**\n * importReplacers imports replacers for tsc-alias to use.\n * @param {IConfig} config the tsc-alias config object.\n * @param {ReplacerOptions} replacers the tsc-alias replacer options.\n * @param {string[]} cmdReplacers array of filepaths to replacers from command-line.\n */\nexport async function importReplacers(\n config: IConfig,\n replacers: ReplacerOptions,\n cmdReplacers?: string[]\n) {\n config.output.debug('Started loading replacers');\n const dir = process.cwd();\n const node_modules: string[] = Dir.nodeModules({ cwd: dir });\n config.output.debug('Found node_modules:', node_modules);\n\n // List of default replacers.\n const defaultReplacers: ReplacerOptions = {\n default: {\n enabled: true\n },\n 'base-url': {\n enabled: !!config.baseUrl\n }\n };\n\n // List of all replacers.\n let merged: ReplacerOptions = {\n ...defaultReplacers,\n ...replacers\n };\n\n // Added replacers to list from command-line filepaths.\n config.output.debug(\n 'Added replacers to list from command-line filepaths:',\n cmdReplacers\n );\n cmdReplacers?.forEach((v) => {\n merged[v] = {\n enabled: true,\n file: v\n };\n });\n\n config.output.debug('Reading replacers config');\n const entries = Object.entries(merged);\n for await (const replacer of entries) {\n if (replacer[1].enabled) {\n // Importing default replacers.\n if (Object.keys(defaultReplacers).includes(replacer[0])) {\n config.output.debug('Loading default replacer:', replacer);\n const replacerModule = await import(\n `../replacers/${replacer[0]}.replacer`\n );\n config.replacers.push(replacerModule.default);\n }\n\n const file = replacer[1]?.file;\n if (!file) {\n config.output.debug('Replacer has no file:', replacer);\n continue; // When file is undefined don't try to import.\n }\n // Try to import replacer.\n const tryImportReplacer = async (targetPath: string) => {\n const replacerModule = await import(targetPath);\n config.output.debug('Imported replacerModule:', replacerModule);\n const replacerFunction = replacerModule.default;\n if (typeof replacerFunction == 'function') {\n config.replacers.push(replacerFunction);\n config.output.info(`Added replacer \"${file}\"`);\n } else {\n config.output.error(\n `Failed to import replacer \"${file}\", not in replacer format.`\n );\n }\n };\n\n // Look for replacer in cwd.\n const isRelativePath = !isAbsolute(file);\n const path = isRelativePath ? normalizePath(join(dir, file)) : file;\n\n if (existsSync(path)) {\n try {\n await tryImportReplacer(path);\n config.output.debug('Imported replacer:', path);\n continue;\n } catch {}\n }\n\n // Look for replacer in node_modules.\n if (isRelativePath) {\n for (const targetPath of node_modules.map((v) => join(dir, v, file))) {\n try {\n await tryImportReplacer(targetPath);\n config.output.debug('Imported replacer:', targetPath);\n continue;\n } catch {}\n }\n }\n\n config.output.error(`Failed to import replacer \"${file}\"`);\n }\n }\n config.output.debug('Loaded replacers:', config.replacers);\n}\n\n/**\n * replaceAlias replaces aliases in file.\n * @param {IConfig} config configuration\n * @param {string} file file to replace aliases in.\n * @param {boolean} resolveFullPath if tsc-alias should resolve the full path\n * @returns {Promise<boolean>} if something has been replaced.\n */\nexport async function replaceAlias(\n config: IConfig,\n file: string,\n resolveFullPath?: boolean,\n resolveFullExtension?: string\n): Promise<boolean> {\n config.output.debug('Starting to replace file:', file);\n const code = await fsp.readFile(file, 'utf8');\n const tempCode = replaceAliasString(\n config,\n file,\n code,\n resolveFullPath,\n resolveFullExtension\n );\n\n if (code !== tempCode) {\n config.output.debug('replaced file with changes:', file);\n await fsp.writeFile(file, tempCode, 'utf8');\n return true;\n }\n config.output.debug('replaced file without changes:', file);\n return false;\n}\n\n/**\n * replaceAliasString replaces aliases in the given code content and returns the changed code.\n * @param {IConfig} config configuration\n * @param {string} file path of the file to replace aliases in.\n * @param {string} code contents of the file to replace aliases in.\n * @param {boolean} resolveFullPath if tsc-alias should resolve the full path\n * @returns {string} content of the file with any replacements possible applied.\n */\nexport function replaceAliasString(\n config: IConfig,\n file: string,\n code: string,\n resolveFullPath?: boolean,\n resolveFullExtension?: string\n): string {\n config.replacers.forEach((replacer) => {\n code = replaceSourceImportPaths(code, file, (orig) =>\n replacer({\n orig,\n file,\n config\n })\n );\n });\n\n // Fully resolve all import paths (not just aliased ones)\n // *after* the aliases are resolved\n if (resolveFullPath) {\n code = resolveFullImportPaths(code, file, resolveFullExtension);\n }\n\n return code;\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { AliasReplacer, AliasReplacerArguments, IConfig, IOutput, IProjectConfig, ReplaceTscAliasPathsOptions } from './interfaces';
2
- export { ReplaceTscAliasPathsOptions, AliasReplacer, AliasReplacerArguments, IConfig, IProjectConfig, IOutput };
3
- export declare function replaceTscAliasPaths(options?: ReplaceTscAliasPathsOptions): Promise<void>;
4
- export type SingleFileReplacer = (input: {
5
- fileContents: string;
6
- filePath: string;
7
- }) => string;
8
- export declare function prepareSingleFileReplaceTscAliasPaths(options?: ReplaceTscAliasPathsOptions): Promise<SingleFileReplacer>;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.prepareSingleFileReplaceTscAliasPaths = exports.replaceTscAliasPaths = void 0;
13
- const chokidar_1 = require("chokidar");
14
- const globby_1 = require("globby");
15
- const plimit_lit_1 = require("plimit-lit");
16
- const helpers_1 = require("./helpers");
17
- const defaultConfig = {
18
- watch: false,
19
- verbose: false,
20
- debug: false,
21
- declarationDir: undefined,
22
- output: undefined,
23
- aliasTrie: undefined
24
- };
25
- const OpenFilesLimit = (0, plimit_lit_1.pLimit)(500);
26
- function replaceTscAliasPaths(options = Object.assign({}, defaultConfig)) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const config = yield (0, helpers_1.prepareConfig)(options);
29
- const output = config.output;
30
- const posixOutput = config.outPath.replace(/\\/g, '/').replace(/\/+$/g, '');
31
- const globPattern = [
32
- `${posixOutput}/**/*.${config.inputGlob}`,
33
- `!${posixOutput}/**/node_modules`
34
- ];
35
- output.debug('Search pattern:', globPattern);
36
- const files = (0, globby_1.sync)(globPattern, {
37
- dot: true,
38
- onlyFiles: true
39
- });
40
- output.debug('Found files:', files);
41
- const replaceList = yield Promise.all(files.map((file) => OpenFilesLimit(() => (0, helpers_1.replaceAlias)(config, file, options === null || options === void 0 ? void 0 : options.resolveFullPaths, options === null || options === void 0 ? void 0 : options.resolveFullExtension))));
42
- const replaceCount = replaceList.filter(Boolean).length;
43
- output.info(`${replaceCount} files were affected!`);
44
- if (options.watch) {
45
- output.verbose = true;
46
- output.info('[Watching for file changes...]');
47
- const filesWatcher = (0, chokidar_1.watch)(globPattern);
48
- const tsconfigWatcher = (0, chokidar_1.watch)(config.configFile);
49
- const onFileChange = (file) => __awaiter(this, void 0, void 0, function* () { return yield (0, helpers_1.replaceAlias)(config, file, options === null || options === void 0 ? void 0 : options.resolveFullPaths); });
50
- filesWatcher.on('add', onFileChange);
51
- filesWatcher.on('change', onFileChange);
52
- tsconfigWatcher.on('change', () => {
53
- output.clear();
54
- filesWatcher.close();
55
- tsconfigWatcher.close();
56
- replaceTscAliasPaths(options);
57
- });
58
- }
59
- if (options.declarationDir) {
60
- replaceTscAliasPaths(Object.assign(Object.assign({}, options), { outDir: options.declarationDir, declarationDir: undefined, output: config.output, aliasTrie: undefined }));
61
- }
62
- });
63
- }
64
- exports.replaceTscAliasPaths = replaceTscAliasPaths;
65
- function prepareSingleFileReplaceTscAliasPaths(options = Object.assign({}, defaultConfig)) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const config = yield (0, helpers_1.prepareConfig)(options);
68
- return ({ fileContents, filePath }) => {
69
- return (0, helpers_1.replaceAliasString)(config, filePath, fileContents, options === null || options === void 0 ? void 0 : options.resolveFullPaths, options === null || options === void 0 ? void 0 : options.resolveFullExtension);
70
- };
71
- });
72
- }
73
- exports.prepareSingleFileReplaceTscAliasPaths = prepareSingleFileReplaceTscAliasPaths;
74
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,mCAA8B;AA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3D,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAa,EAAC,OAAO,CAAC,CAAC;QAE5C,OAAO,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE;YACpC,OAAO,IAAA,4BAAkB,EACvB,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,EACzB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,CAC9B,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA;AAdD,sFAcC","sourcesContent":["import { watch } from 'chokidar';\nimport { sync } from 'globby';\nimport { pLimit } from 'plimit-lit';\nimport { prepareConfig, replaceAlias, replaceAliasString } from './helpers';\nimport {\n AliasReplacer,\n AliasReplacerArguments,\n IConfig,\n IOutput,\n IProjectConfig,\n ReplaceTscAliasPathsOptions\n} from './interfaces';\n\n// export interfaces for api use.\nexport {\n ReplaceTscAliasPathsOptions,\n AliasReplacer,\n AliasReplacerArguments,\n IConfig,\n IProjectConfig,\n IOutput\n};\n\nconst defaultConfig = {\n watch: false,\n verbose: false,\n debug: false,\n declarationDir: undefined,\n output: undefined,\n aliasTrie: undefined\n};\n\nconst OpenFilesLimit = pLimit(500);\n\n/**\n * replaceTscAliasPaths replaces the aliases in the project.\n * @param {ReplaceTscAliasPathsOptions} options tsc-alias options.\n */\nexport async function replaceTscAliasPaths(\n options: ReplaceTscAliasPathsOptions = { ...defaultConfig }\n) {\n const config = await prepareConfig(options);\n const output = config.output;\n\n // Finding files and changing alias paths\n const posixOutput = config.outPath.replace(/\\\\/g, '/').replace(/\\/+$/g, '');\n const globPattern = [\n `${posixOutput}/**/*.${config.inputGlob}`,\n `!${posixOutput}/**/node_modules`\n ];\n output.debug('Search pattern:', globPattern);\n const files = sync(globPattern, {\n dot: true,\n onlyFiles: true\n });\n output.debug('Found files:', files);\n\n // Make array with promises for file changes\n // Wait for all promises to resolve\n const replaceList = await Promise.all(\n files.map((file) =>\n OpenFilesLimit(() =>\n replaceAlias(\n config,\n file,\n options?.resolveFullPaths,\n options?.resolveFullExtension\n )\n )\n )\n );\n\n // Count all changed files\n const replaceCount = replaceList.filter(Boolean).length;\n\n output.info(`${replaceCount} files were affected!`);\n if (options.watch) {\n output.verbose = true;\n output.info('[Watching for file changes...]');\n const filesWatcher = watch(globPattern);\n const tsconfigWatcher = watch(config.configFile);\n const onFileChange = async (file: string) =>\n await replaceAlias(config, file, options?.resolveFullPaths);\n filesWatcher.on('add', onFileChange);\n filesWatcher.on('change', onFileChange);\n tsconfigWatcher.on('change', () => {\n output.clear();\n filesWatcher.close();\n tsconfigWatcher.close();\n replaceTscAliasPaths(options);\n });\n }\n if (options.declarationDir) {\n replaceTscAliasPaths({\n ...options,\n outDir: options.declarationDir,\n declarationDir: undefined,\n output: config.output,\n aliasTrie: undefined\n });\n }\n}\n\nexport type SingleFileReplacer = (input: {\n fileContents: string;\n filePath: string;\n}) => string;\n\n/**\n * prepareSingleFileReplaceTscAliasPaths prepares a SingleFileReplacer.\n * @param {ReplaceTscAliasPathsOptions} options tsc-alias options.\n * @returns {Promise<SingleFileReplacer>} a SingleFileReplacer to use for replacing aliases in a single file.\n */\nexport async function prepareSingleFileReplaceTscAliasPaths(\n options: ReplaceTscAliasPathsOptions = { ...defaultConfig }\n): Promise<SingleFileReplacer> {\n const config = await prepareConfig(options);\n\n return ({ fileContents, filePath }) => {\n return replaceAliasString(\n config,\n filePath,\n fileContents,\n options?.resolveFullPaths,\n options?.resolveFullExtension\n );\n };\n}\n"]}