@xylabs/ts-scripts-yarn3 6.1.4 → 6.1.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 (284) hide show
  1. package/dist/actions/index.mjs +57 -60
  2. package/dist/actions/index.mjs.map +1 -1
  3. package/dist/actions/package/compile/compile.mjs +57 -4
  4. package/dist/actions/package/compile/compile.mjs.map +1 -1
  5. package/dist/actions/package/compile/index.mjs +57 -60
  6. package/dist/actions/package/compile/index.mjs.map +1 -1
  7. package/dist/actions/package/compile/packageCompileTsc.mjs +68 -76
  8. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  9. package/dist/actions/package/compile/packageCompileTsup.mjs +55 -2
  10. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  11. package/dist/actions/package/index.mjs +57 -60
  12. package/dist/actions/package/index.mjs.map +1 -1
  13. package/dist/actions/package/recompile.mjs +57 -4
  14. package/dist/actions/package/recompile.mjs.map +1 -1
  15. package/dist/bin/package/build-only.mjs +59 -6
  16. package/dist/bin/package/build-only.mjs.map +1 -1
  17. package/dist/bin/package/build.mjs +59 -6
  18. package/dist/bin/package/build.mjs.map +1 -1
  19. package/dist/bin/package/compile-only.mjs +59 -6
  20. package/dist/bin/package/compile-only.mjs.map +1 -1
  21. package/dist/bin/package/compile-tsup.mjs +57 -4
  22. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  23. package/dist/bin/package/compile.mjs +59 -6
  24. package/dist/bin/package/compile.mjs.map +1 -1
  25. package/dist/bin/package/recompile.mjs +59 -6
  26. package/dist/bin/package/recompile.mjs.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.mjs +57 -60
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +12 -12
  31. package/dist/types/actions/build.d.ts +0 -9
  32. package/dist/types/actions/build.d.ts.map +0 -1
  33. package/dist/types/actions/clean-docs.d.ts +0 -2
  34. package/dist/types/actions/clean-docs.d.ts.map +0 -1
  35. package/dist/types/actions/clean-eslint.d.ts +0 -2
  36. package/dist/types/actions/clean-eslint.d.ts.map +0 -1
  37. package/dist/types/actions/clean-jest.d.ts +0 -2
  38. package/dist/types/actions/clean-jest.d.ts.map +0 -1
  39. package/dist/types/actions/clean.d.ts +0 -12
  40. package/dist/types/actions/clean.d.ts.map +0 -1
  41. package/dist/types/actions/compile-types.d.ts +0 -16
  42. package/dist/types/actions/compile-types.d.ts.map +0 -1
  43. package/dist/types/actions/compile.d.ts +0 -19
  44. package/dist/types/actions/compile.d.ts.map +0 -1
  45. package/dist/types/actions/copy-assets.d.ts +0 -6
  46. package/dist/types/actions/copy-assets.d.ts.map +0 -1
  47. package/dist/types/actions/cycle.d.ts +0 -2
  48. package/dist/types/actions/cycle.d.ts.map +0 -1
  49. package/dist/types/actions/dead.d.ts +0 -2
  50. package/dist/types/actions/dead.d.ts.map +0 -1
  51. package/dist/types/actions/deploy-major.d.ts +0 -2
  52. package/dist/types/actions/deploy-major.d.ts.map +0 -1
  53. package/dist/types/actions/deploy-minor.d.ts +0 -2
  54. package/dist/types/actions/deploy-minor.d.ts.map +0 -1
  55. package/dist/types/actions/deploy-next.d.ts +0 -2
  56. package/dist/types/actions/deploy-next.d.ts.map +0 -1
  57. package/dist/types/actions/deploy.d.ts +0 -2
  58. package/dist/types/actions/deploy.d.ts.map +0 -1
  59. package/dist/types/actions/deps.d.ts +0 -13
  60. package/dist/types/actions/deps.d.ts.map +0 -1
  61. package/dist/types/actions/dupdeps.d.ts +0 -2
  62. package/dist/types/actions/dupdeps.d.ts.map +0 -1
  63. package/dist/types/actions/fix.d.ts +0 -3
  64. package/dist/types/actions/fix.d.ts.map +0 -1
  65. package/dist/types/actions/gen-docs.d.ts +0 -11
  66. package/dist/types/actions/gen-docs.d.ts.map +0 -1
  67. package/dist/types/actions/gitignore-gen.d.ts +0 -2
  68. package/dist/types/actions/gitignore-gen.d.ts.map +0 -1
  69. package/dist/types/actions/gitlint-fix.d.ts +0 -2
  70. package/dist/types/actions/gitlint-fix.d.ts.map +0 -1
  71. package/dist/types/actions/gitlint.d.ts +0 -2
  72. package/dist/types/actions/gitlint.d.ts.map +0 -1
  73. package/dist/types/actions/index.d.ts +0 -39
  74. package/dist/types/actions/index.d.ts.map +0 -1
  75. package/dist/types/actions/knip.d.ts +0 -2
  76. package/dist/types/actions/knip.d.ts.map +0 -1
  77. package/dist/types/actions/license.d.ts +0 -2
  78. package/dist/types/actions/license.d.ts.map +0 -1
  79. package/dist/types/actions/lint.d.ts +0 -14
  80. package/dist/types/actions/lint.d.ts.map +0 -1
  81. package/dist/types/actions/npmignore-gen.d.ts +0 -2
  82. package/dist/types/actions/npmignore-gen.d.ts.map +0 -1
  83. package/dist/types/actions/package/clean-outputs.d.ts +0 -2
  84. package/dist/types/actions/package/clean-outputs.d.ts.map +0 -1
  85. package/dist/types/actions/package/clean-typescript.d.ts +0 -2
  86. package/dist/types/actions/package/clean-typescript.d.ts.map +0 -1
  87. package/dist/types/actions/package/clean.d.ts +0 -2
  88. package/dist/types/actions/package/clean.d.ts.map +0 -1
  89. package/dist/types/actions/package/compile/XyConfig.d.ts +0 -58
  90. package/dist/types/actions/package/compile/XyConfig.d.ts.map +0 -1
  91. package/dist/types/actions/package/compile/buildEntries.d.ts +0 -3
  92. package/dist/types/actions/package/compile/buildEntries.d.ts.map +0 -1
  93. package/dist/types/actions/package/compile/compile.d.ts +0 -3
  94. package/dist/types/actions/package/compile/compile.d.ts.map +0 -1
  95. package/dist/types/actions/package/compile/compileTypes.d.ts +0 -3
  96. package/dist/types/actions/package/compile/compileTypes.d.ts.map +0 -1
  97. package/dist/types/actions/package/compile/copyTypeFiles.d.ts +0 -3
  98. package/dist/types/actions/package/compile/copyTypeFiles.d.ts.map +0 -1
  99. package/dist/types/actions/package/compile/deepMerge.d.ts +0 -4
  100. package/dist/types/actions/package/compile/deepMerge.d.ts.map +0 -1
  101. package/dist/types/actions/package/compile/getCompilerOptions.d.ts +0 -3
  102. package/dist/types/actions/package/compile/getCompilerOptions.d.ts.map +0 -1
  103. package/dist/types/actions/package/compile/index.d.ts +0 -7
  104. package/dist/types/actions/package/compile/index.d.ts.map +0 -1
  105. package/dist/types/actions/package/compile/inputs.d.ts +0 -2
  106. package/dist/types/actions/package/compile/inputs.d.ts.map +0 -1
  107. package/dist/types/actions/package/compile/packageCompileTsc.d.ts +0 -4
  108. package/dist/types/actions/package/compile/packageCompileTsc.d.ts.map +0 -1
  109. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts +0 -4
  110. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts.map +0 -1
  111. package/dist/types/actions/package/compile/packageCompileTsup.d.ts +0 -5
  112. package/dist/types/actions/package/compile/packageCompileTsup.d.ts.map +0 -1
  113. package/dist/types/actions/package/copy-assets.d.ts +0 -5
  114. package/dist/types/actions/package/copy-assets.d.ts.map +0 -1
  115. package/dist/types/actions/package/deps.d.ts +0 -2
  116. package/dist/types/actions/package/deps.d.ts.map +0 -1
  117. package/dist/types/actions/package/gen-docs.d.ts +0 -2
  118. package/dist/types/actions/package/gen-docs.d.ts.map +0 -1
  119. package/dist/types/actions/package/index.d.ts +0 -11
  120. package/dist/types/actions/package/index.d.ts.map +0 -1
  121. package/dist/types/actions/package/lint.d.ts +0 -2
  122. package/dist/types/actions/package/lint.d.ts.map +0 -1
  123. package/dist/types/actions/package/publint.d.ts +0 -5
  124. package/dist/types/actions/package/publint.d.ts.map +0 -1
  125. package/dist/types/actions/package/recompile.d.ts +0 -2
  126. package/dist/types/actions/package/recompile.d.ts.map +0 -1
  127. package/dist/types/actions/publint.d.ts +0 -12
  128. package/dist/types/actions/publint.d.ts.map +0 -1
  129. package/dist/types/actions/rebuild.d.ts +0 -6
  130. package/dist/types/actions/rebuild.d.ts.map +0 -1
  131. package/dist/types/actions/recompile.d.ts +0 -16
  132. package/dist/types/actions/recompile.d.ts.map +0 -1
  133. package/dist/types/actions/reinstall.d.ts +0 -2
  134. package/dist/types/actions/reinstall.d.ts.map +0 -1
  135. package/dist/types/actions/relint.d.ts +0 -13
  136. package/dist/types/actions/relint.d.ts.map +0 -1
  137. package/dist/types/actions/retest.d.ts +0 -2
  138. package/dist/types/actions/retest.d.ts.map +0 -1
  139. package/dist/types/actions/sonar.d.ts +0 -2
  140. package/dist/types/actions/sonar.d.ts.map +0 -1
  141. package/dist/types/actions/statics.d.ts +0 -2
  142. package/dist/types/actions/statics.d.ts.map +0 -1
  143. package/dist/types/actions/test.d.ts +0 -2
  144. package/dist/types/actions/test.d.ts.map +0 -1
  145. package/dist/types/actions/up.d.ts +0 -2
  146. package/dist/types/actions/up.d.ts.map +0 -1
  147. package/dist/types/actions/updo.d.ts +0 -2
  148. package/dist/types/actions/updo.d.ts.map +0 -1
  149. package/dist/types/actions/upplug.d.ts +0 -2
  150. package/dist/types/actions/upplug.d.ts.map +0 -1
  151. package/dist/types/actions/upyarn.d.ts +0 -2
  152. package/dist/types/actions/upyarn.d.ts.map +0 -1
  153. package/dist/types/actions/yarn3only.d.ts +0 -2
  154. package/dist/types/actions/yarn3only.d.ts.map +0 -1
  155. package/dist/types/bin/package/build-only.d.ts +0 -3
  156. package/dist/types/bin/package/build-only.d.ts.map +0 -1
  157. package/dist/types/bin/package/build.d.ts +0 -3
  158. package/dist/types/bin/package/build.d.ts.map +0 -1
  159. package/dist/types/bin/package/clean-outputs.d.ts +0 -3
  160. package/dist/types/bin/package/clean-outputs.d.ts.map +0 -1
  161. package/dist/types/bin/package/clean-typescript.d.ts +0 -3
  162. package/dist/types/bin/package/clean-typescript.d.ts.map +0 -1
  163. package/dist/types/bin/package/clean.d.ts +0 -3
  164. package/dist/types/bin/package/clean.d.ts.map +0 -1
  165. package/dist/types/bin/package/compile-only.d.ts +0 -3
  166. package/dist/types/bin/package/compile-only.d.ts.map +0 -1
  167. package/dist/types/bin/package/compile-tsup.d.ts +0 -3
  168. package/dist/types/bin/package/compile-tsup.d.ts.map +0 -1
  169. package/dist/types/bin/package/compile-types.d.ts +0 -3
  170. package/dist/types/bin/package/compile-types.d.ts.map +0 -1
  171. package/dist/types/bin/package/compile.d.ts +0 -3
  172. package/dist/types/bin/package/compile.d.ts.map +0 -1
  173. package/dist/types/bin/package/copy-assets-cjs.d.ts +0 -3
  174. package/dist/types/bin/package/copy-assets-cjs.d.ts.map +0 -1
  175. package/dist/types/bin/package/copy-assets-esm.d.ts +0 -3
  176. package/dist/types/bin/package/copy-assets-esm.d.ts.map +0 -1
  177. package/dist/types/bin/package/deps.d.ts +0 -3
  178. package/dist/types/bin/package/deps.d.ts.map +0 -1
  179. package/dist/types/bin/package/fix.d.ts +0 -3
  180. package/dist/types/bin/package/fix.d.ts.map +0 -1
  181. package/dist/types/bin/package/gen-docs.d.ts +0 -3
  182. package/dist/types/bin/package/gen-docs.d.ts.map +0 -1
  183. package/dist/types/bin/package/lint.d.ts +0 -3
  184. package/dist/types/bin/package/lint.d.ts.map +0 -1
  185. package/dist/types/bin/package/publint.d.ts +0 -3
  186. package/dist/types/bin/package/publint.d.ts.map +0 -1
  187. package/dist/types/bin/package/recompile.d.ts +0 -3
  188. package/dist/types/bin/package/recompile.d.ts.map +0 -1
  189. package/dist/types/bin/package/relint.d.ts +0 -3
  190. package/dist/types/bin/package/relint.d.ts.map +0 -1
  191. package/dist/types/bin/xy.d.ts +0 -3
  192. package/dist/types/bin/xy.d.ts.map +0 -1
  193. package/dist/types/index.d.ts +0 -5
  194. package/dist/types/index.d.ts.map +0 -1
  195. package/dist/types/lib/checkResult.d.ts +0 -2
  196. package/dist/types/lib/checkResult.d.ts.map +0 -1
  197. package/dist/types/lib/createBuildConfig.d.ts +0 -2
  198. package/dist/types/lib/createBuildConfig.d.ts.map +0 -1
  199. package/dist/types/lib/defaultBuildConfig.d.ts +0 -9
  200. package/dist/types/lib/defaultBuildConfig.d.ts.map +0 -1
  201. package/dist/types/lib/deleteGlob.d.ts +0 -2
  202. package/dist/types/lib/deleteGlob.d.ts.map +0 -1
  203. package/dist/types/lib/dependencies/DuplicateDetector.d.ts +0 -9
  204. package/dist/types/lib/dependencies/DuplicateDetector.d.ts.map +0 -1
  205. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts +0 -2
  206. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts.map +0 -1
  207. package/dist/types/lib/dependencies/index.d.ts +0 -3
  208. package/dist/types/lib/dependencies/index.d.ts.map +0 -1
  209. package/dist/types/lib/file/ReadFileSyncOptions.d.ts +0 -6
  210. package/dist/types/lib/file/ReadFileSyncOptions.d.ts.map +0 -1
  211. package/dist/types/lib/file/constants.d.ts +0 -3
  212. package/dist/types/lib/file/constants.d.ts.map +0 -1
  213. package/dist/types/lib/file/fileLines.d.ts +0 -6
  214. package/dist/types/lib/file/fileLines.d.ts.map +0 -1
  215. package/dist/types/lib/file/index.d.ts +0 -5
  216. package/dist/types/lib/file/index.d.ts.map +0 -1
  217. package/dist/types/lib/file/tryReadFileSync.d.ts +0 -4
  218. package/dist/types/lib/file/tryReadFileSync.d.ts.map +0 -1
  219. package/dist/types/lib/generateIgnoreFiles.d.ts +0 -2
  220. package/dist/types/lib/generateIgnoreFiles.d.ts.map +0 -1
  221. package/dist/types/lib/index.d.ts +0 -21
  222. package/dist/types/lib/index.d.ts.map +0 -1
  223. package/dist/types/lib/jsonFormatters.d.ts +0 -2
  224. package/dist/types/lib/jsonFormatters.d.ts.map +0 -1
  225. package/dist/types/lib/loadConfig.d.ts +0 -2
  226. package/dist/types/lib/loadConfig.d.ts.map +0 -1
  227. package/dist/types/lib/parsedPackageJSON.d.ts +0 -2
  228. package/dist/types/lib/parsedPackageJSON.d.ts.map +0 -1
  229. package/dist/types/lib/processEx.d.ts +0 -2
  230. package/dist/types/lib/processEx.d.ts.map +0 -1
  231. package/dist/types/lib/runSteps.d.ts +0 -4
  232. package/dist/types/lib/runSteps.d.ts.map +0 -1
  233. package/dist/types/lib/runStepsAsync.d.ts +0 -4
  234. package/dist/types/lib/runStepsAsync.d.ts.map +0 -1
  235. package/dist/types/lib/runXy.d.ts +0 -2
  236. package/dist/types/lib/runXy.d.ts.map +0 -1
  237. package/dist/types/lib/runXyWithWarning.d.ts +0 -2
  238. package/dist/types/lib/runXyWithWarning.d.ts.map +0 -1
  239. package/dist/types/lib/safeExit.d.ts +0 -5
  240. package/dist/types/lib/safeExit.d.ts.map +0 -1
  241. package/dist/types/lib/string/empty.d.ts +0 -3
  242. package/dist/types/lib/string/empty.d.ts.map +0 -1
  243. package/dist/types/lib/string/index.d.ts +0 -3
  244. package/dist/types/lib/string/index.d.ts.map +0 -1
  245. package/dist/types/lib/string/union.d.ts +0 -2
  246. package/dist/types/lib/string/union.d.ts.map +0 -1
  247. package/dist/types/lib/withErrnoException.d.ts +0 -2
  248. package/dist/types/lib/withErrnoException.d.ts.map +0 -1
  249. package/dist/types/lib/withError.d.ts +0 -2
  250. package/dist/types/lib/withError.d.ts.map +0 -1
  251. package/dist/types/lib/yarn/index.d.ts +0 -4
  252. package/dist/types/lib/yarn/index.d.ts.map +0 -1
  253. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts +0 -2
  254. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts.map +0 -1
  255. package/dist/types/lib/yarn/workspace/Workspace.d.ts +0 -5
  256. package/dist/types/lib/yarn/workspace/Workspace.d.ts.map +0 -1
  257. package/dist/types/lib/yarn/workspace/index.d.ts +0 -4
  258. package/dist/types/lib/yarn/workspace/index.d.ts.map +0 -1
  259. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts +0 -3
  260. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts.map +0 -1
  261. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts +0 -3
  262. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts.map +0 -1
  263. package/dist/types/lib/yarn/yarnInitCwd.d.ts +0 -2
  264. package/dist/types/lib/yarn/yarnInitCwd.d.ts.map +0 -1
  265. package/dist/types/loadPackageConfig.d.ts +0 -6
  266. package/dist/types/loadPackageConfig.d.ts.map +0 -1
  267. package/dist/types/xy/index.d.ts +0 -8
  268. package/dist/types/xy/index.d.ts.map +0 -1
  269. package/dist/types/xy/param.d.ts +0 -5
  270. package/dist/types/xy/param.d.ts.map +0 -1
  271. package/dist/types/xy/xy.d.ts +0 -10
  272. package/dist/types/xy/xy.d.ts.map +0 -1
  273. package/dist/types/xy/xyBuildCommands.d.ts +0 -3
  274. package/dist/types/xy/xyBuildCommands.d.ts.map +0 -1
  275. package/dist/types/xy/xyCommonCommands.d.ts +0 -3
  276. package/dist/types/xy/xyCommonCommands.d.ts.map +0 -1
  277. package/dist/types/xy/xyDeployCommands.d.ts +0 -3
  278. package/dist/types/xy/xyDeployCommands.d.ts.map +0 -1
  279. package/dist/types/xy/xyInstallCommands.d.ts +0 -3
  280. package/dist/types/xy/xyInstallCommands.d.ts.map +0 -1
  281. package/dist/types/xy/xyLintCommands.d.ts +0 -3
  282. package/dist/types/xy/xyLintCommands.d.ts.map +0 -1
  283. package/dist/types/xy/xyParseOptions.d.ts +0 -3
  284. package/dist/types/xy/xyParseOptions.d.ts.map +0 -1
