@esportsplus/typescript 0.8.3 → 0.8.5

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 +5 -4
  2. package/bin/tsc-alias +8 -1
  3. package/node_modules/.package-lock.json +481 -0
  4. package/node_modules/@nodelib/fs.scandir/LICENSE +21 -0
  5. package/node_modules/@nodelib/fs.scandir/README.md +171 -0
  6. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  7. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +19 -0
  8. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +4 -0
  9. package/node_modules/@nodelib/fs.scandir/out/constants.js +17 -0
  10. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +12 -0
  11. package/node_modules/@nodelib/fs.scandir/out/index.js +26 -0
  12. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  13. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +104 -0
  14. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +1 -0
  15. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +13 -0
  16. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +5 -0
  17. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +54 -0
  18. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  19. package/node_modules/@nodelib/fs.scandir/out/settings.js +24 -0
  20. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  21. package/node_modules/@nodelib/fs.scandir/out/types/index.js +2 -0
  22. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +2 -0
  23. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +19 -0
  24. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +2 -0
  25. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +5 -0
  26. package/node_modules/@nodelib/fs.scandir/package.json +44 -0
  27. package/node_modules/@nodelib/fs.stat/LICENSE +21 -0
  28. package/node_modules/@nodelib/fs.stat/README.md +126 -0
  29. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  30. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +17 -0
  31. package/node_modules/@nodelib/fs.stat/out/index.d.ts +12 -0
  32. package/node_modules/@nodelib/fs.stat/out/index.js +26 -0
  33. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  34. package/node_modules/@nodelib/fs.stat/out/providers/async.js +36 -0
  35. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +3 -0
  36. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +23 -0
  37. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +16 -0
  38. package/node_modules/@nodelib/fs.stat/out/settings.js +16 -0
  39. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  40. package/node_modules/@nodelib/fs.stat/out/types/index.js +2 -0
  41. package/node_modules/@nodelib/fs.stat/package.json +37 -0
  42. package/node_modules/@nodelib/fs.walk/LICENSE +21 -0
  43. package/node_modules/@nodelib/fs.walk/README.md +215 -0
  44. package/node_modules/@nodelib/fs.walk/out/index.d.ts +14 -0
  45. package/node_modules/@nodelib/fs.walk/out/index.js +34 -0
  46. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  47. package/node_modules/@nodelib/fs.walk/out/providers/async.js +30 -0
  48. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +4 -0
  49. package/node_modules/@nodelib/fs.walk/out/providers/index.js +9 -0
  50. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +12 -0
  51. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +34 -0
  52. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +10 -0
  53. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +14 -0
  54. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  55. package/node_modules/@nodelib/fs.walk/out/readers/async.js +97 -0
  56. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +7 -0
  57. package/node_modules/@nodelib/fs.walk/out/readers/common.js +31 -0
  58. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  59. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +11 -0
  60. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +15 -0
  61. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +59 -0
  62. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +30 -0
  63. package/node_modules/@nodelib/fs.walk/out/settings.js +26 -0
  64. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  65. package/node_modules/@nodelib/fs.walk/out/types/index.js +2 -0
  66. package/node_modules/@nodelib/fs.walk/package.json +44 -0
  67. package/node_modules/anymatch/LICENSE +15 -0
  68. package/node_modules/anymatch/README.md +87 -0
  69. package/node_modules/anymatch/index.d.ts +20 -0
  70. package/node_modules/anymatch/index.js +104 -0
  71. package/node_modules/anymatch/package.json +48 -0
  72. package/node_modules/array-union/index.d.ts +25 -0
  73. package/node_modules/array-union/index.js +5 -0
  74. package/node_modules/array-union/license +9 -0
  75. package/node_modules/array-union/package.json +38 -0
  76. package/node_modules/array-union/readme.md +34 -0
  77. package/node_modules/binary-extensions/binary-extensions.json +263 -0
  78. package/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
  79. package/node_modules/binary-extensions/index.d.ts +14 -0
  80. package/node_modules/binary-extensions/index.js +1 -0
  81. package/node_modules/binary-extensions/license +10 -0
  82. package/node_modules/binary-extensions/package.json +40 -0
  83. package/node_modules/binary-extensions/readme.md +25 -0
  84. package/node_modules/braces/LICENSE +21 -0
  85. package/node_modules/braces/README.md +586 -0
  86. package/node_modules/braces/index.js +170 -0
  87. package/node_modules/braces/lib/compile.js +60 -0
  88. package/node_modules/braces/lib/constants.js +57 -0
  89. package/node_modules/braces/lib/expand.js +113 -0
  90. package/node_modules/braces/lib/parse.js +331 -0
  91. package/node_modules/braces/lib/stringify.js +32 -0
  92. package/node_modules/braces/lib/utils.js +122 -0
  93. package/node_modules/braces/package.json +77 -0
  94. package/node_modules/chokidar/LICENSE +21 -0
  95. package/node_modules/chokidar/README.md +308 -0
  96. package/node_modules/chokidar/index.js +973 -0
  97. package/node_modules/chokidar/lib/constants.js +66 -0
  98. package/node_modules/chokidar/lib/fsevents-handler.js +526 -0
  99. package/node_modules/chokidar/lib/nodefs-handler.js +654 -0
  100. package/node_modules/chokidar/package.json +70 -0
  101. package/node_modules/chokidar/types/index.d.ts +192 -0
  102. package/node_modules/commander/LICENSE +22 -0
  103. package/node_modules/commander/Readme.md +1129 -0
  104. package/node_modules/commander/esm.mjs +16 -0
  105. package/node_modules/commander/index.js +27 -0
  106. package/node_modules/commander/lib/argument.js +147 -0
  107. package/node_modules/commander/lib/command.js +2179 -0
  108. package/node_modules/commander/lib/error.js +45 -0
  109. package/node_modules/commander/lib/help.js +461 -0
  110. package/node_modules/commander/lib/option.js +326 -0
  111. package/node_modules/commander/lib/suggestSimilar.js +100 -0
  112. package/node_modules/commander/package-support.json +16 -0
  113. package/node_modules/commander/package.json +80 -0
  114. package/node_modules/commander/typings/index.d.ts +891 -0
  115. package/node_modules/dir-glob/index.js +75 -0
  116. package/node_modules/dir-glob/license +9 -0
  117. package/node_modules/dir-glob/package.json +38 -0
  118. package/node_modules/dir-glob/readme.md +76 -0
  119. package/node_modules/fast-glob/LICENSE +21 -0
  120. package/node_modules/fast-glob/README.md +830 -0
  121. package/node_modules/fast-glob/out/index.d.ts +40 -0
  122. package/node_modules/fast-glob/out/index.js +102 -0
  123. package/node_modules/fast-glob/out/managers/tasks.d.ts +22 -0
  124. package/node_modules/fast-glob/out/managers/tasks.js +110 -0
  125. package/node_modules/fast-glob/out/providers/async.d.ts +9 -0
  126. package/node_modules/fast-glob/out/providers/async.js +23 -0
  127. package/node_modules/fast-glob/out/providers/filters/deep.d.ts +16 -0
  128. package/node_modules/fast-glob/out/providers/filters/deep.js +62 -0
  129. package/node_modules/fast-glob/out/providers/filters/entry.d.ts +17 -0
  130. package/node_modules/fast-glob/out/providers/filters/entry.js +85 -0
  131. package/node_modules/fast-glob/out/providers/filters/error.d.ts +8 -0
  132. package/node_modules/fast-glob/out/providers/filters/error.js +15 -0
  133. package/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +33 -0
  134. package/node_modules/fast-glob/out/providers/matchers/matcher.js +45 -0
  135. package/node_modules/fast-glob/out/providers/matchers/partial.d.ts +4 -0
  136. package/node_modules/fast-glob/out/providers/matchers/partial.js +38 -0
  137. package/node_modules/fast-glob/out/providers/provider.d.ts +19 -0
  138. package/node_modules/fast-glob/out/providers/provider.js +48 -0
  139. package/node_modules/fast-glob/out/providers/stream.d.ts +11 -0
  140. package/node_modules/fast-glob/out/providers/stream.js +31 -0
  141. package/node_modules/fast-glob/out/providers/sync.d.ts +9 -0
  142. package/node_modules/fast-glob/out/providers/sync.js +23 -0
  143. package/node_modules/fast-glob/out/providers/transformers/entry.d.ts +8 -0
  144. package/node_modules/fast-glob/out/providers/transformers/entry.js +26 -0
  145. package/node_modules/fast-glob/out/readers/async.d.ts +10 -0
  146. package/node_modules/fast-glob/out/readers/async.js +35 -0
  147. package/node_modules/fast-glob/out/readers/reader.d.ts +15 -0
  148. package/node_modules/fast-glob/out/readers/reader.js +33 -0
  149. package/node_modules/fast-glob/out/readers/stream.d.ts +14 -0
  150. package/node_modules/fast-glob/out/readers/stream.js +55 -0
  151. package/node_modules/fast-glob/out/readers/sync.d.ts +12 -0
  152. package/node_modules/fast-glob/out/readers/sync.js +43 -0
  153. package/node_modules/fast-glob/out/settings.d.ts +164 -0
  154. package/node_modules/fast-glob/out/settings.js +59 -0
  155. package/node_modules/fast-glob/out/types/index.d.ts +31 -0
  156. package/node_modules/fast-glob/out/types/index.js +2 -0
  157. package/node_modules/fast-glob/out/utils/array.d.ts +2 -0
  158. package/node_modules/fast-glob/out/utils/array.js +22 -0
  159. package/node_modules/fast-glob/out/utils/errno.d.ts +2 -0
  160. package/node_modules/fast-glob/out/utils/errno.js +7 -0
  161. package/node_modules/fast-glob/out/utils/fs.d.ts +4 -0
  162. package/node_modules/fast-glob/out/utils/fs.js +19 -0
  163. package/node_modules/fast-glob/out/utils/index.d.ts +8 -0
  164. package/node_modules/fast-glob/out/utils/index.js +17 -0
  165. package/node_modules/fast-glob/out/utils/path.d.ts +13 -0
  166. package/node_modules/fast-glob/out/utils/path.js +68 -0
  167. package/node_modules/fast-glob/out/utils/pattern.d.ts +49 -0
  168. package/node_modules/fast-glob/out/utils/pattern.js +206 -0
  169. package/node_modules/fast-glob/out/utils/stream.d.ts +4 -0
  170. package/node_modules/fast-glob/out/utils/stream.js +17 -0
  171. package/node_modules/fast-glob/out/utils/string.d.ts +2 -0
  172. package/node_modules/fast-glob/out/utils/string.js +11 -0
  173. package/node_modules/fast-glob/package.json +81 -0
  174. package/node_modules/fastq/.github/dependabot.yml +11 -0
  175. package/node_modules/fastq/.github/workflows/ci.yml +75 -0
  176. package/node_modules/fastq/LICENSE +13 -0
  177. package/node_modules/fastq/README.md +312 -0
  178. package/node_modules/fastq/SECURITY.md +15 -0
  179. package/node_modules/fastq/bench.js +66 -0
  180. package/node_modules/fastq/example.js +14 -0
  181. package/node_modules/fastq/example.mjs +11 -0
  182. package/node_modules/fastq/index.d.ts +57 -0
  183. package/node_modules/fastq/package.json +53 -0
  184. package/node_modules/fastq/queue.js +311 -0
  185. package/node_modules/fastq/test/example.ts +83 -0
  186. package/node_modules/fastq/test/promise.js +291 -0
  187. package/node_modules/fastq/test/test.js +653 -0
  188. package/node_modules/fastq/test/tsconfig.json +11 -0
  189. package/node_modules/fill-range/LICENSE +21 -0
  190. package/node_modules/fill-range/README.md +237 -0
  191. package/node_modules/fill-range/index.js +248 -0
  192. package/node_modules/fill-range/package.json +74 -0
  193. package/node_modules/get-tsconfig/LICENSE +21 -0
  194. package/node_modules/get-tsconfig/README.md +235 -0
  195. package/node_modules/get-tsconfig/dist/index.cjs +7 -0
  196. package/node_modules/get-tsconfig/dist/index.d.cts +1439 -0
  197. package/node_modules/get-tsconfig/dist/index.d.mts +1439 -0
  198. package/node_modules/get-tsconfig/dist/index.mjs +7 -0
  199. package/node_modules/get-tsconfig/package.json +46 -0
  200. package/node_modules/glob-parent/CHANGELOG.md +110 -0
  201. package/node_modules/glob-parent/LICENSE +15 -0
  202. package/node_modules/glob-parent/README.md +137 -0
  203. package/node_modules/glob-parent/index.js +42 -0
  204. package/node_modules/glob-parent/package.json +48 -0
  205. package/node_modules/globby/gitignore.js +120 -0
  206. package/node_modules/globby/index.d.ts +186 -0
  207. package/node_modules/globby/index.js +181 -0
  208. package/node_modules/globby/license +9 -0
  209. package/node_modules/globby/package.json +82 -0
  210. package/node_modules/globby/readme.md +170 -0
  211. package/node_modules/globby/stream-utils.js +46 -0
  212. package/node_modules/ignore/LICENSE-MIT +21 -0
  213. package/node_modules/ignore/README.md +412 -0
  214. package/node_modules/ignore/index.d.ts +61 -0
  215. package/node_modules/ignore/index.js +636 -0
  216. package/node_modules/ignore/legacy.js +559 -0
  217. package/node_modules/ignore/package.json +74 -0
  218. package/node_modules/is-binary-path/index.d.ts +17 -0
  219. package/node_modules/is-binary-path/index.js +7 -0
  220. package/node_modules/is-binary-path/license +9 -0
  221. package/node_modules/is-binary-path/package.json +40 -0
  222. package/node_modules/is-binary-path/readme.md +34 -0
  223. package/node_modules/is-extglob/LICENSE +21 -0
  224. package/node_modules/is-extglob/README.md +107 -0
  225. package/node_modules/is-extglob/index.js +20 -0
  226. package/node_modules/is-extglob/package.json +69 -0
  227. package/node_modules/is-glob/LICENSE +21 -0
  228. package/node_modules/is-glob/README.md +206 -0
  229. package/node_modules/is-glob/index.js +150 -0
  230. package/node_modules/is-glob/package.json +81 -0
  231. package/node_modules/is-number/LICENSE +21 -0
  232. package/node_modules/is-number/README.md +187 -0
  233. package/node_modules/is-number/index.js +18 -0
  234. package/node_modules/is-number/package.json +82 -0
  235. package/node_modules/merge2/LICENSE +21 -0
  236. package/node_modules/merge2/README.md +144 -0
  237. package/node_modules/merge2/index.js +144 -0
  238. package/node_modules/merge2/package.json +43 -0
  239. package/node_modules/micromatch/LICENSE +21 -0
  240. package/node_modules/micromatch/README.md +1024 -0
  241. package/node_modules/micromatch/index.js +474 -0
  242. package/node_modules/micromatch/package.json +119 -0
  243. package/node_modules/mylas/LICENSE +21 -0
  244. package/node_modules/mylas/README.md +39 -0
  245. package/node_modules/mylas/build/chunk-3EDNT3AM.js +1 -0
  246. package/node_modules/mylas/build/chunk-M3H36CX2.js +3 -0
  247. package/node_modules/mylas/build/index.d.ts +22 -0
  248. package/node_modules/mylas/build/index.js +1 -0
  249. package/node_modules/mylas/build/interfaces.d.ts +201 -0
  250. package/node_modules/mylas/build/register.d.ts +9 -0
  251. package/node_modules/mylas/build/register.js +1 -0
  252. package/node_modules/mylas/build/worker.js +1 -0
  253. package/node_modules/mylas/package.json +65 -0
  254. package/node_modules/normalize-path/LICENSE +21 -0
  255. package/node_modules/normalize-path/README.md +127 -0
  256. package/node_modules/normalize-path/index.js +35 -0
  257. package/node_modules/normalize-path/package.json +77 -0
  258. package/node_modules/path-type/index.d.ts +51 -0
  259. package/node_modules/path-type/index.js +43 -0
  260. package/node_modules/path-type/license +9 -0
  261. package/node_modules/path-type/package.json +45 -0
  262. package/node_modules/path-type/readme.md +72 -0
  263. package/node_modules/picomatch/CHANGELOG.md +136 -0
  264. package/node_modules/picomatch/LICENSE +21 -0
  265. package/node_modules/picomatch/README.md +708 -0
  266. package/node_modules/picomatch/index.js +3 -0
  267. package/node_modules/picomatch/lib/constants.js +179 -0
  268. package/node_modules/picomatch/lib/parse.js +1091 -0
  269. package/node_modules/picomatch/lib/picomatch.js +342 -0
  270. package/node_modules/picomatch/lib/scan.js +391 -0
  271. package/node_modules/picomatch/lib/utils.js +64 -0
  272. package/node_modules/picomatch/package.json +81 -0
  273. package/node_modules/plimit-lit/LICENSE +21 -0
  274. package/node_modules/plimit-lit/README.md +99 -0
  275. package/node_modules/plimit-lit/dist/index.d.ts +6 -0
  276. package/node_modules/plimit-lit/dist/plimit-lit.cjs +91 -0
  277. package/node_modules/plimit-lit/dist/plimit-lit.modern.js +91 -0
  278. package/node_modules/plimit-lit/dist/plimit-lit.module.js +91 -0
  279. package/node_modules/plimit-lit/package.json +55 -0
  280. package/node_modules/queue-lit/LICENSE +21 -0
  281. package/node_modules/queue-lit/README.md +93 -0
  282. package/node_modules/queue-lit/dist/index.d.ts +34 -0
  283. package/node_modules/queue-lit/dist/queue-lit.cjs +110 -0
  284. package/node_modules/queue-lit/dist/queue-lit.modern.js +110 -0
  285. package/node_modules/queue-lit/dist/queue-lit.module.js +110 -0
  286. package/node_modules/queue-lit/package.json +53 -0
  287. package/node_modules/queue-microtask/LICENSE +20 -0
  288. package/node_modules/queue-microtask/README.md +90 -0
  289. package/node_modules/queue-microtask/index.d.ts +2 -0
  290. package/node_modules/queue-microtask/index.js +9 -0
  291. package/node_modules/queue-microtask/package.json +55 -0
  292. package/node_modules/readdirp/LICENSE +21 -0
  293. package/node_modules/readdirp/README.md +122 -0
  294. package/node_modules/readdirp/index.d.ts +43 -0
  295. package/node_modules/readdirp/index.js +287 -0
  296. package/node_modules/readdirp/package.json +122 -0
  297. package/node_modules/resolve-pkg-maps/LICENSE +21 -0
  298. package/node_modules/resolve-pkg-maps/README.md +216 -0
  299. package/node_modules/resolve-pkg-maps/dist/index.cjs +1 -0
  300. package/node_modules/resolve-pkg-maps/dist/index.d.cts +11 -0
  301. package/node_modules/resolve-pkg-maps/dist/index.d.mts +11 -0
  302. package/node_modules/resolve-pkg-maps/dist/index.mjs +1 -0
  303. package/node_modules/resolve-pkg-maps/package.json +42 -0
  304. package/node_modules/reusify/.github/dependabot.yml +7 -0
  305. package/node_modules/reusify/.github/workflows/ci.yml +96 -0
  306. package/node_modules/reusify/LICENSE +22 -0
  307. package/node_modules/reusify/README.md +139 -0
  308. package/node_modules/reusify/SECURITY.md +15 -0
  309. package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
  310. package/node_modules/reusify/benchmarks/fib.js +13 -0
  311. package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
  312. package/node_modules/reusify/eslint.config.js +14 -0
  313. package/node_modules/reusify/package.json +50 -0
  314. package/node_modules/reusify/reusify.d.ts +14 -0
  315. package/node_modules/reusify/reusify.js +33 -0
  316. package/node_modules/reusify/test.js +66 -0
  317. package/node_modules/reusify/tsconfig.json +11 -0
  318. package/node_modules/run-parallel/LICENSE +20 -0
  319. package/node_modules/run-parallel/README.md +85 -0
  320. package/node_modules/run-parallel/index.js +51 -0
  321. package/node_modules/run-parallel/package.json +58 -0
  322. package/node_modules/slash/index.d.ts +25 -0
  323. package/node_modules/slash/index.js +11 -0
  324. package/node_modules/slash/license +9 -0
  325. package/node_modules/slash/package.json +35 -0
  326. package/node_modules/slash/readme.md +44 -0
  327. package/node_modules/to-regex-range/LICENSE +21 -0
  328. package/node_modules/to-regex-range/README.md +305 -0
  329. package/node_modules/to-regex-range/index.js +288 -0
  330. package/node_modules/to-regex-range/package.json +88 -0
  331. package/node_modules/tsc-alias/LICENSE +21 -0
  332. package/node_modules/tsc-alias/README.md +184 -0
  333. package/node_modules/tsc-alias/dist/bin/index.d.ts +2 -0
  334. package/node_modules/tsc-alias/dist/bin/index.js +39 -0
  335. package/node_modules/tsc-alias/dist/bin/index.js.map +1 -0
  336. package/node_modules/tsc-alias/dist/helpers/config.d.ts +5 -0
  337. package/node_modules/tsc-alias/dist/helpers/config.js +181 -0
  338. package/node_modules/tsc-alias/dist/helpers/config.js.map +1 -0
  339. package/node_modules/tsc-alias/dist/helpers/index.d.ts +3 -0
  340. package/node_modules/tsc-alias/dist/helpers/index.js +20 -0
  341. package/node_modules/tsc-alias/dist/helpers/index.js.map +1 -0
  342. package/node_modules/tsc-alias/dist/helpers/path.d.ts +3 -0
  343. package/node_modules/tsc-alias/dist/helpers/path.js +73 -0
  344. package/node_modules/tsc-alias/dist/helpers/path.js.map +1 -0
  345. package/node_modules/tsc-alias/dist/helpers/replacers.d.ts +4 -0
  346. package/node_modules/tsc-alias/dist/helpers/replacers.js +150 -0
  347. package/node_modules/tsc-alias/dist/helpers/replacers.js.map +1 -0
  348. package/node_modules/tsc-alias/dist/index.d.ts +8 -0
  349. package/node_modules/tsc-alias/dist/index.js +74 -0
  350. package/node_modules/tsc-alias/dist/index.js.map +1 -0
  351. package/node_modules/tsc-alias/dist/interfaces.d.ts +87 -0
  352. package/node_modules/tsc-alias/dist/interfaces.js +3 -0
  353. package/node_modules/tsc-alias/dist/interfaces.js.map +1 -0
  354. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.d.ts +2 -0
  355. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.js +33 -0
  356. package/node_modules/tsc-alias/dist/replacers/base-url.replacer.js.map +1 -0
  357. package/node_modules/tsc-alias/dist/replacers/default.replacer.d.ts +2 -0
  358. package/node_modules/tsc-alias/dist/replacers/default.replacer.js +67 -0
  359. package/node_modules/tsc-alias/dist/replacers/default.replacer.js.map +1 -0
  360. package/node_modules/tsc-alias/dist/utils/import-path-resolver.d.ts +19 -0
  361. package/node_modules/tsc-alias/dist/utils/import-path-resolver.js +87 -0
  362. package/node_modules/tsc-alias/dist/utils/import-path-resolver.js.map +1 -0
  363. package/node_modules/tsc-alias/dist/utils/index.d.ts +4 -0
  364. package/node_modules/tsc-alias/dist/utils/index.js +21 -0
  365. package/node_modules/tsc-alias/dist/utils/index.js.map +1 -0
  366. package/node_modules/tsc-alias/dist/utils/output.d.ts +11 -0
  367. package/node_modules/tsc-alias/dist/utils/output.js +44 -0
  368. package/node_modules/tsc-alias/dist/utils/output.js.map +1 -0
  369. package/node_modules/tsc-alias/dist/utils/path-cache.d.ts +12 -0
  370. package/node_modules/tsc-alias/dist/utils/path-cache.js +74 -0
  371. package/node_modules/tsc-alias/dist/utils/path-cache.js.map +1 -0
  372. package/node_modules/tsc-alias/dist/utils/trie.d.ts +9 -0
  373. package/node_modules/tsc-alias/dist/utils/trie.js +81 -0
  374. package/node_modules/tsc-alias/dist/utils/trie.js.map +1 -0
  375. package/node_modules/tsc-alias/package.json +66 -0
  376. package/node_modules/typescript/LICENSE.txt +55 -0
  377. package/node_modules/typescript/README.md +50 -0
  378. package/node_modules/typescript/SECURITY.md +41 -0
  379. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  380. package/node_modules/typescript/bin/tsc +2 -0
  381. package/node_modules/typescript/bin/tsserver +2 -0
  382. package/node_modules/typescript/lib/_tsc.js +132810 -0
  383. package/node_modules/typescript/lib/_tsserver.js +659 -0
  384. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  385. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2105 -0
  386. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2105 -0
  387. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2105 -0
  388. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2105 -0
  389. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2105 -0
  390. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2105 -0
  391. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2105 -0
  392. package/node_modules/typescript/lib/lib.d.ts +22 -0
  393. package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  394. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  395. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  396. package/node_modules/typescript/lib/lib.dom.d.ts +29610 -0
  397. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +493 -0
  398. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  399. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  400. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  401. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  402. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  403. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  404. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  405. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  406. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  407. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  408. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  409. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  410. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  411. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  412. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  413. package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  414. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  415. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  416. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  417. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  418. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  419. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  420. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  421. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  422. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  423. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  424. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  425. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  426. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  427. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  428. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  429. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  430. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  431. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  432. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  433. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  434. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  435. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  436. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  437. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  438. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  439. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  440. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  441. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  442. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  443. package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  444. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  445. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  446. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  447. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  448. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  449. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  450. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  451. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  452. package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  453. package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  454. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  455. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +121 -0
  456. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  457. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  458. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  459. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  460. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  461. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  462. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  463. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  464. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  465. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  466. package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  467. package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  468. package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  469. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  470. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  471. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  472. package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  473. package/node_modules/typescript/lib/lib.es5.d.ts +4594 -0
  474. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  475. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  476. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  477. package/node_modules/typescript/lib/lib.esnext.d.ts +27 -0
  478. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  479. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  480. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +443 -0
  481. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  482. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  483. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  484. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  485. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  486. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  487. package/node_modules/typescript/lib/lib.webworker.d.ts +9894 -0
  488. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  489. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +287 -0
  490. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2105 -0
  491. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2105 -0
  492. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2105 -0
  493. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2105 -0
  494. package/node_modules/typescript/lib/tsc.js +8 -0
  495. package/node_modules/typescript/lib/tsserver.js +8 -0
  496. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  497. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  498. package/node_modules/typescript/lib/typesMap.json +497 -0
  499. package/node_modules/typescript/lib/typescript.d.ts +11399 -0
  500. package/node_modules/typescript/lib/typescript.js +199120 -0
  501. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  502. package/node_modules/typescript/lib/watchGuard.js +53 -0
  503. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2105 -0
  504. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2105 -0
  505. package/node_modules/typescript/package.json +120 -0
  506. package/package.json +4 -2
