@xylabs/ts-scripts-yarn3 6.0.4 → 6.0.6

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 (329) hide show
  1. package/dist/actions/build.mjs +10 -0
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/compile-types.mjs +2 -2
  4. package/dist/actions/compile-types.mjs.map +1 -1
  5. package/dist/actions/compile.mjs +7 -9
  6. package/dist/actions/compile.mjs.map +1 -1
  7. package/dist/actions/fix.mjs +1 -7
  8. package/dist/actions/fix.mjs.map +1 -1
  9. package/dist/actions/index.mjs +204 -235
  10. package/dist/actions/index.mjs.map +1 -1
  11. package/dist/actions/lint.mjs +1 -7
  12. package/dist/actions/lint.mjs.map +1 -1
  13. package/dist/actions/package/compile/compile.mjs +101 -169
  14. package/dist/actions/package/compile/compile.mjs.map +1 -1
  15. package/dist/actions/package/compile/compileTypes.mjs +16 -31
  16. package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
  17. package/dist/actions/package/compile/index.mjs +156 -177
  18. package/dist/actions/package/compile/index.mjs.map +1 -1
  19. package/dist/actions/package/compile/packageCompileTscTypes.mjs +14 -29
  20. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  21. package/dist/actions/package/compile/packageCompileTsup.mjs +94 -82
  22. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  23. package/dist/actions/package/index.mjs +172 -193
  24. package/dist/actions/package/index.mjs.map +1 -1
  25. package/dist/actions/package/recompile.mjs +101 -169
  26. package/dist/actions/package/recompile.mjs.map +1 -1
  27. package/dist/actions/recompile.mjs +1 -7
  28. package/dist/actions/recompile.mjs.map +1 -1
  29. package/dist/actions/relint.mjs +1 -7
  30. package/dist/actions/relint.mjs.map +1 -1
  31. package/dist/bin/package/build-only.mjs +104 -172
  32. package/dist/bin/package/build-only.mjs.map +1 -1
  33. package/dist/bin/package/build.mjs +104 -172
  34. package/dist/bin/package/build.mjs.map +1 -1
  35. package/dist/bin/package/clean-outputs.mjs +1 -6
  36. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  37. package/dist/bin/package/clean-typescript.mjs +1 -6
  38. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  39. package/dist/bin/package/compile-only.mjs +103 -171
  40. package/dist/bin/package/compile-only.mjs.map +1 -1
  41. package/dist/bin/package/compile-tsup.mjs +113 -99
  42. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  43. package/dist/bin/package/compile-types.mjs +45 -56
  44. package/dist/bin/package/compile-types.mjs.map +1 -1
  45. package/dist/bin/package/compile.mjs +103 -171
  46. package/dist/bin/package/compile.mjs.map +1 -1
  47. package/dist/bin/package/recompile.mjs +103 -171
  48. package/dist/bin/package/recompile.mjs.map +1 -1
  49. package/dist/bin/xy.mjs +22 -33
  50. package/dist/bin/xy.mjs.map +1 -1
  51. package/dist/index.d.ts +9 -14
  52. package/dist/index.mjs +214 -246
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/types/actions/build.d.ts +9 -0
  55. package/dist/types/actions/build.d.ts.map +1 -0
  56. package/dist/types/actions/clean-docs.d.ts +2 -0
  57. package/dist/types/actions/clean-docs.d.ts.map +1 -0
  58. package/dist/types/actions/clean-eslint.d.ts +2 -0
  59. package/dist/types/actions/clean-eslint.d.ts.map +1 -0
  60. package/dist/types/actions/clean-jest.d.ts +2 -0
  61. package/dist/types/actions/clean-jest.d.ts.map +1 -0
  62. package/dist/types/actions/clean.d.ts +12 -0
  63. package/dist/types/actions/clean.d.ts.map +1 -0
  64. package/dist/types/actions/compile-types.d.ts +16 -0
  65. package/dist/types/actions/compile-types.d.ts.map +1 -0
  66. package/dist/types/actions/compile.d.ts +19 -0
  67. package/dist/types/actions/compile.d.ts.map +1 -0
  68. package/dist/types/actions/copy-assets.d.ts +6 -0
  69. package/dist/types/actions/copy-assets.d.ts.map +1 -0
  70. package/dist/types/actions/cycle.d.ts +2 -0
  71. package/dist/types/actions/cycle.d.ts.map +1 -0
  72. package/dist/types/actions/dead.d.ts +2 -0
  73. package/dist/types/actions/dead.d.ts.map +1 -0
  74. package/dist/types/actions/deploy-major.d.ts +2 -0
  75. package/dist/types/actions/deploy-major.d.ts.map +1 -0
  76. package/dist/types/actions/deploy-minor.d.ts +2 -0
  77. package/dist/types/actions/deploy-minor.d.ts.map +1 -0
  78. package/dist/types/actions/deploy-next.d.ts +2 -0
  79. package/dist/types/actions/deploy-next.d.ts.map +1 -0
  80. package/dist/types/actions/deploy.d.ts +2 -0
  81. package/dist/types/actions/deploy.d.ts.map +1 -0
  82. package/dist/types/actions/deps.d.ts +13 -0
  83. package/dist/types/actions/deps.d.ts.map +1 -0
  84. package/dist/types/actions/dupdeps.d.ts +2 -0
  85. package/dist/types/actions/dupdeps.d.ts.map +1 -0
  86. package/dist/types/actions/fix.d.ts +3 -0
  87. package/dist/types/actions/fix.d.ts.map +1 -0
  88. package/dist/types/actions/gen-docs.d.ts +11 -0
  89. package/dist/types/actions/gen-docs.d.ts.map +1 -0
  90. package/dist/types/actions/gitignore-gen.d.ts +2 -0
  91. package/dist/types/actions/gitignore-gen.d.ts.map +1 -0
  92. package/dist/types/actions/gitlint-fix.d.ts +2 -0
  93. package/dist/types/actions/gitlint-fix.d.ts.map +1 -0
  94. package/dist/types/actions/gitlint.d.ts +2 -0
  95. package/dist/types/actions/gitlint.d.ts.map +1 -0
  96. package/dist/types/actions/index.d.ts +38 -0
  97. package/dist/types/actions/index.d.ts.map +1 -0
  98. package/dist/types/actions/license.d.ts +2 -0
  99. package/dist/types/actions/license.d.ts.map +1 -0
  100. package/dist/types/actions/lint.d.ts +14 -0
  101. package/dist/types/actions/lint.d.ts.map +1 -0
  102. package/dist/types/actions/npmignore-gen.d.ts +2 -0
  103. package/dist/types/actions/npmignore-gen.d.ts.map +1 -0
  104. package/dist/types/actions/package/clean-outputs.d.ts +2 -0
  105. package/dist/types/actions/package/clean-outputs.d.ts.map +1 -0
  106. package/dist/types/actions/package/clean-typescript.d.ts +2 -0
  107. package/dist/types/actions/package/clean-typescript.d.ts.map +1 -0
  108. package/dist/types/actions/package/clean.d.ts +2 -0
  109. package/dist/types/actions/package/clean.d.ts.map +1 -0
  110. package/dist/types/actions/package/compile/XyConfig.d.ts +58 -0
  111. package/dist/types/actions/package/compile/XyConfig.d.ts.map +1 -0
  112. package/dist/types/actions/package/compile/buildEntries.d.ts +3 -0
  113. package/dist/types/actions/package/compile/buildEntries.d.ts.map +1 -0
  114. package/dist/types/actions/package/compile/compile.d.ts +3 -0
  115. package/dist/types/actions/package/compile/compile.d.ts.map +1 -0
  116. package/dist/types/actions/package/compile/compileTypes.d.ts +3 -0
  117. package/dist/types/actions/package/compile/compileTypes.d.ts.map +1 -0
  118. package/dist/types/actions/package/compile/copyTypeFiles.d.ts +3 -0
  119. package/dist/types/actions/package/compile/copyTypeFiles.d.ts.map +1 -0
  120. package/dist/types/actions/package/compile/deepMerge.d.ts +4 -0
  121. package/dist/types/actions/package/compile/deepMerge.d.ts.map +1 -0
  122. package/dist/types/actions/package/compile/getCompilerOptions.d.ts +3 -0
  123. package/dist/types/actions/package/compile/getCompilerOptions.d.ts.map +1 -0
  124. package/dist/types/actions/package/compile/index.d.ts +7 -0
  125. package/dist/types/actions/package/compile/index.d.ts.map +1 -0
  126. package/dist/types/actions/package/compile/inputs.d.ts +2 -0
  127. package/dist/types/actions/package/compile/inputs.d.ts.map +1 -0
  128. package/dist/types/actions/package/compile/packageCompileTsc.d.ts +4 -0
  129. package/dist/types/actions/package/compile/packageCompileTsc.d.ts.map +1 -0
  130. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts +4 -0
  131. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts.map +1 -0
  132. package/dist/types/actions/package/compile/packageCompileTsup.d.ts +5 -0
  133. package/dist/types/actions/package/compile/packageCompileTsup.d.ts.map +1 -0
  134. package/dist/types/actions/package/copy-assets.d.ts +5 -0
  135. package/dist/types/actions/package/copy-assets.d.ts.map +1 -0
  136. package/dist/types/actions/package/deps.d.ts +2 -0
  137. package/dist/types/actions/package/deps.d.ts.map +1 -0
  138. package/dist/types/actions/package/gen-docs.d.ts +2 -0
  139. package/dist/types/actions/package/gen-docs.d.ts.map +1 -0
  140. package/dist/types/actions/package/index.d.ts +11 -0
  141. package/dist/types/actions/package/index.d.ts.map +1 -0
  142. package/dist/types/actions/package/lint.d.ts +2 -0
  143. package/dist/types/actions/package/lint.d.ts.map +1 -0
  144. package/dist/types/actions/package/publint.d.ts +5 -0
  145. package/dist/types/actions/package/publint.d.ts.map +1 -0
  146. package/dist/types/actions/package/recompile.d.ts +2 -0
  147. package/dist/types/actions/package/recompile.d.ts.map +1 -0
  148. package/dist/types/actions/publint.d.ts +12 -0
  149. package/dist/types/actions/publint.d.ts.map +1 -0
  150. package/dist/types/actions/rebuild.d.ts +6 -0
  151. package/dist/types/actions/rebuild.d.ts.map +1 -0
  152. package/dist/types/actions/recompile.d.ts +16 -0
  153. package/dist/types/actions/recompile.d.ts.map +1 -0
  154. package/dist/types/actions/reinstall.d.ts +2 -0
  155. package/dist/types/actions/reinstall.d.ts.map +1 -0
  156. package/dist/types/actions/relint.d.ts +13 -0
  157. package/dist/types/actions/relint.d.ts.map +1 -0
  158. package/dist/types/actions/retest.d.ts +2 -0
  159. package/dist/types/actions/retest.d.ts.map +1 -0
  160. package/dist/types/actions/sonar.d.ts +2 -0
  161. package/dist/types/actions/sonar.d.ts.map +1 -0
  162. package/dist/types/actions/statics.d.ts +2 -0
  163. package/dist/types/actions/statics.d.ts.map +1 -0
  164. package/dist/types/actions/test.d.ts +2 -0
  165. package/dist/types/actions/test.d.ts.map +1 -0
  166. package/dist/types/actions/up.d.ts +2 -0
  167. package/dist/types/actions/up.d.ts.map +1 -0
  168. package/dist/types/actions/updo.d.ts +2 -0
  169. package/dist/types/actions/updo.d.ts.map +1 -0
  170. package/dist/types/actions/upplug.d.ts +2 -0
  171. package/dist/types/actions/upplug.d.ts.map +1 -0
  172. package/dist/types/actions/upyarn.d.ts +2 -0
  173. package/dist/types/actions/upyarn.d.ts.map +1 -0
  174. package/dist/types/actions/yarn3only.d.ts +2 -0
  175. package/dist/types/actions/yarn3only.d.ts.map +1 -0
  176. package/dist/types/bin/package/build-only.d.ts +3 -0
  177. package/dist/types/bin/package/build-only.d.ts.map +1 -0
  178. package/dist/types/bin/package/build.d.ts +3 -0
  179. package/dist/types/bin/package/build.d.ts.map +1 -0
  180. package/dist/types/bin/package/clean-outputs.d.ts +3 -0
  181. package/dist/types/bin/package/clean-outputs.d.ts.map +1 -0
  182. package/dist/types/bin/package/clean-typescript.d.ts +3 -0
  183. package/dist/types/bin/package/clean-typescript.d.ts.map +1 -0
  184. package/dist/types/bin/package/clean.d.ts +3 -0
  185. package/dist/types/bin/package/clean.d.ts.map +1 -0
  186. package/dist/types/bin/package/compile-only.d.ts +3 -0
  187. package/dist/types/bin/package/compile-only.d.ts.map +1 -0
  188. package/dist/types/bin/package/compile-tsup.d.ts +3 -0
  189. package/dist/types/bin/package/compile-tsup.d.ts.map +1 -0
  190. package/dist/types/bin/package/compile-types.d.ts +3 -0
  191. package/dist/types/bin/package/compile-types.d.ts.map +1 -0
  192. package/dist/types/bin/package/compile.d.ts +3 -0
  193. package/dist/types/bin/package/compile.d.ts.map +1 -0
  194. package/dist/types/bin/package/copy-assets-cjs.d.ts +3 -0
  195. package/dist/types/bin/package/copy-assets-cjs.d.ts.map +1 -0
  196. package/dist/types/bin/package/copy-assets-esm.d.ts +3 -0
  197. package/dist/types/bin/package/copy-assets-esm.d.ts.map +1 -0
  198. package/dist/types/bin/package/deps.d.ts +3 -0
  199. package/dist/types/bin/package/deps.d.ts.map +1 -0
  200. package/dist/types/bin/package/fix.d.ts +3 -0
  201. package/dist/types/bin/package/fix.d.ts.map +1 -0
  202. package/dist/types/bin/package/gen-docs.d.ts +3 -0
  203. package/dist/types/bin/package/gen-docs.d.ts.map +1 -0
  204. package/dist/types/bin/package/lint.d.ts +3 -0
  205. package/dist/types/bin/package/lint.d.ts.map +1 -0
  206. package/dist/types/bin/package/publint.d.ts +3 -0
  207. package/dist/types/bin/package/publint.d.ts.map +1 -0
  208. package/dist/types/bin/package/recompile.d.ts +3 -0
  209. package/dist/types/bin/package/recompile.d.ts.map +1 -0
  210. package/dist/types/bin/package/relint.d.ts +3 -0
  211. package/dist/types/bin/package/relint.d.ts.map +1 -0
  212. package/dist/types/bin/xy.d.ts +3 -0
  213. package/dist/types/bin/xy.d.ts.map +1 -0
  214. package/dist/types/index.d.ts +5 -0
  215. package/dist/types/index.d.ts.map +1 -0
  216. package/dist/types/lib/checkResult.d.ts +2 -0
  217. package/dist/types/lib/checkResult.d.ts.map +1 -0
  218. package/dist/types/lib/createBuildConfig.d.ts +2 -0
  219. package/dist/types/lib/createBuildConfig.d.ts.map +1 -0
  220. package/dist/types/lib/defaultBuildConfig.d.ts +9 -0
  221. package/dist/types/lib/defaultBuildConfig.d.ts.map +1 -0
  222. package/dist/types/lib/deleteGlob.d.ts +2 -0
  223. package/dist/types/lib/deleteGlob.d.ts.map +1 -0
  224. package/dist/types/lib/dependencies/DuplicateDetector.d.ts +9 -0
  225. package/dist/types/lib/dependencies/DuplicateDetector.d.ts.map +1 -0
  226. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts +2 -0
  227. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts.map +1 -0
  228. package/dist/types/lib/dependencies/index.d.ts +3 -0
  229. package/dist/types/lib/dependencies/index.d.ts.map +1 -0
  230. package/dist/types/lib/file/ReadFileSyncOptions.d.ts +6 -0
  231. package/dist/types/lib/file/ReadFileSyncOptions.d.ts.map +1 -0
  232. package/dist/types/lib/file/constants.d.ts +3 -0
  233. package/dist/types/lib/file/constants.d.ts.map +1 -0
  234. package/dist/types/lib/file/fileLines.d.ts +6 -0
  235. package/dist/types/lib/file/fileLines.d.ts.map +1 -0
  236. package/dist/types/lib/file/index.d.ts +5 -0
  237. package/dist/types/lib/file/index.d.ts.map +1 -0
  238. package/dist/types/lib/file/tryReadFileSync.d.ts +4 -0
  239. package/dist/types/lib/file/tryReadFileSync.d.ts.map +1 -0
  240. package/dist/types/lib/generateIgnoreFiles.d.ts +2 -0
  241. package/dist/types/lib/generateIgnoreFiles.d.ts.map +1 -0
  242. package/dist/types/lib/index.d.ts +21 -0
  243. package/dist/types/lib/index.d.ts.map +1 -0
  244. package/dist/types/lib/jsonFormatters.d.ts +2 -0
  245. package/dist/types/lib/jsonFormatters.d.ts.map +1 -0
  246. package/dist/types/lib/loadConfig.d.ts +2 -0
  247. package/dist/types/lib/loadConfig.d.ts.map +1 -0
  248. package/dist/types/lib/parsedPackageJSON.d.ts +2 -0
  249. package/dist/types/lib/parsedPackageJSON.d.ts.map +1 -0
  250. package/dist/types/lib/processEx.d.ts +2 -0
  251. package/dist/types/lib/processEx.d.ts.map +1 -0
  252. package/dist/types/lib/runSteps.d.ts +4 -0
  253. package/dist/types/lib/runSteps.d.ts.map +1 -0
  254. package/dist/types/lib/runStepsAsync.d.ts +4 -0
  255. package/dist/types/lib/runStepsAsync.d.ts.map +1 -0
  256. package/dist/types/lib/runXy.d.ts +2 -0
  257. package/dist/types/lib/runXy.d.ts.map +1 -0
  258. package/dist/types/lib/runXyWithWarning.d.ts +2 -0
  259. package/dist/types/lib/runXyWithWarning.d.ts.map +1 -0
  260. package/dist/types/lib/safeExit.d.ts +5 -0
  261. package/dist/types/lib/safeExit.d.ts.map +1 -0
  262. package/dist/types/lib/string/empty.d.ts +3 -0
  263. package/dist/types/lib/string/empty.d.ts.map +1 -0
  264. package/dist/types/lib/string/index.d.ts +3 -0
  265. package/dist/types/lib/string/index.d.ts.map +1 -0
  266. package/dist/types/lib/string/union.d.ts +2 -0
  267. package/dist/types/lib/string/union.d.ts.map +1 -0
  268. package/dist/types/lib/withErrnoException.d.ts +2 -0
  269. package/dist/types/lib/withErrnoException.d.ts.map +1 -0
  270. package/dist/types/lib/withError.d.ts +2 -0
  271. package/dist/types/lib/withError.d.ts.map +1 -0
  272. package/dist/types/lib/yarn/index.d.ts +4 -0
  273. package/dist/types/lib/yarn/index.d.ts.map +1 -0
  274. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts +2 -0
  275. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts.map +1 -0
  276. package/dist/types/lib/yarn/workspace/Workspace.d.ts +5 -0
  277. package/dist/types/lib/yarn/workspace/Workspace.d.ts.map +1 -0
  278. package/dist/types/lib/yarn/workspace/index.d.ts +4 -0
  279. package/dist/types/lib/yarn/workspace/index.d.ts.map +1 -0
  280. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts +3 -0
  281. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts.map +1 -0
  282. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts +3 -0
  283. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts.map +1 -0
  284. package/dist/types/lib/yarn/yarnInitCwd.d.ts +2 -0
  285. package/dist/types/lib/yarn/yarnInitCwd.d.ts.map +1 -0
  286. package/dist/types/loadPackageConfig.d.ts +6 -0
  287. package/dist/types/loadPackageConfig.d.ts.map +1 -0
  288. package/dist/types/xy/index.d.ts +8 -0
  289. package/dist/types/xy/index.d.ts.map +1 -0
  290. package/dist/types/xy/param.d.ts +5 -0
  291. package/dist/types/xy/param.d.ts.map +1 -0
  292. package/dist/types/xy/xy.d.ts +10 -0
  293. package/dist/types/xy/xy.d.ts.map +1 -0
  294. package/dist/types/xy/xyBuildCommands.d.ts +3 -0
  295. package/dist/types/xy/xyBuildCommands.d.ts.map +1 -0
  296. package/dist/types/xy/xyCommonCommands.d.ts +3 -0
  297. package/dist/types/xy/xyCommonCommands.d.ts.map +1 -0
  298. package/dist/types/xy/xyDeployCommands.d.ts +3 -0
  299. package/dist/types/xy/xyDeployCommands.d.ts.map +1 -0
  300. package/dist/types/xy/xyInstallCommands.d.ts +3 -0
  301. package/dist/types/xy/xyInstallCommands.d.ts.map +1 -0
  302. package/dist/types/xy/xyLintCommands.d.ts +3 -0
  303. package/dist/types/xy/xyLintCommands.d.ts.map +1 -0
  304. package/dist/types/xy/xyParseOptions.d.ts +3 -0
  305. package/dist/types/xy/xyParseOptions.d.ts.map +1 -0
  306. package/dist/xy/index.mjs +22 -33
  307. package/dist/xy/index.mjs.map +1 -1
  308. package/dist/xy/xy.mjs +22 -33
  309. package/dist/xy/xy.mjs.map +1 -1
  310. package/dist/xy/xyBuildCommands.mjs +20 -19
  311. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  312. package/dist/xy/xyLintCommands.mjs +2 -14
  313. package/dist/xy/xyLintCommands.mjs.map +1 -1
  314. package/package.json +4 -4
  315. package/src/actions/build.ts +1 -0
  316. package/src/actions/compile-types.ts +1 -1
  317. package/src/actions/compile.ts +7 -11
  318. package/src/actions/lint.ts +1 -5
  319. package/src/actions/package/compile/XyConfig.ts +0 -4
  320. package/src/actions/package/compile/compile.ts +15 -17
  321. package/src/actions/package/compile/packageCompileTscTypes.ts +21 -29
  322. package/src/actions/package/compile/packageCompileTsup.ts +12 -19
  323. package/src/actions/recompile.ts +2 -5
  324. package/src/actions/relint.ts +1 -3
  325. package/src/bin/package/build-only.ts +1 -1
  326. package/src/bin/package/build.ts +1 -1
  327. package/src/bin/package/clean-outputs.ts +1 -8
  328. package/src/bin/package/clean-typescript.ts +1 -8
  329. package/src/xy/xyBuildCommands.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/recompile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface RecompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport interface RecompilePackageParams {\n pkg: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const recompile = async ({\n verbose, target, pkg, incremental,\n}: RecompileParams) => {\n return pkg\n ? await recompilePackage({\n pkg, target, verbose,\n })\n : await recompileAll({\n incremental, target, verbose,\n })\n}\n\nexport const recompilePackage = ({\n verbose, target, pkg,\n}: RecompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n\n return runStepsAsync(\n `Recompile [${pkg}]`,\n [['yarn', ['workspace', pkg, ...verboseOptions, 'run', 'package-recompile', ...targetOptions]]],\n )\n}\n\nexport const recompileAll = async ({\n jobs, verbose, target, incremental,\n}: RecompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental\n ? ['--since', '-Apt', '--topological-dev']\n : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Recompile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-clean',\n ...targetOptions],\n ],\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile',\n ...targetOptions]],\n ])\n console.log(\n `${chalk.gray('Recompiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`,\n )\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,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GU;WACAC;WACAP;QACH;QACA;WACGD;;;IAEP;MAAC;MACC;QACE;QACA;WACGO;WACAC;WACAP;QACH;QACA;WACGD;;;GACR;AACDS,UAAQC,IACN,GAAGC,OAAMG,KAAK,eAAA,CAAA,KAAqBH,OAAMI,UAAUV,KAAKC,IAAG,IAAKF,SAAS,KAAMY,QAAQ,CAAA,CAAA,CAAA,KAAQL,OAAMG,KAAK,SAAA,CAAA,EAAY;AAExH,SAAOD;AACT,GAzC4B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","recompile","verbose","target","pkg","incremental","recompilePackage","recompileAll","targetOptions","verboseOptions","runStepsAsync","jobs","start","Date","now","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/recompile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface RecompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport interface RecompilePackageParams {\n pkg: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const recompile = async ({\n verbose, target, pkg, incremental,\n}: RecompileParams) => {\n return pkg\n ? await recompilePackage({\n pkg, target, verbose,\n })\n : await recompileAll({\n incremental, target, verbose,\n })\n}\n\nexport const recompilePackage = ({ target, pkg }: RecompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runStepsAsync(\n `Recompile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-recompile', ...targetOptions]]],\n )\n}\n\nexport const recompileAll = async ({\n jobs, verbose, target, incremental,\n}: RecompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental\n ? ['--since', '-Apt', '--topological-dev']\n : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Recompile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-clean',\n ...targetOptions],\n ],\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile',\n ...targetOptions]],\n ])\n console.log(\n `${chalk.gray('Recompiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`,\n )\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAW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C,IACN,GAAGC,OAAMG,KAAK,eAAA,CAAA,KAAqBH,OAAMI,UAAUX,KAAKC,IAAG,IAAKF,SAAS,KAAMa,QAAQ,CAAA,CAAA,CAAA,KAAQL,OAAMG,KAAK,SAAA,CAAA,EAAY;AAExH,SAAOD;AACT,GAzC4B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","recompile","verbose","target","pkg","incremental","recompilePackage","recompileAll","targetOptions","runStepsAsync","jobs","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
@@ -98,21 +98,15 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
98
98
  }, "runSteps");
99
99
 
100
100
  // src/actions/relint.ts
101
- var relintPackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
101
+ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
102
102
  console.log(chalk4.gray(`${"Relint"} [All-Packages]`));
103
103
  const start = Date.now();
104
- const verboseOptions = verbose ? [
105
- "--verbose"
106
- ] : [
107
- "--no-verbose"
108
- ];
109
104
  const result = runSteps("Relint [All-Packages]", [
110
105
  [
111
106
  "yarn",
112
107
  [
113
108
  "workspace",
114
109
  pkg,
115
- ...verboseOptions,
116
110
  "run",
117
111
  "package-relint"
118
112
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/relint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface RelintParams {\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface RelintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const relintPackage = ({ pkg, verbose }: RelintParams & Required<Pick<RelintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${'Relint'} [All-Packages]`))\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n\n const result = runSteps('Relint [All-Packages]', [\n ['yarn', ['workspace',\n pkg,\n ...verboseOptions,\n 'run',\n 'package-relint',\n ]],\n ])\n console.log(chalk.gray(`${'Relinted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const relint = ({\n pkg, verbose, incremental,\n}: RelintParams = {}) => {\n return pkg\n ? relintPackage({ pkg })\n : relintAllPackages({ verbose, incremental })\n}\n\nexport const relintAllPackages = ({ verbose = true, incremental }: RelintParams = {}) => {\n console.log(chalk.gray(`${'Relint'} [All-Packages]`))\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n\n const result = runSteps(`${'Relint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\n 'run',\n 'package-relint',\n ]],\n ])\n console.log(chalk.gray(`Relinted in [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,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EH;AACDf,UAAQC,IAAIC,OAAMC,KAAK,gBAAgBD,OAAMQ,UAAUL,KAAKC,IAAG,IAAKF,SAAS,KAAMO,QAAQ,CAAA,CAAA,CAAA,KAAQT,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAC1H,SAAOK;AACT,GAjBiC;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","relintPackage","pkg","verbose","console","log","chalk","gray","start","Date","now","verboseOptions","result","runSteps","magenta","toFixed","relint","incremental","relintAllPackages","incrementalOptions"]}
1
+ {"version":3,"sources":["../../src/actions/relint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface RelintParams {\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface RelintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const relintPackage = ({ pkg }: RelintParams & Required<Pick<RelintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${'Relint'} [All-Packages]`))\n const start = Date.now()\n\n const result = runSteps('Relint [All-Packages]', [\n ['yarn', ['workspace',\n pkg,\n 'run',\n 'package-relint',\n ]],\n ])\n console.log(chalk.gray(`${'Relinted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const relint = ({\n pkg, verbose, incremental,\n}: RelintParams = {}) => {\n return pkg\n ? relintPackage({ pkg })\n : relintAllPackages({ verbose, incremental })\n}\n\nexport const relintAllPackages = ({ verbose = true, incremental }: RelintParams = {}) => {\n console.log(chalk.gray(`${'Relint'} [All-Packages]`))\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n\n const result = runSteps(`${'Relint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\n 'run',\n 'package-relint',\n ]],\n ])\n console.log(chalk.gray(`Relinted in [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,Y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A;AAC/H,SAAOI;AACT,GAb6B;AAetB,IAAMI,SAAS,wBAAC,EACrBZ,KAAKa,SAASC,YAAW,IACT,CAAC,MAAC;AAClB,SAAOd,MACHD,cAAc;IAAEC;EAAI,CAAA,IACpBe,kBAAkB;IAAEF;IAASC;EAAY,CAAA;AAC/C,GANsB;AAQf,IAAMC,oBAAoB,wBAAC,EAAEF,UAAU,MAAMC,YAAW,IAAmB,CAAC,MAAC;AAClFb,UAAQC,IAAIC,OAAMC,KAAK,GAAG,QAAA,iBAAyB,CAAA;AACnD,QAAMC,QAAQC,KAAKC,IAAG;AACtB,QAAMS,iBAAiBH,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMI,qBAAqBH,cAAc;IAAC;IAAW;MAAS;IAAC;IAAc;;AAE7E,QAAMN,SAASC,SAAS,GAAG,QAAA,oBAA4B;IACrD;MAAC;MAAQ;QAAC;QACR;WACGO;WACAC;QACH;QACA;;;GAEH;AACDhB,UAAQC,IAAIC,OAAMC,KAAK,gBAAgBD,OAAMO,UAAUJ,KAAKC,IAAG,IAAKF,SAAS,KAAMM,QAAQ,CAAA,CAAA,CAAA,KAAQR,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAC1H,SAAOI;AACT,GAjBiC;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","relintPackage","pkg","console","log","chalk","gray","start","Date","now","result","runSteps","magenta","toFixed","relint","verbose","incremental","relintAllPackages","verboseOptions","incrementalOptions"]}
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
 
5
5
  // src/bin/package/build-only.ts
6
- import chalk6 from "chalk";
6
+ import chalk5 from "chalk";
7
7
 
8
8
  // src/lib/loadConfig.ts
9
9
  import chalk from "chalk";
@@ -26,7 +26,7 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
26
26
  }, "loadConfig");
27
27
 
28
28
  // src/actions/package/compile/compile.ts
29
- import chalk5 from "chalk";
29
+ import chalk4 from "chalk";
30
30
 
31
31
  // src/actions/package/publint.ts
32
32
  import { promises as fs } from "node:fs";
@@ -72,88 +72,13 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
72
72
  return validMessages.filter((message) => message.type === "error").length;
73
73
  }, "packagePublint");
74
74
 
75
- // src/actions/package/compile/packageCompileTsc.ts
76
- import { cwd } from "node:process";
75
+ // src/actions/package/compile/compileTypes.ts
77
76
  import chalk3 from "chalk";
78
- import { createProgramFromConfig } from "tsc-prog";
79
- import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getLineAndCharacterOfPosition, getPreEmitDiagnostics } from "typescript";
80
-
81
- // src/actions/package/compile/getCompilerOptions.ts
82
- import { createRequire } from "node:module";
83
- import deepmerge2 from "deepmerge";
84
- import { findConfigFile, readConfigFile, sys } from "typescript";
85
- var getNested = /* @__PURE__ */ __name((config2) => {
86
- if (config2.extends) {
87
- const require2 = createRequire(import.meta.url);
88
- const opts = require2(config2.extends);
89
- return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
90
- }
91
- return config2.compilerOptions;
92
- }, "getNested");
93
- var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename) => {
94
- const config2 = readConfigFile(filename, sys.readFile).config;
95
- return getNested(config2);
96
- }, "getCompilerOptionsJSONFollowExtends");
97
- var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tsconfig.json") => {
98
- const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
99
- const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
100
- return deepmerge2(configFileCompilerOptions, options);
101
- }, "getCompilerOptions");
102
-
103
- // src/actions/package/compile/packageCompileTsc.ts
104
- var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerOptionsParam) => {
105
- const pkg = process.env.INIT_CWD ?? cwd();
106
- const publint = config2?.publint ?? true;
107
- const verbose = config2?.verbose ?? false;
108
- const formatHost = {
109
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
110
- getCurrentDirectory: /* @__PURE__ */ __name(() => pkg, "getCurrentDirectory"),
111
- getNewLine: /* @__PURE__ */ __name(() => "\n", "getNewLine")
112
- };
113
- if (verbose) {
114
- console.log(`Compiling with NoEmit TSC [${pkg}]`);
115
- }
116
- const compilerOptions = {
117
- ...getCompilerOptions({
118
- outDir: "dist",
119
- removeComments: true,
120
- rootDir: "src"
121
- }),
122
- ...compilerOptionsParam,
123
- ...noEmit === void 0 ? {} : {
124
- noEmit
125
- }
126
- };
127
- const program = createProgramFromConfig({
128
- basePath: pkg ?? cwd(),
129
- compilerOptions,
130
- exclude: [
131
- "dist",
132
- "docs",
133
- "**/*.spec.*",
134
- "**/*.stories.*",
135
- "src/**/spec/**/*"
136
- ],
137
- include: [
138
- "src"
139
- ]
140
- });
141
- const results = getPreEmitDiagnostics(program);
142
- for (const diag of results) {
143
- const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : {
144
- character: 0,
145
- line: 0
146
- };
147
- console.log(chalk3.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
148
- console.log(formatDiagnosticsWithColorAndContext([
149
- diag
150
- ], formatHost));
151
- }
152
- return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory.Error ? 1 : 0, 0) || (publint ? await packagePublint() : 0);
153
- }, "packageCompileTsc");
154
77
 