@@ -3,53 +3,48 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/actions/package/compile/packageCompileTsc.ts
5
5
  import { cwd } from "node:process";
6
- import chalk2 from "chalk";
6
+ import chalk from "chalk";
7
7
  import { createProgramFromConfig } from "tsc-prog";
8
- import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getLineAndCharacterOfPosition, getPreEmitDiagnostics } from "typescript";
8
+ import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
9
9
 
10
- // src/actions/package/publint.ts
11
- import { promises as fs } from "node:fs";
12
- import chalk from "chalk";
13
- import sortPackageJson from "sort-package-json";
14
- var packagePublint = /* @__PURE__ */ __name(async (params) => {
15
- const pkgDir = process.env.INIT_CWD;
16
- const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
17
- await fs.writeFile(`${pkgDir}/package.json`, sortedPkg);
18
- const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
19
- console.log(chalk.green(`Publint: ${pkg.name}`));
20
- console.log(chalk.gray(pkgDir));
21
- const { publint } = await import("publint");
22
- const { messages } = await publint({
23
- level: "suggestion",
24
- pkgDir,
25
- strict: true
10
+ // src/actions/package/compile/inputs.ts
11
+ import { glob } from "glob";
12
+ var getAllInputs = /* @__PURE__ */ __name((folder) => {
13
+ return glob.sync(`${folder}/**/*.*`, {
14
+ ignore: [
15
+ "**/*.spec.*",
16
+ "**/*.stories.*",
17
+ "**/spec/**/*"
18
+ ],
19
+ posix: true
26
20
  });
27
- const { formatMessage } = await import("publint/utils");
28
- const validMessage = /* @__PURE__ */ __name((_message) => {
29
- return true;
30
- }, "validMessage");
31
- const validMessages = messages.filter(validMessage);
32
- for (const message of validMessages) {
33
- switch (message.type) {
34
- case "error": {
35
- console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`));
36
- break;
37
- }
38
- case "warning": {
39
- console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
40
- break;
41
- }
42
- default: {
43
- console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`));
44
- break;
45
- }
21
+ }, "getAllInputs");
22
+
23
+ // src/actions/package/compile/buildEntries.ts
24
+ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", verbose = false) => {
25
+ let entries = [];
26
+ switch (entryMode) {
27
+ case "platform": {
28
+ entries = [
29
+ `${folder}/index-node.ts`,
30
+ `${folder}/index-browser.ts`
31
+ ];
32
+ break;
33
+ }
34
+ case "all": {
35
+ entries = getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".story."));
36
+ break;
37
+ }
38
+ default: {
39
+ entries = [
40
+ `${folder}/index.ts`
41
+ ];
42
+ break;
46
43
  }
47
44
  }
48
- if (params?.verbose) {
49
- console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
50
- }
51
- return validMessages.filter((message) => message.type === "error").length;
52
- }, "packagePublint");
45
+ if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
46
+ return entries;
47
+ }, "buildEntries");
53
48
 
