@bemedev/dev-utils 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/README.md +121 -0
  2. package/lib/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/lib/build-tests/addTarball.cjs +5 -1
  4. package/lib/build-tests/addTarball.cjs.map +1 -1
  5. package/lib/build-tests/addTarball.d.ts +3 -0
  6. package/lib/build-tests/addTarball.js +5 -1
  7. package/lib/build-tests/addTarball.js.map +1 -1
  8. package/lib/build-tests/buildPackageJson.cjs +17 -9
  9. package/lib/build-tests/buildPackageJson.cjs.map +1 -1
  10. package/lib/build-tests/buildPackageJson.d.ts +5 -0
  11. package/lib/build-tests/buildPackageJson.js +17 -9
  12. package/lib/build-tests/buildPackageJson.js.map +1 -1
  13. package/lib/build-tests/cleanup.cjs +3 -0
  14. package/lib/build-tests/cleanup.cjs.map +1 -1
  15. package/lib/build-tests/cleanup.d.ts +3 -0
  16. package/lib/build-tests/cleanup.js +3 -0
  17. package/lib/build-tests/cleanup.js.map +1 -1
  18. package/lib/build-tests/cli/cli.cjs +6 -0
  19. package/lib/build-tests/cli/cli.cjs.map +1 -1
  20. package/lib/build-tests/cli/cli.d.ts +6 -0
  21. package/lib/build-tests/cli/cli.js +6 -0
  22. package/lib/build-tests/cli/cli.js.map +1 -1
  23. package/lib/build-tests/cli/index.cjs.map +1 -1
  24. package/lib/build-tests/cli/post.cjs +3 -0
  25. package/lib/build-tests/cli/post.cjs.map +1 -1
  26. package/lib/build-tests/cli/post.d.ts +3 -0
  27. package/lib/build-tests/cli/post.js +3 -0
  28. package/lib/build-tests/cli/post.js.map +1 -1
  29. package/lib/build-tests/cli/pre.cjs +3 -0
  30. package/lib/build-tests/cli/pre.cjs.map +1 -1
  31. package/lib/build-tests/cli/pre.d.ts +3 -0
  32. package/lib/build-tests/cli/pre.js +3 -0
  33. package/lib/build-tests/cli/pre.js.map +1 -1
  34. package/lib/build-tests/cli/test.cjs +3 -0
  35. package/lib/build-tests/cli/test.cjs.map +1 -1
  36. package/lib/build-tests/cli/test.d.ts +3 -0
  37. package/lib/build-tests/cli/test.js +3 -0
  38. package/lib/build-tests/cli/test.js.map +1 -1
  39. package/lib/build-tests/constants.cjs +42 -0
  40. package/lib/build-tests/constants.cjs.map +1 -1
  41. package/lib/build-tests/constants.d.ts +42 -0
  42. package/lib/build-tests/constants.js +42 -0
  43. package/lib/build-tests/constants.js.map +1 -1
  44. package/lib/build-tests/getRelativePath.cjs +7 -0
  45. package/lib/build-tests/getRelativePath.cjs.map +1 -1
  46. package/lib/build-tests/getRelativePath.d.ts +7 -0
  47. package/lib/build-tests/getRelativePath.js +7 -0
  48. package/lib/build-tests/getRelativePath.js.map +1 -1
  49. package/lib/build-tests/getTypescriptOutdir.cjs +5 -0
  50. package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
  51. package/lib/build-tests/getTypescriptOutdir.d.ts +5 -0
  52. package/lib/build-tests/getTypescriptOutdir.js +5 -0
  53. package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
  54. package/lib/build-tests/import.cjs +9 -0
  55. package/lib/build-tests/import.cjs.map +1 -1
  56. package/lib/build-tests/import.d.ts +9 -0
  57. package/lib/build-tests/import.js +9 -0
  58. package/lib/build-tests/import.js.map +1 -1
  59. package/lib/build-tests/imports/create.cjs +7 -0
  60. package/lib/build-tests/imports/create.cjs.map +1 -1
  61. package/lib/build-tests/imports/create.d.ts +13 -0
  62. package/lib/build-tests/imports/create.js +7 -0
  63. package/lib/build-tests/imports/create.js.map +1 -1
  64. package/lib/build-tests/imports/helper.cjs +9 -0
  65. package/lib/build-tests/imports/helper.cjs.map +1 -1
  66. package/lib/build-tests/imports/helper.d.ts +12 -0
  67. package/lib/build-tests/imports/helper.js +9 -0
  68. package/lib/build-tests/imports/helper.js.map +1 -1
  69. package/lib/build-tests/pack.cjs +7 -1
  70. package/lib/build-tests/pack.cjs.map +1 -1
  71. package/lib/build-tests/pack.d.ts +5 -0
  72. package/lib/build-tests/pack.js +7 -1
  73. package/lib/build-tests/pack.js.map +1 -1
  74. package/lib/plugins/hmr.cjs +72 -0
  75. package/lib/plugins/hmr.cjs.map +1 -0
  76. package/lib/plugins/hmr.d.ts +22 -0
  77. package/lib/plugins/hmr.js +71 -0
  78. package/lib/plugins/hmr.js.map +1 -0
  79. package/lib/plugins/index.cjs +5 -0
  80. package/lib/plugins/index.d.ts +2 -0
  81. package/lib/plugins/index.js +3 -0
  82. package/lib/plugins/suppressWarnings.cjs +37 -0
  83. package/lib/plugins/suppressWarnings.cjs.map +1 -0
  84. package/lib/plugins/suppressWarnings.d.ts +12 -0
  85. package/lib/plugins/suppressWarnings.js +36 -0
  86. package/lib/plugins/suppressWarnings.js.map +1 -0
  87. package/lib/rolldown-config/config.cjs +13 -5
  88. package/lib/rolldown-config/config.cjs.map +1 -1
  89. package/lib/rolldown-config/config.d.ts +7 -0
  90. package/lib/rolldown-config/config.js +13 -5
  91. package/lib/rolldown-config/config.js.map +1 -1
  92. package/lib/rolldown-config/constants.cjs +15 -0
  93. package/lib/rolldown-config/constants.cjs.map +1 -1
  94. package/lib/rolldown-config/constants.d.ts +15 -0
  95. package/lib/rolldown-config/constants.js +15 -0
  96. package/lib/rolldown-config/constants.js.map +1 -1
  97. package/lib/rolldown-config/helpers.cjs +16 -1
  98. package/lib/rolldown-config/helpers.cjs.map +1 -1
  99. package/lib/rolldown-config/helpers.d.ts +14 -0
  100. package/lib/rolldown-config/helpers.js +16 -1
  101. package/lib/rolldown-config/helpers.js.map +1 -1
  102. package/lib/rolldown-config/input.cjs +8 -0
  103. package/lib/rolldown-config/input.cjs.map +1 -1
  104. package/lib/rolldown-config/input.d.ts +8 -0
  105. package/lib/rolldown-config/input.js +8 -0
  106. package/lib/rolldown-config/input.js.map +1 -1
  107. package/lib/rolldown-config/output.cjs +8 -0
  108. package/lib/rolldown-config/output.cjs.map +1 -1
  109. package/lib/rolldown-config/output.d.ts +8 -0
  110. package/lib/rolldown-config/output.js +8 -0
  111. package/lib/rolldown-config/output.js.map +1 -1
  112. package/lib/rolldown-config/plugins/circulars.cjs +5 -5
  113. package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
  114. package/lib/rolldown-config/plugins/circulars.d.ts +10 -6
  115. package/lib/rolldown-config/plugins/circulars.js +5 -5
  116. package/lib/rolldown-config/plugins/circulars.js.map +1 -1
  117. package/lib/rolldown-config/plugins/clean.cjs +10 -1
  118. package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
  119. package/lib/rolldown-config/plugins/clean.d.ts +10 -0
  120. package/lib/rolldown-config/plugins/clean.js +10 -1
  121. package/lib/rolldown-config/plugins/clean.js.map +1 -1
  122. package/lib/rolldown-config/plugins/externals.cjs +4 -3
  123. package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
  124. package/lib/rolldown-config/plugins/externals.d.ts +7 -3
  125. package/lib/rolldown-config/plugins/externals.js +4 -3
  126. package/lib/rolldown-config/plugins/externals.js.map +1 -1
  127. package/lib/rolldown-config/plugins/index.cjs +6 -0
  128. package/lib/rolldown-config/plugins/index.cjs.map +1 -1
  129. package/lib/rolldown-config/plugins/index.d.ts +6 -0
  130. package/lib/rolldown-config/plugins/index.js +6 -0
  131. package/lib/rolldown-config/plugins/index.js.map +1 -1
  132. package/lib/rolldown-config/plugins/typescript.cjs +7 -0
  133. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
  134. package/lib/rolldown-config/plugins/typescript.config.cjs +15 -0
  135. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
  136. package/lib/rolldown-config/plugins/typescript.config.d.ts +15 -0
  137. package/lib/rolldown-config/plugins/typescript.config.js +15 -0
  138. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
  139. package/lib/rolldown-config/plugins/typescript.d.ts +10 -0
  140. package/lib/rolldown-config/plugins/typescript.fast.cjs +9 -1
  141. package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
  142. package/lib/rolldown-config/plugins/typescript.fast.d.ts +10 -0
  143. package/lib/rolldown-config/plugins/typescript.fast.js +9 -1
  144. package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -1
  145. package/lib/rolldown-config/plugins/typescript.js +7 -0
  146. package/lib/rolldown-config/plugins/typescript.js.map +1 -1
  147. package/lib/rolldown-config/types.d.ts +18 -0
  148. package/lib/utils/array.cjs +7 -0
  149. package/lib/utils/array.cjs.map +1 -1
  150. package/lib/utils/array.d.ts +8 -0
  151. package/lib/utils/array.js +7 -0
  152. package/lib/utils/array.js.map +1 -1
  153. package/lib/utils/bemedev/globals/types.d.ts +20 -0
  154. package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
  155. package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -1
  156. package/lib/utils/bemedev/globals/utils/expandFn.d.ts +11 -0
  157. package/lib/utils/bemedev/globals/utils/expandFn.js +11 -0
  158. package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -1
  159. package/lib/utils/clamp.cjs +18 -0
  160. package/lib/utils/clamp.cjs.map +1 -0
  161. package/lib/utils/clamp.d.ts +10 -0
  162. package/lib/utils/clamp.js +17 -0
  163. package/lib/utils/clamp.js.map +1 -0
  164. package/lib/utils/identity.cjs +9 -0
  165. package/lib/utils/identity.cjs.map +1 -1
  166. package/lib/utils/identity.d.ts +9 -0
  167. package/lib/utils/identity.js +9 -0
  168. package/lib/utils/identity.js.map +1 -1
  169. package/lib/utils/index.cjs +2 -0
  170. package/lib/utils/index.d.ts +1 -0
  171. package/lib/utils/index.js +2 -1
  172. package/lib/utils/sleep.cjs +7 -0
  173. package/lib/utils/sleep.cjs.map +1 -1
  174. package/lib/utils/sleep.d.ts +7 -0
  175. package/lib/utils/sleep.js +7 -0
  176. package/lib/utils/sleep.js.map +1 -1
  177. package/lib/utils/types.d.ts +17 -1
  178. package/lib/vitest-exclude/constants.cjs +3 -0
  179. package/lib/vitest-exclude/constants.cjs.map +1 -1
  180. package/lib/vitest-exclude/constants.d.ts +3 -0
  181. package/lib/vitest-exclude/constants.js +3 -0
  182. package/lib/vitest-exclude/constants.js.map +1 -1
  183. package/lib/vitest-exclude/types.d.ts +11 -0
  184. package/lib/vitest-exclude/vitest.cjs +25 -12
  185. package/lib/vitest-exclude/vitest.cjs.map +1 -1
  186. package/lib/vitest-exclude/vitest.d.ts +9 -8
  187. package/lib/vitest-exclude/vitest.js +25 -12
  188. package/lib/vitest-exclude/vitest.js.map +1 -1
  189. package/lib/vitest-exclude/vitest.utils.cjs +30 -0
  190. package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
  191. package/lib/vitest-exclude/vitest.utils.d.ts +30 -0
  192. package/lib/vitest-exclude/vitest.utils.js +30 -0
  193. package/lib/vitest-exclude/vitest.utils.js.map +1 -1
  194. package/lib/vitest-extended/acceptation.cjs +11 -2
  195. package/lib/vitest-extended/acceptation.cjs.map +1 -1
  196. package/lib/vitest-extended/acceptation.d.ts +9 -1
  197. package/lib/vitest-extended/acceptation.js +11 -2
  198. package/lib/vitest-extended/acceptation.js.map +1 -1
  199. package/lib/vitest-extended/createTests.cjs +34 -27
  200. package/lib/vitest-extended/createTests.cjs.map +1 -1
  201. package/lib/vitest-extended/createTests.d.ts +20 -37
  202. package/lib/vitest-extended/createTests.js +34 -27
  203. package/lib/vitest-extended/createTests.js.map +1 -1
  204. package/lib/vitest-extended/createTests.types.d.ts +13 -2
  205. package/lib/vitest-extended/done.cjs +18 -15
  206. package/lib/vitest-extended/done.cjs.map +1 -1
  207. package/lib/vitest-extended/done.d.ts +6 -5
  208. package/lib/vitest-extended/done.js +18 -15
  209. package/lib/vitest-extended/done.js.map +1 -1
  210. package/lib/vitest-extended/each/error.cjs +12 -0
  211. package/lib/vitest-extended/each/error.cjs.map +1 -1
  212. package/lib/vitest-extended/each/error.d.ts +12 -0
  213. package/lib/vitest-extended/each/error.js +12 -0
  214. package/lib/vitest-extended/each/error.js.map +1 -1
  215. package/lib/vitest-extended/each/error.types.d.ts +17 -0
  216. package/lib/vitest-extended/each/pass.cjs +9 -20
  217. package/lib/vitest-extended/each/pass.cjs.map +1 -1
  218. package/lib/vitest-extended/each/pass.d.ts +9 -20
  219. package/lib/vitest-extended/each/pass.js +9 -20
  220. package/lib/vitest-extended/each/pass.js.map +1 -1
  221. package/lib/vitest-extended/each/pass.types.d.ts +24 -0
  222. package/lib/vitest-extended/fakeWaiter.cjs +7 -0
  223. package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
  224. package/lib/vitest-extended/fakeWaiter.d.ts +32 -0
  225. package/lib/vitest-extended/fakeWaiter.js +7 -0
  226. package/lib/vitest-extended/fakeWaiter.js.map +1 -1
  227. package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
  228. package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
  229. package/lib/vitest-extended/fixtures/coverage.js +11 -0
  230. package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
  231. package/lib/vitest-extended/fixtures/partialCall.cjs +9 -4
  232. package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
  233. package/lib/vitest-extended/fixtures/partialCall.js +9 -4
  234. package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
  235. package/lib/vitest-extended/fixtures/toUpper.cjs +18 -0
  236. package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
  237. package/lib/vitest-extended/fixtures/toUpper.js +18 -0
  238. package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
  239. package/lib/vitest-extended/fixtures/vitest.cjs +3 -0
  240. package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -1
  241. package/lib/vitest-extended/fixtures/vitest.js +3 -0
  242. package/lib/vitest-extended/fixtures/vitest.js.map +1 -1
  243. package/lib/vitest-extended/fixtures/zod.cjs +22 -0
  244. package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
  245. package/lib/vitest-extended/fixtures/zod.js +22 -0
  246. package/lib/vitest-extended/fixtures/zod.js.map +1 -1
  247. package/lib/vitest-extended/identity.cjs +18 -0
  248. package/lib/vitest-extended/identity.cjs.map +1 -1
  249. package/lib/vitest-extended/identity.d.ts +18 -0
  250. package/lib/vitest-extended/identity.js +18 -0
  251. package/lib/vitest-extended/identity.js.map +1 -1
  252. package/lib/vitest-extended/isDefined.cjs +9 -0
  253. package/lib/vitest-extended/isDefined.cjs.map +1 -1
  254. package/lib/vitest-extended/isDefined.d.ts +9 -0
  255. package/lib/vitest-extended/isDefined.js +9 -0
  256. package/lib/vitest-extended/isDefined.js.map +1 -1
  257. package/lib/vitest-extended/isFunction.cjs +7 -0
  258. package/lib/vitest-extended/isFunction.cjs.map +1 -1
  259. package/lib/vitest-extended/isFunction.d.ts +7 -0
  260. package/lib/vitest-extended/isFunction.js +7 -0
  261. package/lib/vitest-extended/isFunction.js.map +1 -1
  262. package/lib/vitest-extended/project.cjs +7 -0
  263. package/lib/vitest-extended/project.cjs.map +1 -1
  264. package/lib/vitest-extended/project.d.ts +7 -0
  265. package/lib/vitest-extended/project.js +7 -0
  266. package/lib/vitest-extended/project.js.map +1 -1
  267. package/lib/vitest-extended/toArray.cjs +6 -0
  268. package/lib/vitest-extended/toArray.cjs.map +1 -1
  269. package/lib/vitest-extended/toArray.d.ts +6 -0
  270. package/lib/vitest-extended/toArray.js +6 -0
  271. package/lib/vitest-extended/toArray.js.map +1 -1
  272. package/lib/vitest-extended/toStringFlat.cjs +8 -0
  273. package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
  274. package/lib/vitest-extended/toStringFlat.d.ts +8 -0
  275. package/lib/vitest-extended/toStringFlat.js +8 -0
  276. package/lib/vitest-extended/toStringFlat.js.map +1 -1
  277. package/lib/vitest-extended/types.d.ts +64 -0
  278. package/package.json +14 -9