155
- // src/actions/package/compile/packageCompileTsup.ts
156
- import { build, defineConfig } from "tsup";
78
+ // src/actions/package/compile/packageCompileTscTypes.ts
79
+ import { cwd } from "node:process";
80
+ import { createProgramFromConfig } from "tsc-prog";
81
+ import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
157
82
 
158
83
  // src/actions/package/compile/inputs.ts
159
84
  import { glob } from "glob";
@@ -194,45 +119,37 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose
194
119
  return entries;
195
120
  }, "buildEntries");
196
121
 
197
- // src/actions/package/compile/deepMerge.ts
198
- function deepMerge(target, source) {
199
- if (!source || typeof source !== "object") return target;
200
- for (const key of Object.keys(source)) {
201
- if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
202
- if (!target[key] || typeof target[key] !== "object") {
203
- target[key] = {};
204
- }
205
- deepMerge(target[key], source[key]);
206
- } else {
207
- target[key] = source[key];
208
- }
209
- }
210
- return target;
211
- }
212
- __name(deepMerge, "deepMerge");
213
- function deepMergeObjects(objects) {
214
- const result = {};
215
- for (const obj of objects) {
216
- deepMerge(result, obj);
122
+ // src/actions/package/compile/getCompilerOptions.ts
123
+ import { createRequire } from "node:module";
124
+ import deepmerge2 from "deepmerge";
125
+ import { findConfigFile, readConfigFile, sys } from "typescript";
126
+ var getNested = /* @__PURE__ */ __name((config2) => {
127
+ if (config2.extends) {
128
+ const require2 = createRequire(import.meta.url);
129
+ const opts = require2(config2.extends);
130
+ return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
217
131
  }
218
- return result;
219
- }
220
- __name(deepMergeObjects, "deepMergeObjects");
132
+ return config2.compilerOptions;
133
+ }, "getNested");
134
+ var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename) => {
135
+ const config2 = readConfigFile(filename, sys.readFile).config;
136
+ return getNested(config2);
137
+ }, "getCompilerOptionsJSONFollowExtends");
138
+ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tsconfig.json") => {
139
+ const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
140
+ const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
141
+ return deepmerge2(configFileCompilerOptions, options);
142
+ }, "getCompilerOptions");
221
143
 