@@ -0,0 +1,181 @@
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
@@ -0,0 +1 @@
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,2CAA8C;AAC9C,gDAAiD;AAOjD,SAAsB,aAAa,CACjC,OAAoC;;;QAEpC,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,cAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAE5E,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,UAAU;YACpC,CAAC,CAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC;YACzC,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,OAAO,CAAC,UAAU,CAAC;gBACjC,CAAC,CAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC;gBAC5C,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAEvB,MAAM,CAAC,MAAM,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,wBAAwB,UAAU,EAAE,CAAC,CAAC;QAE5E,MAAM,EACJ,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,cAAc,EACd,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACf,GAAG,IAAA,kBAAU,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEnC,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,SAAS,EAAE;YACtC,cAAc,CAAC,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC;SAC7D;QACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE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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"]}
@@ -0,0 +1,3 @@
1
+ export * from './config';
2
+ export * from './path';
3
+ export * from './replacers';
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,3 @@
1
+ import { AliasPath, IProjectConfig } from '../interfaces';
2
+ export declare function relativeOutPathToConfigDir(config: IProjectConfig): void;
3
+ export declare function findBasePathOfAlias(config: IProjectConfig): (path: string) => AliasPath;
@@ -0,0 +1,73 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/helpers/path.ts"],"names":[],"mappings":";;;AAOA,gDAAiD;AACjD,m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,uBAAuB,CAAC,EAAE;YACjD,SAAS,CAAC,QAAQ,GAAG,IAAA,cAAO,EAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAC7D,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;YAC1B,OAAO,SAAS,CAAC;SAClB;QAGD,IAAI,MAAM,CAAC,cAAc,EAAE;YACzB,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;YAC1B,SAAS,CAAC,QAAQ,GAAG,aAAa,CAChC,IAAA,gBAAS,EACP,GAAG,MAAM,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"]}
@@ -0,0 +1,4 @@
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;
@@ -0,0 +1,150 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replacers.js","sourceRoot":"","sources":["../../src/helpers/replacers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAOA,2BAAiD;AACjD,iCAA4B;AAC5B,+BAAwC;AAExC,oCAA4E;AAC5E,gDAAiD;AAQjD,SAAsB,eAAe,CACnC,MAAe,EACf,SAA0B,EAC1B,YAAuB;;;;;QAEvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACjD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAa,WAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;QAGzD,MAAM,gBAAgB,GAAoB;YACxC,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;YACD,UAAU,EAAE;gBACV,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO;aAC1B;SACF,CAAC;QAGF,IAAI,MAAM,mCACL,gBAAgB,GAChB,SAAS,CACb,C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AC,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"]}
@@ -0,0 +1,8 @@
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>;
@@ -0,0 +1,74 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,mCAA8B;AAC9B,2CAAoC;AACpC,uCAA4E;AAoB5E,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,cAAc,EAAE,SAAS;IACzB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,cAAc,GAAG,IAAA,mBAAM,EAAC,GAAG,CAAC,CAAC;AAMnC,SAAsB,oBAAoB,CACxC,4BAA4C,aAAa,CAAE;;QAE3D,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAa,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAG7B,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG;YAClB,G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,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YACrC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YACxC,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;gBAChC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,YAAY,CAAC,KAAK,EAAE,CAAC;gBACrB,eAAe,CAAC,KAAK,EAAE,CAAC;gBACxB,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;SACJ;QACD,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,oBAAoB,iCACf,OAAO,KACV,MAAM,EAAE,OAAO,CAAC,cAAc,EAC9B,cAAc,EAAE,SAAS,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,SAAS,EAAE,SAAS,IACpB,CAAC;SACJ;IACH,CAAC;CAAA;AA/DD,oDA+DC;AAYD,SAAsB,qCAAqC,CACzD,4BAA4C,aAAa,CAAE;;QAE3D,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"]}