54
49
  // src/actions/package/compile/getCompilerOptions.ts
55
50
  import { createRequire } from "node:module";
@@ -74,55 +69,52 @@ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, tsconfig = "tscon
74
69
  }, "getCompilerOptions");
75
70
 
76
71
  // src/actions/package/compile/packageCompileTsc.ts
77
- var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config, compilerOptionsParam) => {
72
+ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config = {}, compilerOptionsParam) => {
78
73
  const pkg = process.env.INIT_CWD ?? cwd();
79
- const publint = config?.publint ?? true;
80
74
  const verbose = config?.verbose ?? false;
81
- const formatHost = {
82
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
83
- getCurrentDirectory: /* @__PURE__ */ __name(() => pkg, "getCurrentDirectory"),
84
- getNewLine: /* @__PURE__ */ __name(() => "\n", "getNewLine")
85
- };
86
- if (verbose) {
87
- console.log(`Compiling with NoEmit TSC [${pkg}]`);
88
- }
75
+ console.log(chalk.green(`Compiling Files ${pkg}`));
89
76
  const compilerOptions = {
90
77
  ...getCompilerOptions({
91
- outDir: "dist",
92
- removeComments: true,
93
- rootDir: "src"
78
+ outDir: "dist/types",
79
+ removeComments: false,
80
+ skipDefaultLibCheck: true,
81
+ skipLibCheck: true,
82
+ sourceMap: false
94
83
  }),
95
84
  ...compilerOptionsParam,
96
- ...noEmit === void 0 ? {} : {
97
- noEmit
98
- }
85
+ emitDeclarationOnly: false,
86
+ noEmit: true
99
87
  };
88
+ const validTsExt = [
89
+ ".ts",
90
+ ".tsx",
91
+ ".d.ts",
92
+ ".cts",
93
+ ".d.cts",
94
+ ".mts",
95
+ ".d.mts"
96
+ ];
97
+ const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
100
98
  const program = createProgramFromConfig({
101
99
  basePath: pkg ?? cwd(),
102
100
  compilerOptions,
103
101
  exclude: [
104
102
  "dist",
105
- "docs",
106
- "**/*.spec.*",
107
- "**/*.stories.*",
108
- "src/**/spec/**/*"
103
+ "docs"
109
104
  ],
110
- include: [
111
- "src"
112
- ]
105
+ files
113
106
  });
114
- const results = getPreEmitDiagnostics(program);
115
- for (const diag of results) {
116
- const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : {
117
- character: 0,
118
- line: 0
119
- };
120
- console.log(chalk2.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
121
- console.log(formatDiagnosticsWithColorAndContext([
122
- diag
123
- ], formatHost));
107
+ const diagnostics = getPreEmitDiagnostics(program);
108
+ if (diagnostics.length > 0) {
109
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
110
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
111
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
112
+ getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
113
+ });
114
+ console.error(formattedDiagnostics);
124
115
  }
125
- return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory.Error ? 1 : 0, 0) || (publint ? await packagePublint() : 0);
116
+ program.emit();
117
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
126
118
  }, "packageCompileTsc");