222
144
  // src/actions/package/compile/packageCompileTscTypes.ts
223
- import { cwd as cwd2 } from "node:process";
224
- import chalk4 from "chalk";
225
- import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
226
- import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
227
145
  var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
228
- const pkg = process.env.INIT_CWD ?? cwd2();
146
+ const pkg = process.env.INIT_CWD ?? cwd();
229
147
  const verbose = config2?.verbose ?? false;
230
148
  if (verbose) {
231
- console.log(`Compiling types with TSC [${pkg}]`);
149
+ console.log(`Compiling types [${pkg}]`);
232
150
  }
233
151
  const compilerOptions = {
234
152
  ...getCompilerOptions({
235
- declaration: true,
236
153
  emitDeclarationOnly: true,
237
154
  outDir: "dist/types",
238
155
  removeComments: false,
@@ -245,8 +162,8 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
245
162
  noEmit: false
246
163
  };
247
164
  const files = buildEntries(folder, "all", verbose);
248
- const result = createProgramFromConfig2({
249
- basePath: pkg ?? cwd2(),
165
+ const program = createProgramFromConfig({
166
+ basePath: pkg ?? cwd(),
250
167
  compilerOptions,
251
168
  exclude: [
252
169
  "dist",
@@ -256,35 +173,58 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
256
173
  "src/**/spec/**/*"
257
174
  ],
258
175
  files
259
- }).emit();
260
- const diagResults = result.diagnostics.length;
261
- for (const diag of result.diagnostics) {
262
- switch (diag.category) {
263
- case DiagnosticCategory2.Error: {
264
- console.error(chalk4.red(diag.messageText));
265
- console.error(chalk4.grey(pkg));
266
- console.error(chalk4.blue(diag.file?.fileName));
267
- break;
268
- }
269
- case DiagnosticCategory2.Warning: {
270
- console.error(chalk4.yellow(diag.messageText));
271
- console.error(chalk4.grey(pkg));
272
- console.error(chalk4.blue(diag.file?.fileName));
273
- break;
274
- }
275
- case DiagnosticCategory2.Suggestion: {
276
- console.error(chalk4.white(diag.messageText));
277
- console.error(chalk4.grey(pkg));
278
- console.error(chalk4.blue(diag.file?.fileName));
279
- break;
176
+ });
177
+ const diagnostics = getPreEmitDiagnostics(program);
178
+ if (diagnostics.length > 0) {
179
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
180
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
181
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
182
+ getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
183
+ });
184
+ console.error(formattedDiagnostics);
185
+ }
186
+ program.emit();
187
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
188
+ }, "packageCompileTscTypes");
189
+
190
+ // src/actions/package/compile/compileTypes.ts
191
+ var packageCompileTypes = /* @__PURE__ */ __name(async (inConfig = {}) => {
192
+ const pkg = process.env.INIT_CWD;
193
+ console.log(chalk3.green(`Compiling Types ${pkg}`));
194
+ const config2 = await loadConfig(inConfig);
195
+ return packageCompileTscTypes(void 0, config2);
196
+ }, "packageCompileTypes");
197
+
198
+ // src/actions/package/compile/packageCompileTsup.ts
199
+ import { build, defineConfig } from "tsup";
200
+
201
+ // src/actions/package/compile/deepMerge.ts
202
+ function deepMerge(target, source) {
203
+ if (!source || typeof source !== "object") return target;
204
+ for (const key of Object.keys(source)) {
205
+ if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
206
+ if (!target[key] || typeof target[key] !== "object") {
207
+ target[key] = {};
280
208
  }
209
+ deepMerge(target[key], source[key]);
210
+ } else {
211
+ target[key] = source[key];
281
212
  }
282
213
  }
283
- return diagResults;
284
- }, "packageCompileTscTypes");
214
+ return target;
215
+ }
216
+ __name(deepMerge, "deepMerge");
217
+ function deepMergeObjects(objects) {
218
+ const result = {};
219
+ for (const obj of objects) {
220
+ deepMerge(result, obj);
221
+ }
222
+ return result;
223
+ }
224
+ __name(deepMergeObjects, "deepMergeObjects");
285
225
 