@@ -1,12 +1,27 @@
1
1
  import { rmSync } from "fs";
2
2
  import { extname, relative, resolve } from "path";
3
3
  //#region src/rolldown-config/helpers.ts
4
+ /**
5
+ * Strips the extension from a file path.
6
+ *
7
+ * @param file - File path string.
8
+ *
9
+ * @returns File path without file extension.
10
+ */
4
11
  const withoutExtension = (file) => {
5
12
  return file.slice(0, file.length - extname(file).length);
6
13
  };
14
+ /**
15
+ * Removes compiled JavaScript and sourcemap files for specified sources.
16
+ *
17
+ * @param files - Set of source file paths.
18
+ * @param dir - Target output directory.
19
+ * @param sourcemap - Whether sourcemap files should also be deleted.
20
+ */
7
21
  const cleanupJS = (files, dir, sourcemap) => {
8
22
  for (const file of files) {
9
- const rel = relative("src", withoutExtension(file));
23
+ const withoutExt = withoutExtension(file);
24
+ const rel = relative("src", withoutExt);
10
25
  const baseOut = resolve(process.cwd(), dir, rel);
11
26
  console.warn(`Cleaning up ${baseOut}`);
12
27
  rmSync(`${baseOut}.js`, { force: true });
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":[],"sources":["../../src/rolldown-config/helpers.ts"],"sourcesContent":["import { rmSync } from 'node:fs';\nimport { extname, relative, resolve } from 'node:path';\n\nexport const withoutExtension = (file: string) => {\n return file.slice(0, file.length - extname(file).length);\n};\n\nexport const cleanupJS = (\n files: Set<string>,\n dir: string,\n sourcemap: boolean,\n) => {\n for (const file of files) {\n const withoutExt = withoutExtension(file);\n const rel = relative('src', withoutExt);\n const baseOut = resolve(process.cwd(), dir, rel);\n\n // #region JS outputs\n console.warn(`Cleaning up ${baseOut}`);\n\n rmSync(`${baseOut}.js`, { force: true });\n rmSync(`${baseOut}.cjs`, { force: true });\n if (sourcemap) {\n rmSync(`${baseOut}.js.map`, { force: true });\n rmSync(`${baseOut}.cjs.map`, { force: true });\n }\n\n const REMOVEDS = ['js', 'cjs', 'js.map', 'cjs.map'].map(\n ext => `${baseOut}.${ext}`,\n );\n\n const endMessage = JSON.stringify(REMOVEDS, null, 2);\n\n console.warn('removeds ::');\n console.log('***********');\n console.warn(endMessage);\n console.log('***********');\n // #endregion\n }\n};\n"],"mappings":";;;AAGA,MAAa,oBAAoB,SAAiB;CAChD,OAAO,KAAK,MAAM,GAAG,KAAK,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM;AACzD;AAEA,MAAa,aACX,OACA,KACA,cACG;CACH,KAAK,MAAM,QAAQ,OAAO;EAExB,MAAM,MAAM,SAAS,OADF,iBAAiB,IACC,CAAC;EACtC,MAAM,UAAU,QAAQ,QAAQ,IAAI,GAAG,KAAK,GAAG;EAG/C,QAAQ,KAAK,eAAe,SAAS;EAErC,OAAO,GAAG,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC;EACvC,OAAO,GAAG,QAAQ,OAAO,EAAE,OAAO,KAAK,CAAC;EACxC,IAAI,WAAW;GACb,OAAO,GAAG,QAAQ,UAAU,EAAE,OAAO,KAAK,CAAC;GAC3C,OAAO,GAAG,QAAQ,WAAW,EAAE,OAAO,KAAK,CAAC;EAC9C;EAEA,MAAM,WAAW;GAAC;GAAM;GAAO;GAAU;EAAS,CAAC,CAAC,KAClD,QAAO,GAAG,QAAQ,GAAG,KACvB;EAEA,MAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;EAEnD,QAAQ,KAAK,aAAa;EAC1B,QAAQ,IAAI,aAAa;EACzB,QAAQ,KAAK,UAAU;EACvB,QAAQ,IAAI,aAAa;CAE3B;AACF"}
1
+ {"version":3,"file":"helpers.js","names":[],"sources":["../../src/rolldown-config/helpers.ts"],"sourcesContent":["import { rmSync } from 'node:fs';\nimport { extname, relative, resolve } from 'node:path';\n\n/**\n * Strips the extension from a file path.\n *\n * @param file - File path string.\n *\n * @returns File path without file extension.\n */\nexport const withoutExtension = (file: string) => {\n return file.slice(0, file.length - extname(file).length);\n};\n\n/**\n * Removes compiled JavaScript and sourcemap files for specified sources.\n *\n * @param files - Set of source file paths.\n * @param dir - Target output directory.\n * @param sourcemap - Whether sourcemap files should also be deleted.\n */\nexport const cleanupJS = (\n files: Set<string>,\n dir: string,\n sourcemap: boolean,\n) => {\n for (const file of files) {\n const withoutExt = withoutExtension(file);\n const rel = relative('src', withoutExt);\n const baseOut = resolve(process.cwd(), dir, rel);\n\n // #region JS outputs\n console.warn(`Cleaning up ${baseOut}`);\n\n rmSync(`${baseOut}.js`, { force: true });\n rmSync(`${baseOut}.cjs`, { force: true });\n if (sourcemap) {\n rmSync(`${baseOut}.js.map`, { force: true });\n rmSync(`${baseOut}.cjs.map`, { force: true });\n }\n\n const REMOVEDS = ['js', 'cjs', 'js.map', 'cjs.map'].map(\n ext => `${baseOut}.${ext}`,\n );\n\n const endMessage = JSON.stringify(REMOVEDS, null, 2);\n\n console.warn('removeds ::');\n console.log('***********');\n console.warn(endMessage);\n console.log('***********');\n // #endregion\n }\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,oBAAoB,SAAiB;CAChD,OAAO,KAAK,MAAM,GAAG,KAAK,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM;AACzD;;;;;;;;AASA,MAAa,aACX,OACA,KACA,cACG;CACH,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,iBAAiB,IAAI;EACxC,MAAM,MAAM,SAAS,OAAO,UAAU;EACtC,MAAM,UAAU,QAAQ,QAAQ,IAAI,GAAG,KAAK,GAAG;EAG/C,QAAQ,KAAK,eAAe,SAAS;EAErC,OAAO,GAAG,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC;EACvC,OAAO,GAAG,QAAQ,OAAO,EAAE,OAAO,KAAK,CAAC;EACxC,IAAI,WAAW;GACb,OAAO,GAAG,QAAQ,UAAU,EAAE,OAAO,KAAK,CAAC;GAC3C,OAAO,GAAG,QAAQ,WAAW,EAAE,OAAO,KAAK,CAAC;EAC9C;EAEA,MAAM,WAAW;GAAC;GAAM;GAAO;GAAU;EAAS,CAAC,CAAC,KAClD,QAAO,GAAG,QAAQ,GAAG,KACvB;EAEA,MAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;EAEnD,QAAQ,KAAK,aAAa;EAC1B,QAAQ,IAAI,aAAa;EACzB,QAAQ,KAAK,UAAU;EACvB,QAAQ,IAAI,aAAa;CAE3B;AACF"}
@@ -3,6 +3,14 @@ const require_rolldown_config_constants = require("./constants.cjs");
3
3
  let path = require("path");
4
4
  let glob = require("glob");
5
5
  //#region src/rolldown-config/input.ts
6
+ /**
7
+ * Builds entry points record for Rolldown from all
8
+ * `src/[**]/*.ts]` files.
9
+ *
10
+ * @param ignores - Additional glob patterns to exclude from entry points.
11
+ *
12
+ * @returns An object mapping relative module names to absolute source paths.
13
+ */
6
14
  const buildInput = (...ignores) => Object.fromEntries((0, glob.globSync)("src/**/*.ts", { ignore: require_rolldown_config_constants.DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
7
15
  return [(0, path.relative)("src", file.slice(0, file.length - (0, path.extname)(file).length)), `${process.cwd()}/${file}`];
8
16
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"input.cjs","names":["DEFAULT_EXCLUDE"],"sources":["../../src/rolldown-config/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildInput_F } from './types';\n\nexport const buildInput: BuildInput_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', {\n ignore: DEFAULT_EXCLUDE.concat(ignores),\n }).map(file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n }),\n );\n"],"mappings":";;;;;AAOA,MAAa,cAA4B,GAAG,YAC1C,OAAO,aAAA,GAAA,KAAA,SAAA,CACI,eAAe,EACtB,QAAQA,kCAAAA,gBAAgB,OAAO,OAAO,EACxC,CAAC,CAAC,CAAC,KAAI,SAAQ;CAOb,OAAO,EAAA,GAAA,KAAA,SAAA,CALL,OACA,KAAK,MAAM,GAAG,KAAK,UAAA,GAAA,KAAA,QAAA,CAAiB,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CAAC,CACH"}
1
+ {"version":3,"file":"input.cjs","names":["globSync","DEFAULT_EXCLUDE","relative","extname"],"sources":["../../src/rolldown-config/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildInput_F } from './types';\n\n/**\n * Builds entry points record for Rolldown from all\n * `src/[**]/*.ts]` files.\n *\n * @param ignores - Additional glob patterns to exclude from entry points.\n *\n * @returns An object mapping relative module names to absolute source paths.\n */\nexport const buildInput: BuildInput_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', {\n ignore: DEFAULT_EXCLUDE.concat(ignores),\n }).map(file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n }),\n );\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,cAA4B,GAAG,YAC1C,OAAO,aAAA,GACLA,KAAAA,SAAAA,CAAS,eAAe,EACtB,QAAQC,kCAAAA,gBAAgB,OAAO,OAAO,EACxC,CAAC,CAAC,CAAC,KAAI,SAAQ;CAOb,OAAO,EAAA,GANKC,KAAAA,SAAAA,CACV,OACA,KAAK,MAAM,GAAG,KAAK,UAAA,GAASC,KAAAA,QAAAA,CAAQ,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CAAC,CACH"}
@@ -1,2 +1,10 @@
1
1
  import type { BuildInput_F } from './types';
2
+ /**
3
+ * Builds entry points record for Rolldown from all
4
+ * `src/[**]/*.ts]` files.
5
+ *
6
+ * @param ignores - Additional glob patterns to exclude from entry points.
7
+ *
8
+ * @returns An object mapping relative module names to absolute source paths.
9
+ */
2
10
  export declare const buildInput: BuildInput_F;
@@ -2,6 +2,14 @@ import { DEFAULT_EXCLUDE } from "./constants.js";
2
2
  import { extname, relative } from "path";
3
3
  import { globSync } from "glob";
4
4
  //#region src/rolldown-config/input.ts
5
+ /**
6
+ * Builds entry points record for Rolldown from all
7
+ * `src/[**]/*.ts]` files.
8
+ *
9
+ * @param ignores - Additional glob patterns to exclude from entry points.
10
+ *
11
+ * @returns An object mapping relative module names to absolute source paths.
12
+ */
5
13
  const buildInput = (...ignores) => Object.fromEntries(globSync("src/**/*.ts", { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
6
14
  return [relative("src", file.slice(0, file.length - extname(file).length)), `${process.cwd()}/${file}`];
7
15
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../src/rolldown-config/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildInput_F } from './types';\n\nexport const buildInput: BuildInput_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', {\n ignore: DEFAULT_EXCLUDE.concat(ignores),\n }).map(file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n }),\n );\n"],"mappings":";;;;AAOA,MAAa,cAA4B,GAAG,YAC1C,OAAO,YACL,SAAS,eAAe,EACtB,QAAQ,gBAAgB,OAAO,OAAO,EACxC,CAAC,CAAC,CAAC,KAAI,SAAQ;CAOb,OAAO,CANK,SACV,OACA,KAAK,MAAM,GAAG,KAAK,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CAAC,CACH"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../src/rolldown-config/input.ts"],"sourcesContent":["import { extname, relative } from 'node:path';\n\nimport { globSync } from 'glob';\n\nimport { DEFAULT_EXCLUDE } from './constants';\nimport type { BuildInput_F } from './types';\n\n/**\n * Builds entry points record for Rolldown from all\n * `src/[**]/*.ts]` files.\n *\n * @param ignores - Additional glob patterns to exclude from entry points.\n *\n * @returns An object mapping relative module names to absolute source paths.\n */\nexport const buildInput: BuildInput_F = (...ignores) =>\n Object.fromEntries(\n globSync('src/**/*.ts', {\n ignore: DEFAULT_EXCLUDE.concat(ignores),\n }).map(file => {\n const key = relative(\n 'src',\n file.slice(0, file.length - extname(file).length),\n );\n const value = `${process.cwd()}/${file}`;\n\n return [key, value];\n }),\n );\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,cAA4B,GAAG,YAC1C,OAAO,YACL,SAAS,eAAe,EACtB,QAAQ,gBAAgB,OAAO,OAAO,EACxC,CAAC,CAAC,CAAC,KAAI,SAAQ;CAOb,OAAO,CANK,SACV,OACA,KAAK,MAAM,GAAG,KAAK,SAAS,QAAQ,IAAI,CAAC,CAAC,MAAM,CAIxC,GAAG,GAFI,QAAQ,IAAI,EAAE,GAAG,MAEhB;AACpB,CAAC,CACH"}
@@ -2,6 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./constants.cjs");
3
3
  const require_rolldown_config_plugins_typescript_config = require("./plugins/typescript.config.cjs");
4
4
  //#region src/rolldown-config/output.ts
5
+ /**
6
+ * Builds ES and CJS output configurations for Rolldown.
7
+ *
8
+ * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
9
+ * @param sourcemap - Whether to generate source maps.
10
+ *
11
+ * @returns Array of output configurations of type {@linkcode OutputOptions}.
12
+ */
5
13
  const buildOutput = (dir = "lib", sourcemap) => {
6
14
  const outDir = require_rolldown_config_plugins_typescript_config.getConfig(process.cwd()).options.outDir ?? dir ?? "lib";
7
15
  return [{
@@ -1 +1 @@
1
- {"version":3,"file":"output.cjs","names":["getConfig"],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;;AAKA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADSA,kDAAAA,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
1
+ {"version":3,"file":"output.cjs","names":["getConfig"],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\n/**\n * Builds ES and CJS output configurations for Rolldown.\n *\n * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.\n * @param sourcemap - Whether to generate source maps.\n *\n * @returns Array of output configurations of type {@linkcode OutputOptions}.\n */\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADSA,kDAAAA,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Builds ES and CJS output configurations for Rolldown.
3
+ *
4
+ * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
5
+ * @param sourcemap - Whether to generate source maps.
6
+ *
7
+ * @returns Array of output configurations of type {@linkcode OutputOptions}.
8
+ */
1
9
  export declare const buildOutput: (dir: string | undefined, sourcemap: boolean) => [{
2
10
  readonly format: "es";
3
11
  readonly sourcemap: boolean;
@@ -1,6 +1,14 @@
1
1
  import "./constants.js";
2
2
  import { getConfig } from "./plugins/typescript.config.js";
3
3
  //#region src/rolldown-config/output.ts
4
+ /**
5
+ * Builds ES and CJS output configurations for Rolldown.
6
+ *
7
+ * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.
8
+ * @param sourcemap - Whether to generate source maps.
9
+ *
10
+ * @returns Array of output configurations of type {@linkcode OutputOptions}.
11
+ */
4
12
  const buildOutput = (dir = "lib", sourcemap) => {
5
13
  const outDir = getConfig(process.cwd()).options.outDir ?? dir ?? "lib";
6
14
  return [{
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;AAKA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADS,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
1
+ {"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\n/**\n * Builds ES and CJS output configurations for Rolldown.\n *\n * @param dir - Target output directory name, defaults to {@linkcode DEFAULT_DIR}.\n * @param sourcemap - Whether to generate source maps.\n *\n * @returns Array of output configurations of type {@linkcode OutputOptions}.\n */\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADS,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
@@ -7,15 +7,15 @@ let glob = require("glob");
7
7
  let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-dependencies");
8
8
  //#region src/rolldown-config/plugins/circulars.ts
9
9
  /**
10
- * Creates a configured circular dependencies plugin instance
10
+ * Creates a configured circular dependencies plugin instance with suppression for known patterns.
11
11
  *
12
- * @param options - Configuration options for circular dependencies
13
- * detection
14
- * @returns Rolldown plugin
12
+ * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
13
+ *
14
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
15
15
  */
16
16
  function circulars(options = {}) {
17
17
  const all = (0, rollup_plugin_circular_dependencies.circularDependencies)(options);
18
- const CIRCULAR_CHUNKS = require_utils_array.toArray(options.exclude).map((f) => (0, glob.globSync)(f, { nodir: true })).flat().map(require_rolldown_config_helpers.withoutExtension).map((file) => (0, path.relative)("src", file));
18
+ const CIRCULAR_CHUNKS = require_utils_array.toArray(options.exclude).filter(Boolean).map((f) => (0, glob.globSync)(f, { nodir: true })).flat().map(require_rolldown_config_helpers.withoutExtension).map((file) => (0, path.relative)("src", file));
19
19
  return {
20
20
  ...all,
21
21
  name: "better circular-dependencies",
@@ -1 +1 @@
1
- {"version":3,"file":"circulars.cjs","names":["toArray","withoutExtension","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & { exclude?: string | string[] };\n\n/**\n * Creates a configured circular dependencies plugin instance\n *\n * @param options - Configuration options for circular dependencies\n * detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,OAAA,GAAA,oCAAA,qBAAA,CAA2B,OAAO;CAGxC,MAAM,kBAFUA,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,KAAI,OAAA,GAAA,KAAA,SAAA,CAAc,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAA,KAAA,SAAA,CAAiB,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,kCAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
1
+ {"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,OAAA,GAAMA,oCAAAA,qBAAAA,CAAqB,OAAO;CAGxC,MAAM,kBAFUC,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,kCAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
@@ -1,13 +1,17 @@
1
1
  import type { RolldownPluginOption } from 'rolldown';
2
2
  import { circularDependencies } from 'rollup-plugin-circular-dependencies';
3
- export type CircularDependenciesOptions = Parameters<typeof circularDependencies>[0] & {
4
- exclude?: string | string[];
3
+ import { type SoA } from '../../utils/index.js';
4
+ /**
5
+ * Options for the circular dependencies plugin.
6
+ */
7
+ export type CircularDependenciesOptions = Omit<Parameters<typeof circularDependencies>[0], 'exclude'> & {
8
+ exclude?: SoA<string>;
5
9
  };
6
10
  /**
7
- * Creates a configured circular dependencies plugin instance
11
+ * Creates a configured circular dependencies plugin instance with suppression for known patterns.
12
+ *
13
+ * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
8
14
  *
9
- * @param options - Configuration options for circular dependencies
10
- * detection
11
- * @returns Rolldown plugin
15
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
12
16
  */
13
17
  export declare function circulars(options?: CircularDependenciesOptions): RolldownPluginOption;
@@ -6,15 +6,15 @@ import { globSync } from "glob";
6
6
  import { circularDependencies } from "rollup-plugin-circular-dependencies";
7
7
  //#region src/rolldown-config/plugins/circulars.ts
8
8
  /**
9
- * Creates a configured circular dependencies plugin instance
9
+ * Creates a configured circular dependencies plugin instance with suppression for known patterns.
10
10
  *
11
- * @param options - Configuration options for circular dependencies
12
- * detection
13
- * @returns Rolldown plugin
11
+ * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.
12
+ *
13
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
14
14
  */
15
15
  function circulars(options = {}) {
16
16
  const all = circularDependencies(options);
17
- const CIRCULAR_CHUNKS = toArray(options.exclude).map((f) => globSync(f, { nodir: true })).flat().map(withoutExtension).map((file) => relative("src", file));
17
+ const CIRCULAR_CHUNKS = toArray(options.exclude).filter(Boolean).map((f) => globSync(f, { nodir: true })).flat().map(withoutExtension).map((file) => relative("src", file));
18
18
  return {
19
19
  ...all,
20
20
  name: "better circular-dependencies",
@@ -1 +1 @@
1
- {"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & { exclude?: string | string[] };\n\n/**\n * Creates a configured circular dependencies plugin instance\n *\n * @param options - Configuration options for circular dependencies\n * detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
1
+ {"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
@@ -8,6 +8,13 @@ let path = require("path");
8
8
  let glob = require("glob");
9
9
  let _typescript_typescript6 = require("@typescript/typescript6");
10
10
  //#region src/rolldown-config/plugins/clean.ts
11
+ /**
12
+ * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.
13
+ *
14
+ * @param options - Configuration options of type {@linkcode EndPluginOptions}.
15
+ *
16
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
17
+ */
11
18
  const clean = (options) => {
12
19
  const { ignoresJS, sourcemap = false, dir } = options;
13
20
  const _ignoresJS = require_utils_array.toArray(ignoresJS);
@@ -27,7 +34,9 @@ const clean = (options) => {
27
34
  closeBundle: {
28
35
  order: "post",
29
36
  handler: () => {
30
- const outDir = require_rolldown_config_plugins_typescript_config.readTsConfig((0, _typescript_typescript6.findConfigFile)(process.cwd(), fs.existsSync, "tsconfig.json")).options.outDir ?? dir ?? "lib";
37
+ const cwd = process.cwd();
38
+ const tsconfigPath = (0, _typescript_typescript6.findConfigFile)(cwd, fs.existsSync, "tsconfig.json");
39
+ const outDir = require_rolldown_config_plugins_typescript_config.readTsConfig(tsconfigPath).options.outDir ?? dir ?? "lib";
31
40
  if (_ignoresJS.length > 0) try {
32
41
  const files = /* @__PURE__ */ new Set();
33
42
  _ignoresJS.forEach((pat) => {
@@ -1 +1 @@
1
- {"version":3,"file":"clean.cjs","names":["toArray","withoutExtension","WARNING_CODES","readTsConfig","existsSync"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAaA,oBAAAA,QAAQ,SAAS;CA4DpC,OAAO;EAzDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,OAAA,GAAA,KAAA,SAAA,CAAc,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAA,KAAA,SAAA,CAAiB,OAAO,IAAI,CAAC;GAMpC,IAHE,SAASC,kCAAAA,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IASb,MAAM,SADUC,kDAAAA,cAAAA,GAAAA,wBAAAA,eAAAA,CAPJ,QAAQ,IAGhB,GACFC,GAAAA,YACA,eAEsC,CAAC,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,CAAA,GAAA,KAAA,SAAA,CADuB,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,gCAAA,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
1
+ {"version":3,"file":"clean.cjs","names":["toArray","globSync","withoutExtension","relative","WARNING_CODES","findConfigFile","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAaA,oBAAAA,QAAQ,SAAS;CA4DpC,OAAO;EAzDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAASC,kCAAAA,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,gBAAA,GAAeC,wBAAAA,eAAAA,CACnB,KACAC,GAAAA,YACA,eACF;IAEA,MAAM,SADUC,kDAAAA,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,CAAA,GADcN,KAAAA,SAAAA,CAAS,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,gCAAA,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
@@ -1,8 +1,18 @@
1
+ /**
2
+ * Options for the post-bundle cleanup plugin.
3
+ */
1
4
  export type EndPluginOptions = {
2
5
  ignoresJS?: string | string[];
3
6
  sourcemap?: boolean;
4
7
  dir?: string;
5
8
  };
9
+ /**
10
+ * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.
11
+ *
12
+ * @param options - Configuration options of type {@linkcode EndPluginOptions}.
13
+ *
14
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
15
+ */
6
16
  export declare const clean: (options: EndPluginOptions) => {
7
17
  name: string;
8
18
  onLog: {
@@ -7,6 +7,13 @@ import { relative } from "path";
7
7
  import { globSync } from "glob";
8
8
  import { findConfigFile } from "@typescript/typescript6";
9
9
  //#region src/rolldown-config/plugins/clean.ts
10
+ /**
11
+ * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.
12
+ *
13
+ * @param options - Configuration options of type {@linkcode EndPluginOptions}.
14
+ *
15
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
16
+ */
10
17
  const clean = (options) => {
11
18
  const { ignoresJS, sourcemap = false, dir } = options;
12
19
  const _ignoresJS = toArray(ignoresJS);
@@ -26,7 +33,9 @@ const clean = (options) => {
26
33
  closeBundle: {
27
34
  order: "post",
28
35
  handler: () => {
29
- const outDir = readTsConfig(findConfigFile(process.cwd(), existsSync, "tsconfig.json")).options.outDir ?? dir ?? "lib";
36
+ const cwd = process.cwd();
37
+ const tsconfigPath = findConfigFile(cwd, existsSync, "tsconfig.json");
38
+ const outDir = readTsConfig(tsconfigPath).options.outDir ?? dir ?? "lib";
30
39
  if (_ignoresJS.length > 0) try {
31
40
  const files = /* @__PURE__ */ new Set();
32
41
  _ignoresJS.forEach((pat) => {
@@ -1 +1 @@
1
- {"version":3,"file":"clean.js","names":[],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAa,QAAQ,SAAS;CA4DpC,OAAO;EAzDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAAS,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IASb,MAAM,SADU,aALK,eAFT,QAAQ,IAGhB,GACF,YACA,eAEsC,CAAC,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,SADuB,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
1
+ {"version":3,"file":"clean.js","names":[],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAa,QAAQ,SAAS;CA4DpC,OAAO;EAzDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAAS,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,eACnB,KACA,YACA,eACF;IAEA,MAAM,SADU,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,SADuB,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
@@ -2,10 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let rollup_plugin_node_externals = require("rollup-plugin-node-externals");
3
3
  //#region src/rolldown-config/plugins/externals.ts
4
4
  /**
5
- * Creates a configured node externals plugin instance
5
+ * Creates a configured node externals plugin instance for Rolldown.
6
6
  *
7
- * @param options - Configuration options for node externals
8
- * @returns Rolldown plugin
7
+ * @param options - Configuration options of type {@linkcode NodeExternalsOptions}.
8
+ *
9
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
9
10
  */
10
11
  function externals(options = {}) {
11
12
  return (0, rollup_plugin_node_externals.nodeExternals)(options);
@@ -1 +1 @@
1
- {"version":3,"file":"externals.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n *\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,QAAA,GAAA,6BAAA,cAAA,CAAqB,OAAO;AAC9B"}
1
+ {"version":3,"file":"externals.cjs","names":["nodeExternals"],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\n/**\n * Options for the node externals plugin.\n */\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance for Rolldown.\n *\n * @param options - Configuration options of type {@linkcode NodeExternalsOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,QAAA,GAAOA,6BAAAA,cAAAA,CAAc,OAAO;AAC9B"}
@@ -1,10 +1,14 @@
1
1
  import type { RolldownPluginOption } from 'rolldown';
2
2
  import { nodeExternals } from 'rollup-plugin-node-externals';
3
+ /**
4
+ * Options for the node externals plugin.
5
+ */
3
6
  export type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];
4
7
  /**
5
- * Creates a configured node externals plugin instance
8
+ * Creates a configured node externals plugin instance for Rolldown.
9
+ *
10
+ * @param options - Configuration options of type {@linkcode NodeExternalsOptions}.
6
11
  *
7
- * @param options - Configuration options for node externals
8
- * @returns Rolldown plugin
12
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
9
13
  */
10
14
  export declare function externals(options?: NodeExternalsOptions): RolldownPluginOption;
@@ -1,10 +1,11 @@
1
1
  import { nodeExternals } from "rollup-plugin-node-externals";
2
2
  //#region src/rolldown-config/plugins/externals.ts
3
3
  /**
4
- * Creates a configured node externals plugin instance
4
+ * Creates a configured node externals plugin instance for Rolldown.
5
5
  *
6
- * @param options - Configuration options for node externals
7
- * @returns Rolldown plugin
6
+ * @param options - Configuration options of type {@linkcode NodeExternalsOptions}.
7
+ *
8
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
8
9
  */
9
10
  function externals(options = {}) {
10
11
  return nodeExternals(options);
@@ -1 +1 @@
1
- {"version":3,"file":"externals.js","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n *\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,OAAO,cAAc,OAAO;AAC9B"}
1
+ {"version":3,"file":"externals.js","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\n/**\n * Options for the node externals plugin.\n */\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance for Rolldown.\n *\n * @param options - Configuration options of type {@linkcode NodeExternalsOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,OAAO,cAAc,OAAO;AAC9B"}
@@ -6,6 +6,9 @@ const require_rolldown_config_plugins_typescript = require("./typescript.cjs");
6
6
  const require_rolldown_config_plugins_typescript_fast = require("./typescript.fast.cjs");
7
7
  let rolldown_plugins = require("rolldown/plugins");
8
8
  //#region src/rolldown-config/plugins/index.ts
9
+ /**
10
+ * Registry mapping plugin keys to their factory functions.
11
+ */
9
12
  const PLUGIN_BUILDERS = {
10
13
  typescript: require_rolldown_config_plugins_typescript.typescript,
11
14
  circulars: require_rolldown_config_plugins_circulars.circulars,
@@ -14,6 +17,9 @@ const PLUGIN_BUILDERS = {
14
17
  fast: require_rolldown_config_plugins_typescript_fast.typescriptFast,
15
18
  esm: rolldown_plugins.esmExternalRequirePlugin
16
19
  };
20
+ /**
21
+ * Default ordering sequence for Rolldown build plugins.
22
+ */
17
23
  const DEFAULT_PLUGINS_ORDER = Object.keys(PLUGIN_BUILDERS);
18
24
  //#endregion
19
25
  exports.DEFAULT_PLUGINS_ORDER = DEFAULT_PLUGINS_ORDER;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["typescriptFast","esmExternalRequirePlugin"],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;AAQA,MAAa,kBAAkB;CAC7B,YAAA,2CAAA;CACA,WAAA,0CAAA;CACA,WAAA,0CAAA;CACA,OAAA,sCAAA;CACA,MAAMA,gDAAAA;CACN,KAAKC,iBAAAA;AACP;AAEA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
1
+ {"version":3,"file":"index.cjs","names":["typescriptFast","esmExternalRequirePlugin"],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n */\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\n/**\n * Default ordering sequence for Rolldown build plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;CAC7B,YAAA,2CAAA;CACA,WAAA,0CAAA;CACA,WAAA,0CAAA;CACA,OAAA,sCAAA;CACA,MAAMA,gDAAAA;CACN,KAAKC,iBAAAA;AACP;;;;AAKA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
@@ -1,6 +1,9 @@
1
1
  import { esmExternalRequirePlugin } from 'rolldown/plugins';
2
2
  import { circulars } from './circulars';
3
3
  import { externals } from './externals';
4
+ /**
5
+ * Registry mapping plugin keys to their factory functions.
6
+ */
4
7
  export declare const PLUGIN_BUILDERS: {
5
8
  typescript: ({ exclude, include, declarationMap, dir, }?: {
6
9
  exclude?: string | string[];
@@ -28,4 +31,7 @@ export declare const PLUGIN_BUILDERS: {
28
31
  }) => import("rolldown").RolldownPluginOption;
29
32
  esm: typeof esmExternalRequirePlugin;
30
33
  };
34
+ /**
35
+ * Default ordering sequence for Rolldown build plugins.
36
+ */
31
37
  export declare const DEFAULT_PLUGINS_ORDER: (keyof typeof PLUGIN_BUILDERS)[];
@@ -5,6 +5,9 @@ import { typescript } from "./typescript.js";
5
5
  import { typescriptFast } from "./typescript.fast.js";
6
6
  import { esmExternalRequirePlugin } from "rolldown/plugins";
7
7
  //#region src/rolldown-config/plugins/index.ts
8
+ /**
9
+ * Registry mapping plugin keys to their factory functions.
10
+ */
8
11
  const PLUGIN_BUILDERS = {
9
12
  typescript,
10
13
  circulars,
@@ -13,6 +16,9 @@ const PLUGIN_BUILDERS = {
13
16
  fast: typescriptFast,
14
17
  esm: esmExternalRequirePlugin
15
18
  };
19
+ /**
20
+ * Default ordering sequence for Rolldown build plugins.
21
+ */
16
22
  const DEFAULT_PLUGINS_ORDER = Object.keys(PLUGIN_BUILDERS);
17
23
  //#endregion
18
24
  export { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;AAQA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA,MAAM;CACN,KAAK;AACP;AAEA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n */\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\n/**\n * Default ordering sequence for Rolldown build plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;;;AAWA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA,MAAM;CACN,KAAK;AACP;;;;AAKA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
@@ -8,6 +8,13 @@ let _typescript_typescript6 = require("@typescript/typescript6");
8
8
  _typescript_typescript6 = require_runtime.__toESM(_typescript_typescript6, 1);
9
9
  let tsc_alias = require("tsc-alias");
10
10
  //#region src/rolldown-config/plugins/typescript.ts
11
+ /**
12
+ * Rolldown plugin using `@typescript/typescript6` for generating TypeScript declaration files (`.d.ts`).
13
+ *
14
+ * @param props - Configuration options.
15
+ *
16
+ * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.
17
+ */
11
18
  const typescript = ({ exclude, include, declarationMap, dir } = {}) => {
12
19
  let done = false;
13
20
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.cjs","names":["toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHAA,oBAAAA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAeC,wBAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,eACF;IAEA,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,OAAOF,wBAAAA,QAAG,mBAAmB,WAAW,OAAO;IACrD,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAE5C,MAAM,SAASA,wBAAAA,QAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAGD,oBAAAA,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACAC,wBAAAA,QAAG,KACH,GACF;IAEA,MAAM,UAAUA,wBAAAA,QAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAASA,wBAAAA,QACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAaA,wBAAAA,QAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACNA,wBAAAA,QAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,OAAA,GAAA,UAAA,qBAAA,CAA2B;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
1
+ {"version":3,"file":"typescript.cjs","names":["toArray","ts","existsSync","readTsConfig","replaceTscAliasPaths"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the TypeScript DTS generation plugin.\n */\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\n/**\n * Rolldown plugin using `@typescript/typescript6` for generating TypeScript declaration files (`.d.ts`).\n *\n * @param props - Configuration options.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHAA,oBAAAA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAeC,wBAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,eACF;IAEA,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,OAAOF,wBAAAA,QAAG,mBAAmB,WAAW,OAAO;IACrD,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAE5C,MAAM,SAASA,wBAAAA,QAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAGD,oBAAAA,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACAC,wBAAAA,QAAG,KACH,GACF;IAEA,MAAM,UAAUA,wBAAAA,QAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAASA,wBAAAA,QACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAaA,wBAAAA,QAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACNA,wBAAAA,QAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,OAAA,GAAMG,UAAAA,qBAAAA,CAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
@@ -43,10 +43,25 @@ const _host = {
43
43
  fileExists: fs.existsSync,
44
44
  readFile: _readFile
45
45
  };
46
+ /**
47
+ * Loads and parses the closest `tsconfig.json` from the search path.
48
+ *
49
+ * @param searchPath - Directory path from which to locate the tsconfig.
50
+ * @param configName - Name of the configuration file, defaults to `'tsconfig.json'`.
51
+ *
52
+ * @returns Parsed TypeScript configuration object.
53
+ */
46
54
  function getConfig(searchPath, configName = "tsconfig.json") {
47
55
  const tsconfigPath = _typescript_typescript6.default.findConfigFile(searchPath, fs.existsSync, configName);
48
56
  return readTsConfig(tsconfigPath);
49
57
  }
58
+ /**
59
+ * Reads and parses the specified `tsconfig.json` file path.
60
+ *
61
+ * @param path - Absolute or relative path to the tsconfig file.
62
+ *
63
+ * @returns Parsed TypeScript configuration object.
64
+ */
50
65
  const readTsConfig = (path$1) => {
51
66
  const configFile = _typescript_typescript6.default.readConfigFile(path$1, _readFile);
52
67
  if (configFile.error) throw new Error(_typescript_typescript6.default.formatDiagnostic(configFile.error, {