127
119
  export {
128
120
  packageCompileTsc
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type {\n CompilerOptions,\n FormatDiagnosticsHost,\n LineAndCharacter,\n} from 'typescript'\nimport {\n DiagnosticCategory,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file\n ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0)\n : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 0)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAW;AAEpB,OAAOC,YAAW;AAElB,SAASC,+BAA+B;AAMxC,SACEC,oBACAC,sCACAC,+BACAC,6BACK;;;ACfP,SAASC,YAAYC,UAAU;AAE/B,OAAOC,WAAW;AAElB,OAAOC,qBAAqB;AAIrB,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAE3B,QAAMC,YAAYC,gBAAgB,MAAMC,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAC9E,QAAMM,GAAGE,UAAU,GAAGR,MAAAA,iBAAuBI,SAAAA;AAE7C,QAAMK,MAAMC,KAAKC,MAAM,MAAML,GAAGC,SAAS,GAAGP,MAAAA,iBAAuB,MAAA,CAAA;AAEnEY,UAAQC,IAAIC,MAAMC,MAAM,YAAYN,IAAIO,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,MAAMG,KAAKjB,MAAAA,CAAAA;AAEvB,QAAM,EAAEkB,QAAO,IAAK,MAAM,OAAO,SAAA;AAEjC,QAAM,EAAEC,SAAQ,IAAK,MA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AM;IAAE;AAC5BrB,YAAQC,IAAIqB,OAAMC,KAAK,GAAGR,KAAKE,MAAMpB,QAAAA,IAAYmB,YAAYK,OAAO,CAAA,IAAKL,YAAYI,YAAY,CAAA,EAAG,CAAA;AACpGpB,YAAQC,IAAIuB,qCAAqC;MAACT;OAAOpB,UAAAA,CAAAA;EAC3D;AAGA,SAAOkB,QAAQY,OAAO,CAACC,MAAMX,SAAUW,OAAOX,KAAKY,aAAaC,mBAAmBC,QAAQ,IAAI,GAAI,CAAA,MAAOpC,UAAU,MAAMqC,eAAAA,IAAmB;AAC/I,GA7CiC;","names":["cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","promises","fs","chalk","sortPackageJson","packagePublint","params","pkgDir","process","env","INIT_CWD","sortedPkg","sortPackageJson","fs","readFile","writeFile","pkg","JSON","parse","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint"]}
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/getCompilerOptions.ts"],"sourcesContent":["import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n console.log(chalk.green(`Compiling Files ${pkg}`))\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAW;AAEpB,OAAOC,WAAW;AAElB,SAASC,+BAA+B;AAExC,SACEC,oBAAoBC,sCAAsCC,uBAAuBC,OAAAA,YAC5E;;;ACRP,SAASC,YAAY;AAEd,IAAMC,eAAe,wBAACC,WAAAA;AAE3B,SAAOC,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C;","names":["cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","chalk","green","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error"]}
@@ -181,6 +181,59 @@ function deepMergeObjects(objects) {
181
181
  }