286
226
  // src/actions/package/compile/packageCompileTsup.ts
287
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, types = "tsc", verbose) => {
227
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
288
228
  const outDir = options?.outDir ?? "dist";
289
229
  if (verbose) {
290
230
  console.log(`compileFolder [${folder}]`);
@@ -294,7 +234,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
294
234
  bundle: true,
295
235
  cjsInterop: true,
296
236
  clean: true,
297
- dts: types === "tsup",
237
+ dts: false,
298
238
  entry,
299
239
  format: [
300
240
  "esm"
@@ -317,11 +257,11 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
317
257
  ];
318
258
  }))).flat();
319
259
  if (verbose) {
320
- console.log(`TSUP:build:start [${folder}] ${types}`);
260
+ console.log(`TSUP:build:start [${folder}]`);
321
261
  }
322
262
  await Promise.all(optionsList.map((options2) => build(options2)));
323
263
  if (verbose) {
324
- console.log(`TSUP:build:stop [${folder}] ${types}`);
264
+ console.log(`TSUP:build:stop [${folder}]`);
325
265
  }
326
266
  return 0;
327
267
  }, "compileFolder");
@@ -355,8 +295,8 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
355
295
  ...options
356
296
  ]);
357
297
  }, "tsupOptions");
358
- var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsc") => {
359
- console.warn("packageCompileTsup-types", types);
298
+ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
299
+ console.log("packageCompileTsup-types");
360
300
  const compile = config2?.compile;
