@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,5 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/utils/sleep.ts
3
+ /**
4
+ * Asynchronously pauses execution for a given number of milliseconds.
5
+ *
6
+ * @param ms - Delay duration in milliseconds.
7
+ *
8
+ * @returns A promise that resolves after the specified delay.
9
+ */
3
10
  const sleep = (ms) => {
4
11
  return new Promise((resolve) => setTimeout(resolve, ms));
5
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
1
+ {"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["/**\n * Asynchronously pauses execution for a given number of milliseconds.\n *\n * @param ms - Delay duration in milliseconds.\n *\n * @returns A promise that resolves after the specified delay.\n */\nexport const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
@@ -1 +1,8 @@
1
+ /**
2
+ * Asynchronously pauses execution for a given number of milliseconds.
3
+ *
4
+ * @param ms - Delay duration in milliseconds.
5
+ *
6
+ * @returns A promise that resolves after the specified delay.
7
+ */
1
8
  export declare const sleep: (ms: number) => Promise<unknown>;
@@ -1,4 +1,11 @@
1
1
  //#region src/utils/sleep.ts
2
+ /**
3
+ * Asynchronously pauses execution for a given number of milliseconds.
4
+ *
5
+ * @param ms - Delay duration in milliseconds.
6
+ *
7
+ * @returns A promise that resolves after the specified delay.
8
+ */
2
9
  const sleep = (ms) => {
3
10
  return new Promise((resolve) => setTimeout(resolve, ms));
4
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
1
+ {"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["/**\n * Asynchronously pauses execution for a given number of milliseconds.\n *\n * @param ms - Delay duration in milliseconds.\n *\n * @returns A promise that resolves after the specified delay.\n */\nexport const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
@@ -1,2 +1,18 @@
1
1
  export * from './bemedev/globals/types';
2
- export type ToArray_F = <T>(value?: T | T[]) => T[];
2
+ /**
3
+ * Normalizes a single value, array, null, or undefined into an array.
4
+ *
5
+ * @template `T` - Item type.
6
+ *
7
+ * @param value - Optional single value or array of type {@linkcode SoA}.
8
+ *
9
+ * @returns Array containing the value(s).
10
+ */
11
+ export type ToArray_F = <T>(value?: T | T[] | ReadonlyArray<T>) => T[];
12
+ /**
13
+ * Single or Array (SoA) helper type. Represents a single value, an array of
14
+ * values, or a readonly array of values.
15
+ *
16
+ * @template `T` - Item type.
17
+ */
18
+ export type SoA<T> = T | T[] | ReadonlyArray<T>;
@@ -1,5 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-exclude/constants.ts
3
+ /**
4
+ * Package name identifier for the exclude-coverage plugin.
5
+ */
3
6
  const name = "@bemedev/exclude-coverage";
4
7
  //#endregion
5
8
  exports.name = name;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["export const name = '@bemedev/exclude-coverage';\n"],"mappings":";;AAAA,MAAa,OAAO"}
1
+ {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["/**\n * Package name identifier for the exclude-coverage plugin.\n */\nexport const name = '@bemedev/exclude-coverage';\n"],"mappings":";;;;;AAGA,MAAa,OAAO"}
@@ -1 +1,4 @@
1
+ /**
2
+ * Package name identifier for the exclude-coverage plugin.
3
+ */
1
4
  export declare const name = "@bemedev/exclude-coverage";
@@ -1,4 +1,7 @@
1
1
  //#region src/vitest-exclude/constants.ts
2
+ /**
3
+ * Package name identifier for the exclude-coverage plugin.
4
+ */
2
5
  const name = "@bemedev/exclude-coverage";
3
6
  //#endregion
4
7
  export { name };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["export const name = '@bemedev/exclude-coverage';\n"],"mappings":";AAAA,MAAa,OAAO"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["/**\n * Package name identifier for the exclude-coverage plugin.\n */\nexport const name = '@bemedev/exclude-coverage';\n"],"mappings":";;;;AAGA,MAAa,OAAO"}
@@ -1,5 +1,13 @@
1
1
  import type { Plugin } from 'vitest/config';
2
+ /**
3
+ * Type helper to exclude undefined from a type.
4
+ *
5
+ * @template `T` - Base type.
6
+ */
2
7
  export type Define<T> = Exclude<T, undefined>;
8
+ /**
9
+ * Argument tuple for glob pattern configuration and exclusions.
10
+ */
3
11
  export type Args = [
4
12
  {
5
13
  patternTest: string | string[];
@@ -10,4 +18,7 @@ export type Args = [
10
18
  ignoreCoverageFiles?: string[];
11
19
  }
12
20
  ];
21
+ /**
22
+ * Function type creating a Vitest plugin with explicit patterns.
23
+ */
13
24
  export type WithPattern = (...args: Args) => Plugin;
@@ -3,10 +3,12 @@ const require_vitest_exclude_vitest_utils = require("./vitest.utils.cjs");
3
3
  const require_vitest_exclude_constants = require("./constants.cjs");
4
4
  //#region src/vitest-exclude/vitest.ts
5
5
  /**
6
- * Create includeTest and includeCoverage arrays from glob patterns
6
+ * Creates include arrays for test and coverage files from glob patterns.
7
7
  *
8
- * @param args Globs to ignore for test and coverage files
9
- * @returns An object with includeTest and includeCoverage string arrays
8
+ * @param args - Glob patterns to ignore for test and coverage files.
9
+ * @param root - Optional root directory path.
10
+ *
11
+ * @returns An object with resolved `files` and `coverage` string arrays.
10
12
  */
11
13
  async function create(args = {}, root) {
12
14
  const firsts = {
@@ -15,6 +17,17 @@ async function create(args = {}, root) {
15
17
  };
16
18
  return create.withPattern(firsts, args, root);
17
19
  }
20
+ /**
21
+ * Creates include arrays using custom test and coverage glob patterns.
22
+ *
23
+ * @param patterns - Custom test and coverage pattern object.
24
+ * @param patterns.patternTest - Glob pattern for test files.
25
+ * @param patterns.patternCov - Glob pattern for coverage files.
26
+ * @param args - Ignore options for tests and coverage.
27
+ * @param root - Optional root directory path.
28
+ *
29
+ * @returns An object with resolved `files` and `coverage` string arrays.
30
+ */
18
31
  create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles, ignoreCoverageFiles } = {}, root) => {
19
32
  return {
20
33
  files: await require_vitest_exclude_vitest_utils.buildInclude(patternTest ?? require_vitest_exclude_vitest_utils.testPattern(root), ignoreTestFiles, root),
@@ -22,12 +35,11 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
22
35
  };
23
36
  };
24
37
  /**
25
- * Plugin to add files with glob patterns to vitest
38
+ * Vitest plugin to configure test and coverage file inclusion via glob patterns.
39
+ *
40
+ * @param args - Globs to ignore for test and coverage files.
26
41
  *
27
- * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\/*.ts'
28
- * @param ignore Globs to exclude inside
29
- * @returns A vitest config
30
- * @see {@link exclude.withPattern}
42
+ * @returns Vitest plugin of type {@linkcode Plugin}.
31
43
  */
32
44
  function exclude(args = {}) {
33
45
  return {
@@ -61,11 +73,12 @@ function exclude(args = {}) {
61
73
  };
62
74
  }
63
75
  /**
64
- * Plugin to add files with glob patterns to vitest
76
+ * Vitest plugin to configure test and coverage file inclusion with custom search patterns.
77
+ *
78
+ * @param patterns - Custom test and coverage glob patterns.
79
+ * @param ignore - Globs to exclude.
65
80
  *
66
- * @param pattern The pattern where searching files
67
- * @param ignore Globs to exclude inside
68
- * @returns A vitest config
81
+ * @returns Vitest plugin of type {@linkcode Plugin}.
69
82
  */
70
83
  exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
71
84
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns An object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\\/*.ts'\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n * @see {@link exclude.withPattern}\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;AAgBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY,IAAI;EAC7B,YAAYC,oCAAAA,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;AAEA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVWC,oCAAAA,aAClB,eAAeF,oCAAAA,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALOE,oCAAAA,aACrB,cAAcD,oCAAAA,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;;AAUA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAaA,oCAAAA,kBAAkB,IAAI;GACzC,MAAM,cAAcD,oCAAAA,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;AASA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
1
+ {"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Creates include arrays for test and coverage files from glob patterns.\n *\n * @param args - Glob patterns to ignore for test and coverage files.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\n/**\n * Creates include arrays using custom test and coverage glob patterns.\n *\n * @param patterns - Custom test and coverage pattern object.\n * @param patterns.patternTest - Glob pattern for test files.\n * @param patterns.patternCov - Glob pattern for coverage files.\n * @param args - Ignore options for tests and coverage.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Vitest plugin to configure test and coverage file inclusion via glob patterns.\n *\n * @param args - Globs to ignore for test and coverage files.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Vitest plugin to configure test and coverage file inclusion with custom search patterns.\n *\n * @param patterns - Custom test and coverage glob patterns.\n * @param ignore - Globs to exclude.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY,IAAI;EAC7B,YAAYC,oCAAAA,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;;;;;;;;;;;;AAaA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVWC,oCAAAA,aAClB,eAAeF,oCAAAA,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALOE,oCAAAA,aACrB,cAAcD,oCAAAA,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;AASA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAaA,oCAAAA,kBAAkB,IAAI;GACzC,MAAM,cAAcD,oCAAAA,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;;AAUA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
@@ -1,10 +1,12 @@
1
1
  import type { Plugin } from 'vitest/config';
2
2
  import type { Args, WithPattern } from './types';
3
3
  /**
4
- * Create includeTest and includeCoverage arrays from glob patterns
4
+ * Creates include arrays for test and coverage files from glob patterns.
5
5
  *
6
- * @param args Globs to ignore for test and coverage files
7
- * @returns An object with includeTest and includeCoverage string arrays
6
+ * @param args - Glob patterns to ignore for test and coverage files.
7
+ * @param root - Optional root directory path.
8
+ *
9
+ * @returns An object with resolved `files` and `coverage` string arrays.
8
10
  */
9
11
  export declare function create(args?: Args[1], root?: string): Promise<{
10
12
  files: string[];
@@ -17,12 +19,11 @@ export declare namespace create {
17
19
  }>;
18
20
  }
19
21
  /**
20
- * Plugin to add files with glob patterns to vitest
22
+ * Vitest plugin to configure test and coverage file inclusion via glob patterns.
23
+ *
24
+ * @param args - Globs to ignore for test and coverage files.
21
25
  *
22
- * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\/*.ts'
23
- * @param ignore Globs to exclude inside
24
- * @returns A vitest config
25
- * @see {@link exclude.withPattern}
26
+ * @returns Vitest plugin of type {@linkcode Plugin}.
26
27
  */
27
28
  export declare function exclude(args?: Args[1]): Plugin;
28
29
  export declare namespace exclude {
@@ -2,10 +2,12 @@ import { buildInclude, defaultCovPattern, testPattern } from "./vitest.utils.js"
2
2
  import { name } from "./constants.js";
3
3
  //#region src/vitest-exclude/vitest.ts
4
4
  /**
5
- * Create includeTest and includeCoverage arrays from glob patterns
5
+ * Creates include arrays for test and coverage files from glob patterns.
6
6
  *
7
- * @param args Globs to ignore for test and coverage files
8
- * @returns An object with includeTest and includeCoverage string arrays
7
+ * @param args - Glob patterns to ignore for test and coverage files.
8
+ * @param root - Optional root directory path.
9
+ *
10
+ * @returns An object with resolved `files` and `coverage` string arrays.
9
11
  */
10
12
  async function create(args = {}, root) {
11
13
  const firsts = {
@@ -14,6 +16,17 @@ async function create(args = {}, root) {
14
16
  };
15
17
  return create.withPattern(firsts, args, root);
16
18
  }
19
+ /**
20
+ * Creates include arrays using custom test and coverage glob patterns.
21
+ *
22
+ * @param patterns - Custom test and coverage pattern object.
23
+ * @param patterns.patternTest - Glob pattern for test files.
24
+ * @param patterns.patternCov - Glob pattern for coverage files.
25
+ * @param args - Ignore options for tests and coverage.
26
+ * @param root - Optional root directory path.
27
+ *
28
+ * @returns An object with resolved `files` and `coverage` string arrays.
29
+ */
17
30
  create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles, ignoreCoverageFiles } = {}, root) => {
18
31
  return {
19
32
  files: await buildInclude(patternTest ?? testPattern(root), ignoreTestFiles, root),
@@ -21,12 +34,11 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
21
34
  };
22
35
  };
23
36
  /**
24
- * Plugin to add files with glob patterns to vitest
37
+ * Vitest plugin to configure test and coverage file inclusion via glob patterns.
38
+ *
39
+ * @param args - Globs to ignore for test and coverage files.
25
40
  *
26
- * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\/*.ts'
27
- * @param ignore Globs to exclude inside
28
- * @returns A vitest config
29
- * @see {@link exclude.withPattern}
41
+ * @returns Vitest plugin of type {@linkcode Plugin}.
30
42
  */
31
43
  function exclude(args = {}) {
32
44
  return {
@@ -60,11 +72,12 @@ function exclude(args = {}) {
60
72
  };
61
73
  }
62
74
  /**
63
- * Plugin to add files with glob patterns to vitest
75
+ * Vitest plugin to configure test and coverage file inclusion with custom search patterns.
76
+ *
77
+ * @param patterns - Custom test and coverage glob patterns.
78
+ * @param ignore - Globs to exclude.
64
79
  *
65
- * @param pattern The pattern where searching files
66
- * @param ignore Globs to exclude inside
67
- * @returns A vitest config
80
+ * @returns Vitest plugin of type {@linkcode Plugin}.
68
81
  */
69
82
  exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
70
83
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns An object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\\/*.ts'\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n * @see {@link exclude.withPattern}\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;AAgBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAa,YAAY,IAAI;EAC7B,YAAY,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;AAEA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVW,aAClB,eAAe,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALO,aACrB,cAAc,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;;AAUA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAa,kBAAkB,IAAI;GACzC,MAAM,cAAc,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;AASA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
1
+ {"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Creates include arrays for test and coverage files from glob patterns.\n *\n * @param args - Glob patterns to ignore for test and coverage files.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\n/**\n * Creates include arrays using custom test and coverage glob patterns.\n *\n * @param patterns - Custom test and coverage pattern object.\n * @param patterns.patternTest - Glob pattern for test files.\n * @param patterns.patternCov - Glob pattern for coverage files.\n * @param args - Ignore options for tests and coverage.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Vitest plugin to configure test and coverage file inclusion via glob patterns.\n *\n * @param args - Globs to ignore for test and coverage files.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Vitest plugin to configure test and coverage file inclusion with custom search patterns.\n *\n * @param patterns - Custom test and coverage glob patterns.\n * @param ignore - Globs to exclude.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;;AAkBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAa,YAAY,IAAI;EAC7B,YAAY,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;;;;;;;;;;;;AAaA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVW,aAClB,eAAe,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALO,aACrB,cAAc,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;AASA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAa,kBAAkB,IAAI;GACzC,MAAM,cAAc,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;;AAUA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
@@ -3,20 +3,50 @@ let fs = require("fs");
3
3
  let path = require("path");
4
4
  let glob = require("glob");
5
5
  //#region src/vitest-exclude/vitest.utils.ts
6
+ /**
7
+ * Checks if a `src` directory exists at the specified project root.
8
+ *
9
+ * @param root - Root directory path, defaults to `process.cwd()`.
10
+ *
11
+ * @returns `true` if `src` exists, otherwise `false`.
12
+ */
6
13
  const hasSrc = (root = process.cwd()) => {
7
14
  return (0, fs.existsSync)((0, path.join)(root, "src"));
8
15
  };
16
+ /**
17
+ * Computes default coverage glob patterns based on directory structure.
18
+ *
19
+ * @param root - Optional root directory path.
20
+ *
21
+ * @returns Coverage glob pattern string.
22
+ */
9
23
  const defaultCovPattern = (root) => {
10
24
  /* v8 ignore next */
11
25
  return `${hasSrc(root) ? "src/" : ""}**/*.t{s,sx}`;
12
26
  };
13
27
  const mapper = (str) => str.replace(/\\/g, "/");
28
+ /**
29
+ * Resolves glob matches and normalizes file path separators.
30
+ *
31
+ * @param pattern - Glob pattern(s) to match.
32
+ * @param ignore - Optional array of patterns to ignore.
33
+ * @param root - Root working directory.
34
+ *
35
+ * @returns Array of normalized matched file paths.
36
+ */
14
37
  const buildInclude = async (pattern, ignore, root = process.cwd()) => {
15
38
  return (await (0, glob.glob)(pattern, {
16
39
  ignore,
17
40
  cwd: root
18
41
  })).map(mapper).sort();
19
42
  };
43
+ /**
44
+ * Computes default test glob patterns based on directory structure.
45
+ *
46
+ * @param root - Optional root directory path.
47
+ *
48
+ * @returns Test glob pattern string.
49
+ */
20
50
  const testPattern = (root) => {
21
51
  /* v8 ignore next */
22
52
  return `${hasSrc(root) ? "src/" : ""}**/*.{test,spec}.{ts,js,tsx,jsx}`;
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.utils.cjs","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { join } from 'node:path';\n\nimport { glob } from 'glob';\n\nexport const hasSrc = (root = process.cwd()) => {\n return existsSync(join(root, 'src'));\n};\n\nexport const defaultCovPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n root = process.cwd(),\n) => {\n const include = await glob(pattern, { ignore, cwd: root });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;;AAKA,MAAa,UAAU,OAAO,QAAQ,IAAI,MAAM;CAC9C,QAAA,GAAA,GAAA,WAAA,EAAA,GAAA,KAAA,KAAA,CAAuB,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,qBAAqB,SAAkB;;CAGlD,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;AACtD,MAAa,eAAe,OAC1B,SACA,QACA,OAAO,QAAQ,IAAI,MAChB;CAGH,QAAO,OAAA,GAAA,KAAA,KAAA,CAFoB,SAAS;EAAE;EAAQ,KAAK;CAAK,CAAC,EAAA,CAE1C,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;AAEA,MAAa,eAAe,SAAkB;;CAG5C,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B"}
1
+ {"version":3,"file":"vitest.utils.cjs","names":["existsSync","join"],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { join } from 'node:path';\n\nimport { glob } from 'glob';\n\n/**\n * Checks if a `src` directory exists at the specified project root.\n *\n * @param root - Root directory path, defaults to `process.cwd()`.\n *\n * @returns `true` if `src` exists, otherwise `false`.\n */\nexport const hasSrc = (root = process.cwd()) => {\n return existsSync(join(root, 'src'));\n};\n\n/**\n * Computes default coverage glob patterns based on directory structure.\n *\n * @param root - Optional root directory path.\n *\n * @returns Coverage glob pattern string.\n */\nexport const defaultCovPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\n\n/**\n * Resolves glob matches and normalizes file path separators.\n *\n * @param pattern - Glob pattern(s) to match.\n * @param ignore - Optional array of patterns to ignore.\n * @param root - Root working directory.\n *\n * @returns Array of normalized matched file paths.\n */\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n root = process.cwd(),\n) => {\n const include = await glob(pattern, { ignore, cwd: root });\n\n return include.map(mapper).sort();\n};\n\n/**\n * Computes default test glob patterns based on directory structure.\n *\n * @param root - Optional root directory path.\n *\n * @returns Test glob pattern string.\n */\nexport const testPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,UAAU,OAAO,QAAQ,IAAI,MAAM;CAC9C,QAAA,GAAOA,GAAAA,WAAAA,EAAAA,GAAWC,KAAAA,KAAAA,CAAK,MAAM,KAAK,CAAC;AACrC;;;;;;;;AASA,MAAa,qBAAqB,SAAkB;;CAGlD,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;;;;;;;;;;AAWtD,MAAa,eAAe,OAC1B,SACA,QACA,OAAO,QAAQ,IAAI,MAChB;CAGH,QAAO,OAAA,GAFe,KAAA,KAAA,CAAK,SAAS;EAAE;EAAQ,KAAK;CAAK,CAAC,EAAA,CAE1C,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;;;;;;;;AASA,MAAa,eAAe,SAAkB;;CAG5C,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B"}
@@ -1,4 +1,34 @@
1
+ /**
2
+ * Checks if a `src` directory exists at the specified project root.
3
+ *
4
+ * @param root - Root directory path, defaults to `process.cwd()`.
5
+ *
6
+ * @returns `true` if `src` exists, otherwise `false`.
7
+ */
1
8
  export declare const hasSrc: (root?: string) => boolean;
9
+ /**
10
+ * Computes default coverage glob patterns based on directory structure.
11
+ *
12
+ * @param root - Optional root directory path.
13
+ *
14
+ * @returns Coverage glob pattern string.
15
+ */
2
16
  export declare const defaultCovPattern: (root?: string) => string;
17
+ /**
18
+ * Resolves glob matches and normalizes file path separators.
19
+ *
20
+ * @param pattern - Glob pattern(s) to match.
21
+ * @param ignore - Optional array of patterns to ignore.
22
+ * @param root - Root working directory.
23
+ *
24
+ * @returns Array of normalized matched file paths.
25
+ */
3
26
  export declare const buildInclude: (pattern: string | string[], ignore?: string[], root?: string) => Promise<string[]>;
27
+ /**
28
+ * Computes default test glob patterns based on directory structure.
29
+ *
30
+ * @param root - Optional root directory path.
31
+ *
32
+ * @returns Test glob pattern string.
33
+ */
4
34
  export declare const testPattern: (root?: string) => string;
@@ -2,20 +2,50 @@ import { existsSync } from "fs";
2
2
  import { join } from "path";
3
3
  import { glob } from "glob";
4
4
  //#region src/vitest-exclude/vitest.utils.ts
5
+ /**
6
+ * Checks if a `src` directory exists at the specified project root.
7
+ *
8
+ * @param root - Root directory path, defaults to `process.cwd()`.
9
+ *
10
+ * @returns `true` if `src` exists, otherwise `false`.
11
+ */
5
12
  const hasSrc = (root = process.cwd()) => {
6
13
  return existsSync(join(root, "src"));
7
14
  };
15
+ /**
16
+ * Computes default coverage glob patterns based on directory structure.
17
+ *
18
+ * @param root - Optional root directory path.
19
+ *
20
+ * @returns Coverage glob pattern string.
21
+ */
8
22
  const defaultCovPattern = (root) => {
9
23
  /* v8 ignore next */
10
24
  return `${hasSrc(root) ? "src/" : ""}**/*.t{s,sx}`;
11
25
  };
12
26
  const mapper = (str) => str.replace(/\\/g, "/");
27
+ /**
28
+ * Resolves glob matches and normalizes file path separators.
29
+ *
30
+ * @param pattern - Glob pattern(s) to match.
31
+ * @param ignore - Optional array of patterns to ignore.
32
+ * @param root - Root working directory.
33
+ *
34
+ * @returns Array of normalized matched file paths.
35
+ */
13
36
  const buildInclude = async (pattern, ignore, root = process.cwd()) => {
14
37
  return (await glob(pattern, {
15
38
  ignore,
16
39
  cwd: root
17
40
  })).map(mapper).sort();
18
41
  };
42
+ /**
43
+ * Computes default test glob patterns based on directory structure.
44
+ *
45
+ * @param root - Optional root directory path.
46
+ *
47
+ * @returns Test glob pattern string.
48
+ */
19
49
  const testPattern = (root) => {
20
50
  /* v8 ignore next */
21
51
  return `${hasSrc(root) ? "src/" : ""}**/*.{test,spec}.{ts,js,tsx,jsx}`;
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.utils.js","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { join } from 'node:path';\n\nimport { glob } from 'glob';\n\nexport const hasSrc = (root = process.cwd()) => {\n return existsSync(join(root, 'src'));\n};\n\nexport const defaultCovPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n root = process.cwd(),\n) => {\n const include = await glob(pattern, { ignore, cwd: root });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;AAKA,MAAa,UAAU,OAAO,QAAQ,IAAI,MAAM;CAC9C,OAAO,WAAW,KAAK,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,qBAAqB,SAAkB;;CAGlD,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;AACtD,MAAa,eAAe,OAC1B,SACA,QACA,OAAO,QAAQ,IAAI,MAChB;CAGH,QAAO,MAFe,KAAK,SAAS;EAAE;EAAQ,KAAK;CAAK,CAAC,EAAA,CAE1C,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;AAEA,MAAa,eAAe,SAAkB;;CAG5C,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B"}
1
+ {"version":3,"file":"vitest.utils.js","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { join } from 'node:path';\n\nimport { glob } from 'glob';\n\n/**\n * Checks if a `src` directory exists at the specified project root.\n *\n * @param root - Root directory path, defaults to `process.cwd()`.\n *\n * @returns `true` if `src` exists, otherwise `false`.\n */\nexport const hasSrc = (root = process.cwd()) => {\n return existsSync(join(root, 'src'));\n};\n\n/**\n * Computes default coverage glob patterns based on directory structure.\n *\n * @param root - Optional root directory path.\n *\n * @returns Coverage glob pattern string.\n */\nexport const defaultCovPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\n\n/**\n * Resolves glob matches and normalizes file path separators.\n *\n * @param pattern - Glob pattern(s) to match.\n * @param ignore - Optional array of patterns to ignore.\n * @param root - Root working directory.\n *\n * @returns Array of normalized matched file paths.\n */\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n root = process.cwd(),\n) => {\n const include = await glob(pattern, { ignore, cwd: root });\n\n return include.map(mapper).sort();\n};\n\n/**\n * Computes default test glob patterns based on directory structure.\n *\n * @param root - Optional root directory path.\n *\n * @returns Test glob pattern string.\n */\nexport const testPattern = (root?: string) => {\n const _src = hasSrc(root);\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,UAAU,OAAO,QAAQ,IAAI,MAAM;CAC9C,OAAO,WAAW,KAAK,MAAM,KAAK,CAAC;AACrC;;;;;;;;AASA,MAAa,qBAAqB,SAAkB;;CAGlD,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;;;;;;;;;;AAWtD,MAAa,eAAe,OAC1B,SACA,QACA,OAAO,QAAQ,IAAI,MAChB;CAGH,QAAO,MAFe,KAAK,SAAS;EAAE;EAAQ,KAAK;CAAK,CAAC,EAAA,CAE1C,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;;;;;;;;AASA,MAAa,eAAe,SAAkB;;CAG5C,OAAO,GAFM,OAAO,IAEP,IAAI,SAAS,GAAG;AAC/B"}
@@ -2,16 +2,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_vitest_extended_isFunction = require("./isFunction.cjs");
3
3
  let vitest = require("vitest");
4
4
  //#region src/vitest-extended/acceptation.ts
5
+ /**
6
+ * Creates baseline definition and function type tests for a given function.
7
+ *
8
+ * @param f - Target function to test of type {@linkcode Fn}.
9
+ * @param _name - Optional custom name for test assertions.
10
+ */
5
11
  const useTestFunctionAcceptation = (f, _name) => {
6
12
  const name = _name ?? f.name;
7
13
  (0, vitest.test)(`#01 => ${name} is defined`, () => {
8
14
  (0, vitest.expect)(f).toBeDefined();
9
15
  });
10
16
  (0, vitest.test)(`#02 => ${name} is a function`, () => {
11
- (0, vitest.expect)(require_vitest_extended_isFunction.isFunction(f)).toBe(true);
17
+ const check = require_vitest_extended_isFunction.isFunction(f);
18
+ (0, vitest.expect)(check).toBe(true);
12
19
  });
13
20
  };
14
- /** For test only useTestFunctionAcceptation */
21
+ /**
22
+ * Alias for {@linkcode useTestFunctionAcceptation}.
23
+ */
15
24
  const useTFA = useTestFunctionAcceptation;
16
25
  //#endregion
17
26
  exports.useTFA = useTFA;
@@ -1 +1 @@
1
- {"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/** For test only useTestFunctionAcceptation */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;AAKA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,oBAAoB;EACtC,CAAA,GAAA,OAAA,OAAA,CAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,uBAAuB;EAEzC,CAAA,GAAA,OAAA,OAAA,CADcA,mCAAAA,WAAW,CACd,CAAC,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;AAGA,MAAa,SAAS"}
1
+ {"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\n/**\n * Creates baseline definition and function type tests for a given function.\n *\n * @param f - Target function to test of type {@linkcode Fn}.\n * @param _name - Optional custom name for test assertions.\n */\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/**\n * Alias for {@linkcode useTestFunctionAcceptation}.\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;;;;;;;AAWA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,oBAAoB;EACtC,CAAA,GAAA,OAAA,OAAA,CAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,uBAAuB;EACzC,MAAM,QAAQA,mCAAAA,WAAW,CAAC;EAC1B,CAAA,GAAA,OAAA,OAAA,CAAO,KAAK,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;;;AAKA,MAAa,SAAS"}
@@ -1,4 +1,12 @@
1
1
  import type { Fn } from '../utils/bemedev/globals/types';
2
+ /**
3
+ * Creates baseline definition and function type tests for a given function.
4
+ *
5
+ * @param f - Target function to test of type {@linkcode Fn}.
6
+ * @param _name - Optional custom name for test assertions.
7
+ */
2
8
  export declare const useTestFunctionAcceptation: (f: Fn, _name?: string) => void;
3
- /** For test only useTestFunctionAcceptation */
9
+ /**
10
+ * Alias for {@linkcode useTestFunctionAcceptation}.
11
+ */
4
12
  export declare const useTFA: (f: Fn, _name?: string) => void;
@@ -1,16 +1,25 @@
1
1
  import { isFunction } from "./isFunction.js";
2
2
  import { expect, test } from "vitest";
3
3
  //#region src/vitest-extended/acceptation.ts
4
+ /**
5
+ * Creates baseline definition and function type tests for a given function.
6
+ *
7
+ * @param f - Target function to test of type {@linkcode Fn}.
8
+ * @param _name - Optional custom name for test assertions.
9
+ */
4
10
  const useTestFunctionAcceptation = (f, _name) => {
5
11
  const name = _name ?? f.name;
6
12
  test(`#01 => ${name} is defined`, () => {
7
13
  expect(f).toBeDefined();
8
14
  });
9
15
  test(`#02 => ${name} is a function`, () => {
10
- expect(isFunction(f)).toBe(true);
16
+ const check = isFunction(f);
17
+ expect(check).toBe(true);
11
18
  });
12
19
  };
13
- /** For test only useTestFunctionAcceptation */
20
+ /**
21
+ * Alias for {@linkcode useTestFunctionAcceptation}.
22
+ */
14
23
  const useTFA = useTestFunctionAcceptation;
15
24
  //#endregion
16
25
  export { useTFA, useTestFunctionAcceptation };
@@ -1 +1 @@
1
- {"version":3,"file":"acceptation.js","names":[],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/** For test only useTestFunctionAcceptation */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;AAKA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,KAAK,UAAU,KAAK,oBAAoB;EACtC,OAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,KAAK,UAAU,KAAK,uBAAuB;EAEzC,OADc,WAAW,CACd,CAAC,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;AAGA,MAAa,SAAS"}
1
+ {"version":3,"file":"acceptation.js","names":[],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\n/**\n * Creates baseline definition and function type tests for a given function.\n *\n * @param f - Target function to test of type {@linkcode Fn}.\n * @param _name - Optional custom name for test assertions.\n */\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/**\n * Alias for {@linkcode useTestFunctionAcceptation}.\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;;;;;;AAWA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,KAAK,UAAU,KAAK,oBAAoB;EACtC,OAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,KAAK,UAAU,KAAK,uBAAuB;EACzC,MAAM,QAAQ,WAAW,CAAC;EAC1B,OAAO,KAAK,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;;;AAKA,MAAa,SAAS"}