182
182
  __name(deepMergeObjects, "deepMergeObjects");
183
183
 
184
+ // src/actions/package/compile/packageCompileTsc.ts
185
+ import { cwd as cwd2 } from "node:process";
186
+ import chalk3 from "chalk";
187
+ import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
188
+ import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getPreEmitDiagnostics as getPreEmitDiagnostics2, sys as sys3 } from "typescript";
189
+ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
190
+ const pkg = process.env.INIT_CWD ?? cwd2();
191
+ const verbose = config2?.verbose ?? false;
192
+ console.log(chalk3.green(`Compiling Files ${pkg}`));
193
+ const compilerOptions = {
194
+ ...getCompilerOptions({
195
+ outDir: "dist/types",
196
+ removeComments: false,
197
+ skipDefaultLibCheck: true,
198
+ skipLibCheck: true,
199
+ sourceMap: false
200
+ }),
201
+ ...compilerOptionsParam,
202
+ emitDeclarationOnly: false,
203
+ noEmit: true
204
+ };
205
+ const validTsExt = [
206
+ ".ts",
207
+ ".tsx",
208
+ ".d.ts",
209
+ ".cts",
210
+ ".d.cts",
211
+ ".mts",
212
+ ".d.mts"
213
+ ];
214
+ const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
215
+ const program = createProgramFromConfig2({
216
+ basePath: pkg ?? cwd2(),
217
+ compilerOptions,
218
+ exclude: [
219
+ "dist",
220
+ "docs"
221
+ ],
222
+ files
223
+ });
224
+ const diagnostics = getPreEmitDiagnostics2(program);
225
+ if (diagnostics.length > 0) {
226
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
227
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
228
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
229
+ getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
230
+ });
231
+ console.error(formattedDiagnostics);
232
+ }
233
+ program.emit();
234
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
235
+ }, "packageCompileTsc");
236
+
184
237
  // src/actions/package/compile/packageCompileTsup.ts