361
301
  const verbose = config2?.verbose ?? false;
362
302
  if (verbose) {
@@ -371,16 +311,12 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsc") =
371
311
  const compileForNeutral = compile?.neutral ?? {
372
312
  src: {}
373
313
  };
374
- if (types === "tsc") {
375
- if (verbose) {
376
- console.log(`Calling packageCompileTscTypes [${types}`);
377
- }
378
- const errors = packageCompileTscTypes("src", {
379
- verbose
380
- });
381
- if (errors) {
382
- return errors;
383
- }
314
+ if (verbose) {
315
+ console.log("Calling packageCompileTscTypes");
316
+ }
317
+ const errors = await packageCompileTypes(config2);
318
+ if (errors > 0) {
319
+ return errors;
384
320
  }
385
321
  return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
386
322
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
@@ -392,7 +328,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsc") =
392
328
  platform: "node",
393
329
  outDir: "dist/node"
394
330
  }
395
- ]), types, verbose) : 0;
331
+ ]), verbose) : 0;
396
332
  }))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
397
333
  const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === "object" ? compile?.browser?.esbuildOptions : {};
398
334
  return folder ? await compileFolder(folder, compile?.entryMode, tsupOptions([
@@ -403,7 +339,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsc") =
403
339
  platform: "browser",
404
340
  outDir: "dist/browser"
405
341
  }
406
- ]), types, verbose) : 0;
342
+ ]), verbose) : 0;
407
343
  }))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