185
238
  var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
186
239
  const outDir = options?.outDir ?? "dist";
@@ -254,7 +307,6 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
254
307
  ]);
255
308
  }, "tsupOptions");
256
309
  var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
257
- console.log("packageCompileTsup-types");
258
310
  const compile = config2?.compile;
259
311
  const verbose = config2?.verbose ?? false;
260
312
  if (verbose) {
@@ -272,7 +324,8 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
272
324
  if (verbose) {
273
325
  console.log("Calling packageCompileTscTypes");
274
326
  }
275
- const errors = await packageCompileTypes(config2);
327
+ let errors = await packageCompileTypes(config2);
328
+ errors = errors + packageCompileTsc(void 0, config2);
276
329
  if (errors > 0) {
277
330
  return errors;
278
331
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/deepMerge.ts"],"sourcesContent":["import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n console.log('packageCompileTsup-types')\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n const errors = await packageCompileTypes(config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]):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CAAC;MAC1C;QAAEuD,UAAU;QAAWrD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFuD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA7EkC;","names":["build","defineConfig","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","cwd","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value"]}
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/compileTypes.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\n }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling Types ${pkg}`))\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { cwd } from 'node:process'\n\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n if (verbose) {\n console.log(`Compiling types [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined) ?? {}\n\n return deepmerge(configFileCompilerOptions, options)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n console.log(chalk.green(`Compiling Files ${pkg}`))\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":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AWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA9EkC;","names":["build","defineConfig","glob","getAllInputs","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","chalk","chalk","cosmiconfig","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","cwd","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","console","log","chalk","green","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","length","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value"]}
@@ -94,7 +94,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
94
94
  }, "packageClean");
95
95
 
96
96
  // src/actions/package/compile/compile.ts
97
- import chalk7 from "chalk";
97
+ import chalk8 from "chalk";
98
98
 
99
99
  // src/actions/package/publint.ts
100
100
  import { promises as fs2 } from "node:fs";
@@ -300,6 +300,59 @@ function deepMergeObjects(objects) {
300
300
  }
301
301
  __name(deepMergeObjects, "deepMergeObjects");
302
302
 
303
+ // src/actions/package/compile/packageCompileTsc.ts
304
+ import { cwd as cwd2 } from "node:process";
305
+ import chalk7 from "chalk";
306
+ import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
307
+ import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getPreEmitDiagnostics as getPreEmitDiagnostics2, sys as sys3 } from "typescript";
308
+ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
309
+ const pkg = process.env.INIT_CWD ?? cwd2();
310
+ const verbose = config2?.verbose ?? false;
311
+ console.log(chalk7.green(`Compiling Files ${pkg}`));
312
+ const compilerOptions = {
313
+ ...getCompilerOptions({
314
+ outDir: "dist/types",
315
+ removeComments: false,
316
+ skipDefaultLibCheck: true,
317
+ skipLibCheck: true,
318
+ sourceMap: false
319
+ }),
320
+ ...compilerOptionsParam,
321
+ emitDeclarationOnly: false,
322
+ noEmit: true
323
+ };
324
+ const validTsExt = [
325
+ ".ts",
326
+ ".tsx",
327
+ ".d.ts",
328
+ ".cts",
329
+ ".d.cts",
330
+ ".mts",
331
+ ".d.mts"
332
+ ];
333
+ const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
334
+ const program = createProgramFromConfig2({
335
+ basePath: pkg ?? cwd2(),
336
+ compilerOptions,
337
+ exclude: [
338
+ "dist",
339
+ "docs"
340
+ ],
341
+ files
342
+ });
343
+ const diagnostics = getPreEmitDiagnostics2(program);
344
+ if (diagnostics.length > 0) {
345
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
346
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
347
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
348
+ getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
349
+ });
350
+ console.error(formattedDiagnostics);
351
+ }
352
+ program.emit();
353
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
354
+ }, "packageCompileTsc");
355
+
303
356
  // src/actions/package/compile/packageCompileTsup.ts