408
344
  const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === "object" ? compile?.neutral?.esbuildOptions : {};
409
345
  return folder ? await compileFolder(folder, compile?.entryMode, tsupOptions([
@@ -414,41 +350,37 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsc") =
414
350
  platform: "neutral",
415
351
  outDir: "dist/neutral"
416
352
  }
417
- ]), types, verbose) : 0;
353
+ ]), verbose) : 0;
418
354
  }))).reduce((prev, value) => prev + value, 0) || 0;
419
355
  }, "packageCompileTsup");
420
356
 
421
357
  // src/actions/package/compile/compile.ts
422
- var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}, types) => {
358
+ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
423
359
  const pkg = process.env.INIT_CWD;
424
- console.log(chalk5.green(`Compiling ${pkg}`));
360
+ console.log(chalk4.green(`Compiling ${pkg}`));
425
361
  const config2 = await loadConfig(inConfig);
426
362
  const publint = config2.publint;
427
- const mode = config2.compile?.mode ?? "tsup";
428
- let result = 0;
429
- switch (mode) {
430
- case "tsc": {
431
- result += await packageCompileTsc(void 0, config2);
432
- break;
433
- }
434
- case "tsup": {
435
- result += await packageCompileTsup(config2, types);
436
- break;
437
- }
363
+ const tscResults = await packageCompileTypes(config2);
364
+ if (tscResults > 0) {
365
+ return tscResults;
366
+ }
367
+ const tsupResults = await packageCompileTsup(config2);
368
+ if (tsupResults > 0) {
369
+ return tsupResults;
438
370
  }
439
- return result + (publint ? await packagePublint(config2) : 0);
371
+ return publint ? await packagePublint(config2) : 0;
440
372
  }, "packageCompile");
441
373
 
442
374
  // src/bin/package/build-only.ts
443
375
  packageCompile({
444
376
  verbose: true,
445
377
  publint: false
446
- }, "tsc").then((value) => {
378
+ }).then((value) => {
447
379
  if (value) {
448
380
  process.exit(value);
449
381
  }
450
382
  }).catch((reason) => {
451
- console.error(chalk6.red(reason));
383
+ console.error(chalk5.red(reason));
452
384
  process.exit(-1);
453
385
  });
454
386
  //# sourceMappingURL=build-only.mjs.map