304
357
  var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
305
358
  const outDir = options?.outDir ?? "dist";
@@ -373,7 +426,6 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
373
426
  ]);
374
427
  }, "tsupOptions");
375
428
  var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
376
- console.log("packageCompileTsup-types");
377
429
  const compile = config2?.compile;
378
430
  const verbose = config2?.verbose ?? false;
379
431
  if (verbose) {
@@ -391,7 +443,8 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
391
443
  if (verbose) {
392
444
  console.log("Calling packageCompileTscTypes");
393
445
  }
394
- const errors = await packageCompileTypes(config2);
446
+ let errors = await packageCompileTypes(config2);
447
+ errors = errors + packageCompileTsc(void 0, config2);
395
448
  if (errors > 0) {
396
449
  return errors;
397
450
  }
@@ -434,7 +487,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
434
487
  // src/actions/package/compile/compile.ts
435
488
  var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
436
489
  const pkg = process.env.INIT_CWD;
437
- console.log(chalk7.green(`Compiling ${pkg}`));
490
+ console.log(chalk8.green(`Compiling ${pkg}`));
438
491
  const config2 = await loadConfig(inConfig);
439
492
  const publint = config2.publint;
440
493
  const tsupResults = await packageCompileTsup(config2);
@@ -444,62 +497,6 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
444
497
  return publint ? await packagePublint(config2) : 0;
445
498
  }, "packageCompile");
446
499
 
447
- // src/actions/package/compile/packageCompileTsc.ts
448
- import { cwd as cwd2 } from "node:process";
449
- import chalk8 from "chalk";
450
- import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
451
- import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getLineAndCharacterOfPosition, getPreEmitDiagnostics as getPreEmitDiagnostics2 } from "typescript";
452
- var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerOptionsParam) => {
453
- const pkg = process.env.INIT_CWD ?? cwd2();
454
- const publint = config2?.publint ?? true;
455
- const verbose = config2?.verbose ?? false;
456
- const formatHost = {
457
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
458
- getCurrentDirectory: /* @__PURE__ */ __name(() => pkg, "getCurrentDirectory"),
459
- getNewLine: /* @__PURE__ */ __name(() => "\n", "getNewLine")
460
- };
461
- if (verbose) {
462
- console.log(`Compiling with NoEmit TSC [${pkg}]`);
463
- }
464
- const compilerOptions = {
465
- ...getCompilerOptions({
466
- outDir: "dist",
467
- removeComments: true,
468
- rootDir: "src"
469
- }),
470
- ...compilerOptionsParam,
471
- ...noEmit === void 0 ? {} : {
472
- noEmit
473
- }
474
- };
475
- const program = createProgramFromConfig2({
476
- basePath: pkg ?? cwd2(),
477
- compilerOptions,
478
- exclude: [
479
- "dist",
480
- "docs",
481
- "**/*.spec.*",
482
- "**/*.stories.*",
483
- "src/**/spec/**/*"
484
- ],
485
- include: [
486
- "src"
487
- ]
488
- });
489
- const results = getPreEmitDiagnostics2(program);
490
- for (const diag of results) {
491
- const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : {
492
- character: 0,
493
- line: 0
494
- };
495
- console.log(chalk8.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
496
- console.log(formatDiagnosticsWithColorAndContext2([
497
- diag
498
- ], formatHost));
499
- }
500
- return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory2.Error ? 1 : 0, 0) || (publint ? await packagePublint() : 0);
501
- }, "packageCompileTsc");
502
-
503
500
  // src/actions/package/copy-assets.ts
504
501
  import path3 from "node:path/posix";
505
502
  import chalk9 from "chalk";