@bemedev/dev-utils 0.1.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 (282) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +577 -0
  3. package/lib/_virtual/_rolldown/runtime.cjs +33 -0
  4. package/lib/_virtual/_rolldown/runtime.js +13 -0
  5. package/lib/build-tests/addTarball.cjs +23 -0
  6. package/lib/build-tests/addTarball.cjs.map +1 -0
  7. package/lib/build-tests/addTarball.d.ts +1 -0
  8. package/lib/build-tests/addTarball.js +18 -0
  9. package/lib/build-tests/addTarball.js.map +1 -0
  10. package/lib/build-tests/buildPackageJson.cjs +53 -0
  11. package/lib/build-tests/buildPackageJson.cjs.map +1 -0
  12. package/lib/build-tests/buildPackageJson.d.ts +8 -0
  13. package/lib/build-tests/buildPackageJson.js +49 -0
  14. package/lib/build-tests/buildPackageJson.js.map +1 -0
  15. package/lib/build-tests/cleanup.cjs +15 -0
  16. package/lib/build-tests/cleanup.cjs.map +1 -0
  17. package/lib/build-tests/cleanup.d.ts +1 -0
  18. package/lib/build-tests/cleanup.js +12 -0
  19. package/lib/build-tests/cleanup.js.map +1 -0
  20. package/lib/build-tests/cli/cli.cjs +23 -0
  21. package/lib/build-tests/cli/cli.cjs.map +1 -0
  22. package/lib/build-tests/cli/cli.d.ts +52 -0
  23. package/lib/build-tests/cli/cli.js +20 -0
  24. package/lib/build-tests/cli/cli.js.map +1 -0
  25. package/lib/build-tests/cli/index.cjs +8 -0
  26. package/lib/build-tests/cli/index.cjs.map +1 -0
  27. package/lib/build-tests/cli/index.d.ts +2 -0
  28. package/lib/build-tests/cli/index.js +9 -0
  29. package/lib/build-tests/cli/index.js.map +1 -0
  30. package/lib/build-tests/cli/post.cjs +18 -0
  31. package/lib/build-tests/cli/post.cjs.map +1 -0
  32. package/lib/build-tests/cli/post.d.ts +5 -0
  33. package/lib/build-tests/cli/post.js +17 -0
  34. package/lib/build-tests/cli/post.js.map +1 -0
  35. package/lib/build-tests/cli/pre.cjs +18 -0
  36. package/lib/build-tests/cli/pre.cjs.map +1 -0
  37. package/lib/build-tests/cli/pre.d.ts +5 -0
  38. package/lib/build-tests/cli/pre.js +17 -0
  39. package/lib/build-tests/cli/pre.js.map +1 -0
  40. package/lib/build-tests/cli/test.cjs +41 -0
  41. package/lib/build-tests/cli/test.cjs.map +1 -0
  42. package/lib/build-tests/cli/test.d.ts +15 -0
  43. package/lib/build-tests/cli/test.js +38 -0
  44. package/lib/build-tests/cli/test.js.map +1 -0
  45. package/lib/build-tests/constants.cjs +42 -0
  46. package/lib/build-tests/constants.cjs.map +1 -0
  47. package/lib/build-tests/constants.d.ts +19 -0
  48. package/lib/build-tests/constants.js +28 -0
  49. package/lib/build-tests/constants.js.map +1 -0
  50. package/lib/build-tests/getRelativePath.cjs +13 -0
  51. package/lib/build-tests/getRelativePath.cjs.map +1 -0
  52. package/lib/build-tests/getRelativePath.d.ts +4 -0
  53. package/lib/build-tests/getRelativePath.js +11 -0
  54. package/lib/build-tests/getRelativePath.js.map +1 -0
  55. package/lib/build-tests/getTypescriptOutdir.cjs +14 -0
  56. package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -0
  57. package/lib/build-tests/getTypescriptOutdir.d.ts +4 -0
  58. package/lib/build-tests/getTypescriptOutdir.js +11 -0
  59. package/lib/build-tests/getTypescriptOutdir.js.map +1 -0
  60. package/lib/build-tests/index.cjs +20 -0
  61. package/lib/build-tests/index.cjs.map +1 -0
  62. package/lib/build-tests/index.d.ts +2 -0
  63. package/lib/build-tests/index.js +12 -0
  64. package/lib/build-tests/index.js.map +1 -0
  65. package/lib/build-tests/pack.cjs +25 -0
  66. package/lib/build-tests/pack.cjs.map +1 -0
  67. package/lib/build-tests/pack.d.ts +4 -0
  68. package/lib/build-tests/pack.js +22 -0
  69. package/lib/build-tests/pack.js.map +1 -0
  70. package/lib/index.cjs +36 -0
  71. package/lib/index.d.ts +5 -0
  72. package/lib/index.js +6 -0
  73. package/lib/rolldown-config/config.cjs +86 -0
  74. package/lib/rolldown-config/config.cjs.map +1 -0
  75. package/lib/rolldown-config/config.d.ts +2 -0
  76. package/lib/rolldown-config/config.js +83 -0
  77. package/lib/rolldown-config/config.js.map +1 -0
  78. package/lib/rolldown-config/constants.cjs +31 -0
  79. package/lib/rolldown-config/constants.cjs.map +1 -0
  80. package/lib/rolldown-config/constants.d.ts +8 -0
  81. package/lib/rolldown-config/constants.js +26 -0
  82. package/lib/rolldown-config/constants.js.map +1 -0
  83. package/lib/rolldown-config/helpers.cjs +37 -0
  84. package/lib/rolldown-config/helpers.cjs.map +1 -0
  85. package/lib/rolldown-config/helpers.d.ts +2 -0
  86. package/lib/rolldown-config/helpers.js +34 -0
  87. package/lib/rolldown-config/helpers.js.map +1 -0
  88. package/lib/rolldown-config/index.cjs +22 -0
  89. package/lib/rolldown-config/index.cjs.map +1 -0
  90. package/lib/rolldown-config/index.d.ts +3 -0
  91. package/lib/rolldown-config/index.js +13 -0
  92. package/lib/rolldown-config/index.js.map +1 -0
  93. package/lib/rolldown-config/input.cjs +13 -0
  94. package/lib/rolldown-config/input.cjs.map +1 -0
  95. package/lib/rolldown-config/input.d.ts +2 -0
  96. package/lib/rolldown-config/input.js +11 -0
  97. package/lib/rolldown-config/input.js.map +1 -0
  98. package/lib/rolldown-config/output.cjs +23 -0
  99. package/lib/rolldown-config/output.cjs.map +1 -0
  100. package/lib/rolldown-config/output.d.ts +15 -0
  101. package/lib/rolldown-config/output.js +22 -0
  102. package/lib/rolldown-config/output.js.map +1 -0
  103. package/lib/rolldown-config/plugins/alias.cjs +17 -0
  104. package/lib/rolldown-config/plugins/alias.cjs.map +1 -0
  105. package/lib/rolldown-config/plugins/alias.d.ts +25 -0
  106. package/lib/rolldown-config/plugins/alias.js +14 -0
  107. package/lib/rolldown-config/plugins/alias.js.map +1 -0
  108. package/lib/rolldown-config/plugins/circulars.cjs +37 -0
  109. package/lib/rolldown-config/plugins/circulars.cjs.map +1 -0
  110. package/lib/rolldown-config/plugins/circulars.d.ts +11 -0
  111. package/lib/rolldown-config/plugins/circulars.js +35 -0
  112. package/lib/rolldown-config/plugins/circulars.js.map +1 -0
  113. package/lib/rolldown-config/plugins/clean.cjs +45 -0
  114. package/lib/rolldown-config/plugins/clean.cjs.map +1 -0
  115. package/lib/rolldown-config/plugins/clean.d.ts +15 -0
  116. package/lib/rolldown-config/plugins/clean.js +43 -0
  117. package/lib/rolldown-config/plugins/clean.js.map +1 -0
  118. package/lib/rolldown-config/plugins/externals.cjs +16 -0
  119. package/lib/rolldown-config/plugins/externals.cjs.map +1 -0
  120. package/lib/rolldown-config/plugins/externals.d.ts +9 -0
  121. package/lib/rolldown-config/plugins/externals.js +14 -0
  122. package/lib/rolldown-config/plugins/externals.js.map +1 -0
  123. package/lib/rolldown-config/plugins/index.cjs +29 -0
  124. package/lib/rolldown-config/plugins/index.cjs.map +1 -0
  125. package/lib/rolldown-config/plugins/index.d.ts +27 -0
  126. package/lib/rolldown-config/plugins/index.js +27 -0
  127. package/lib/rolldown-config/plugins/index.js.map +1 -0
  128. package/lib/rolldown-config/plugins/tsPaths.cjs +17 -0
  129. package/lib/rolldown-config/plugins/tsPaths.cjs.map +1 -0
  130. package/lib/rolldown-config/plugins/tsPaths.d.ts +9 -0
  131. package/lib/rolldown-config/plugins/tsPaths.js +14 -0
  132. package/lib/rolldown-config/plugins/tsPaths.js.map +1 -0
  133. package/lib/rolldown-config/plugins/typescript.cjs +56 -0
  134. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -0
  135. package/lib/rolldown-config/plugins/typescript.config.cjs +58 -0
  136. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -0
  137. package/lib/rolldown-config/plugins/typescript.config.d.ts +2 -0
  138. package/lib/rolldown-config/plugins/typescript.config.js +55 -0
  139. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -0
  140. package/lib/rolldown-config/plugins/typescript.d.ts +9 -0
  141. package/lib/rolldown-config/plugins/typescript.js +53 -0
  142. package/lib/rolldown-config/plugins/typescript.js.map +1 -0
  143. package/lib/rolldown-config/types.d.ts +20 -0
  144. package/lib/rolldown-config/utils.cjs +11 -0
  145. package/lib/rolldown-config/utils.cjs.map +1 -0
  146. package/lib/rolldown-config/utils.d.ts +2 -0
  147. package/lib/rolldown-config/utils.js +10 -0
  148. package/lib/rolldown-config/utils.js.map +1 -0
  149. package/lib/utils/index.cjs +3 -0
  150. package/lib/utils/index.d.ts +2 -0
  151. package/lib/utils/index.js +2 -0
  152. package/lib/utils/sleep.cjs +9 -0
  153. package/lib/utils/sleep.cjs.map +1 -0
  154. package/lib/utils/sleep.d.ts +1 -0
  155. package/lib/utils/sleep.js +8 -0
  156. package/lib/utils/sleep.js.map +1 -0
  157. package/lib/utils/types.d.ts +1 -0
  158. package/lib/vitest-alias/index.cjs +19 -0
  159. package/lib/vitest-alias/index.cjs.map +1 -0
  160. package/lib/vitest-alias/index.d.ts +1 -0
  161. package/lib/vitest-alias/index.js +11 -0
  162. package/lib/vitest-alias/index.js.map +1 -0
  163. package/lib/vitest-alias/vitest.cjs +77 -0
  164. package/lib/vitest-alias/vitest.cjs.map +1 -0
  165. package/lib/vitest-alias/vitest.d.ts +38 -0
  166. package/lib/vitest-alias/vitest.js +74 -0
  167. package/lib/vitest-alias/vitest.js.map +1 -0
  168. package/lib/vitest-exclude/constants.cjs +7 -0
  169. package/lib/vitest-exclude/constants.cjs.map +1 -0
  170. package/lib/vitest-exclude/constants.d.ts +1 -0
  171. package/lib/vitest-exclude/constants.js +6 -0
  172. package/lib/vitest-exclude/constants.js.map +1 -0
  173. package/lib/vitest-exclude/index.cjs +15 -0
  174. package/lib/vitest-exclude/index.cjs.map +1 -0
  175. package/lib/vitest-exclude/index.d.ts +1 -0
  176. package/lib/vitest-exclude/index.js +8 -0
  177. package/lib/vitest-exclude/index.js.map +1 -0
  178. package/lib/vitest-exclude/types.d.ts +14 -0
  179. package/lib/vitest-exclude/vitest.cjs +57 -0
  180. package/lib/vitest-exclude/vitest.cjs.map +1 -0
  181. package/lib/vitest-exclude/vitest.d.ts +16 -0
  182. package/lib/vitest-exclude/vitest.js +56 -0
  183. package/lib/vitest-exclude/vitest.js.map +1 -0
  184. package/lib/vitest-exclude/vitest.utils.cjs +31 -0
  185. package/lib/vitest-exclude/vitest.utils.cjs.map +1 -0
  186. package/lib/vitest-exclude/vitest.utils.d.ts +4 -0
  187. package/lib/vitest-exclude/vitest.utils.js +26 -0
  188. package/lib/vitest-exclude/vitest.utils.js.map +1 -0
  189. package/lib/vitest-extended/acceptation.cjs +24 -0
  190. package/lib/vitest-extended/acceptation.cjs.map +1 -0
  191. package/lib/vitest-extended/acceptation.d.ts +7 -0
  192. package/lib/vitest-extended/acceptation.js +21 -0
  193. package/lib/vitest-extended/acceptation.js.map +1 -0
  194. package/lib/vitest-extended/bemedev/globals/types.d.ts +3 -0
  195. package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs +17 -0
  196. package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +1 -0
  197. package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +11 -0
  198. package/lib/vitest-extended/bemedev/globals/utils/_unknown.js +16 -0
  199. package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +1 -0
  200. package/lib/vitest-extended/createTests.cjs +89 -0
  201. package/lib/vitest-extended/createTests.cjs.map +1 -0
  202. package/lib/vitest-extended/createTests.d.ts +58 -0
  203. package/lib/vitest-extended/createTests.js +87 -0
  204. package/lib/vitest-extended/createTests.js.map +1 -0
  205. package/lib/vitest-extended/createTests.types.d.ts +10 -0
  206. package/lib/vitest-extended/done.cjs +81 -0
  207. package/lib/vitest-extended/done.cjs.map +1 -0
  208. package/lib/vitest-extended/done.d.ts +14 -0
  209. package/lib/vitest-extended/done.js +79 -0
  210. package/lib/vitest-extended/done.js.map +1 -0
  211. package/lib/vitest-extended/each/error.cjs +23 -0
  212. package/lib/vitest-extended/each/error.cjs.map +1 -0
  213. package/lib/vitest-extended/each/error.d.ts +3 -0
  214. package/lib/vitest-extended/each/error.js +20 -0
  215. package/lib/vitest-extended/each/error.js.map +1 -0
  216. package/lib/vitest-extended/each/error.types.d.ts +5 -0
  217. package/lib/vitest-extended/each/index.cjs +7 -0
  218. package/lib/vitest-extended/each/index.d.ts +2 -0
  219. package/lib/vitest-extended/each/index.js +3 -0
  220. package/lib/vitest-extended/each/pass.cjs +56 -0
  221. package/lib/vitest-extended/each/pass.cjs.map +1 -0
  222. package/lib/vitest-extended/each/pass.d.ts +32 -0
  223. package/lib/vitest-extended/each/pass.js +53 -0
  224. package/lib/vitest-extended/each/pass.js.map +1 -0
  225. package/lib/vitest-extended/each/pass.types.d.ts +6 -0
  226. package/lib/vitest-extended/fakeWaiter.cjs +29 -0
  227. package/lib/vitest-extended/fakeWaiter.cjs.map +1 -0
  228. package/lib/vitest-extended/fakeWaiter.d.ts +9 -0
  229. package/lib/vitest-extended/fakeWaiter.js +28 -0
  230. package/lib/vitest-extended/fakeWaiter.js.map +1 -0
  231. package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
  232. package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -0
  233. package/lib/vitest-extended/fixtures/coverage.js +8 -0
  234. package/lib/vitest-extended/fixtures/coverage.js.map +1 -0
  235. package/lib/vitest-extended/fixtures/partialCall.cjs +19 -0
  236. package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -0
  237. package/lib/vitest-extended/fixtures/partialCall.js +18 -0
  238. package/lib/vitest-extended/fixtures/partialCall.js.map +1 -0
  239. package/lib/vitest-extended/fixtures/toUpper.cjs +13 -0
  240. package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -0
  241. package/lib/vitest-extended/fixtures/toUpper.js +11 -0
  242. package/lib/vitest-extended/fixtures/toUpper.js.map +1 -0
  243. package/lib/vitest-extended/fixtures/vitest.cjs +7 -0
  244. package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -0
  245. package/lib/vitest-extended/fixtures/vitest.js +6 -0
  246. package/lib/vitest-extended/fixtures/vitest.js.map +1 -0
  247. package/lib/vitest-extended/fixtures/zod.cjs +23 -0
  248. package/lib/vitest-extended/fixtures/zod.cjs.map +1 -0
  249. package/lib/vitest-extended/fixtures/zod.js +19 -0
  250. package/lib/vitest-extended/fixtures/zod.js.map +1 -0
  251. package/lib/vitest-extended/identity.cjs +14 -0
  252. package/lib/vitest-extended/identity.cjs.map +1 -0
  253. package/lib/vitest-extended/identity.d.ts +2 -0
  254. package/lib/vitest-extended/identity.js +11 -0
  255. package/lib/vitest-extended/identity.js.map +1 -0
  256. package/lib/vitest-extended/index.cjs +39 -0
  257. package/lib/vitest-extended/index.cjs.map +1 -0
  258. package/lib/vitest-extended/index.d.ts +6 -0
  259. package/lib/vitest-extended/index.js +24 -0
  260. package/lib/vitest-extended/index.js.map +1 -0
  261. package/lib/vitest-extended/isDefined.cjs +9 -0
  262. package/lib/vitest-extended/isDefined.cjs.map +1 -0
  263. package/lib/vitest-extended/isDefined.d.ts +2 -0
  264. package/lib/vitest-extended/isDefined.js +8 -0
  265. package/lib/vitest-extended/isDefined.js.map +1 -0
  266. package/lib/vitest-extended/isFunction.cjs +12 -0
  267. package/lib/vitest-extended/isFunction.cjs.map +1 -0
  268. package/lib/vitest-extended/isFunction.d.ts +1 -0
  269. package/lib/vitest-extended/isFunction.js +11 -0
  270. package/lib/vitest-extended/isFunction.js.map +1 -0
  271. package/lib/vitest-extended/toArray.cjs +35 -0
  272. package/lib/vitest-extended/toArray.cjs.map +1 -0
  273. package/lib/vitest-extended/toArray.d.ts +3 -0
  274. package/lib/vitest-extended/toArray.js +33 -0
  275. package/lib/vitest-extended/toArray.js.map +1 -0
  276. package/lib/vitest-extended/toStringFlat.cjs +18 -0
  277. package/lib/vitest-extended/toStringFlat.cjs.map +1 -0
  278. package/lib/vitest-extended/toStringFlat.d.ts +2 -0
  279. package/lib/vitest-extended/toStringFlat.js +17 -0
  280. package/lib/vitest-extended/toStringFlat.js.map +1 -0
  281. package/lib/vitest-extended/types.d.ts +64 -0
  282. package/package.json +149 -0
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ let rollup_plugin_tsconfig_paths = require("rollup-plugin-tsconfig-paths");
4
+ rollup_plugin_tsconfig_paths = require_runtime.__toESM(rollup_plugin_tsconfig_paths);
5
+ //#region src/rolldown-config/plugins/tsPaths.ts
6
+ /**
7
+ * Creates a configured tsconfig-paths plugin instance
8
+ * @param options - Configuration options for tsconfig-paths
9
+ * @returns Rolldown plugin
10
+ */
11
+ function tsPaths(options = {}) {
12
+ return (0, rollup_plugin_tsconfig_paths.default)(options);
13
+ }
14
+ //#endregion
15
+ exports.tsPaths = tsPaths;
16
+
17
+ //# sourceMappingURL=tsPaths.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsPaths.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,QACd,UAAgC,EAAE,EACZ;AACtB,SAAA,GAAA,6BAAA,SAAqB,QAAQ"}
@@ -0,0 +1,9 @@
1
+ import type { RolldownPluginOption } from 'rolldown';
2
+ import tsConfigPaths from 'rollup-plugin-tsconfig-paths';
3
+ export type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];
4
+ /**
5
+ * Creates a configured tsconfig-paths plugin instance
6
+ * @param options - Configuration options for tsconfig-paths
7
+ * @returns Rolldown plugin
8
+ */
9
+ export declare function tsPaths(options?: TsConfigPathsOptions): RolldownPluginOption;
@@ -0,0 +1,14 @@
1
+ import tsConfigPaths from "rollup-plugin-tsconfig-paths";
2
+ //#region src/rolldown-config/plugins/tsPaths.ts
3
+ /**
4
+ * Creates a configured tsconfig-paths plugin instance
5
+ * @param options - Configuration options for tsconfig-paths
6
+ * @returns Rolldown plugin
7
+ */
8
+ function tsPaths(options = {}) {
9
+ return tsConfigPaths(options);
10
+ }
11
+ //#endregion
12
+ export { tsPaths };
13
+
14
+ //# sourceMappingURL=tsPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsPaths.js","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;AASA,SAAgB,QACd,UAAgC,EAAE,EACZ;AACtB,QAAO,cAAc,QAAQ"}
@@ -0,0 +1,56 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_rolldown_config_utils = require("../utils.cjs");
4
+ const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
5
+ let fs = require("fs");
6
+ let tsc_alias = require("tsc-alias");
7
+ let typescript = require("typescript");
8
+ typescript = require_runtime.__toESM(typescript);
9
+ //#region src/rolldown-config/plugins/typescript.ts
10
+ const typescript$1 = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
11
+ let done = false;
12
+ return {
13
+ name: "bemedev-dts",
14
+ options(opts) {
15
+ opts.external = [...require_rolldown_config_utils.toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
16
+ return opts;
17
+ },
18
+ closeBundle: {
19
+ order: "pre",
20
+ async handler() {
21
+ if (done) return;
22
+ const cwd = process.cwd();
23
+ const tsconfigPath = typescript.default.findConfigFile(cwd, fs.existsSync, "tsconfig.json");
24
+ const configFile = require_rolldown_config_plugins_typescript_config.readTsConfig(tsconfigPath);
25
+ const host = typescript.default.createCompilerHost({});
26
+ const parsed = typescript.default.parseJsonConfigFileContent({
27
+ ...configFile,
28
+ include,
29
+ exclude: [...require_rolldown_config_utils.toArray(exclude), "*.ts"],
30
+ compilerOptions: {
31
+ ...configFile.options,
32
+ outDir,
33
+ noEmit: false,
34
+ emitDeclarationOnly: true,
35
+ declaration: true,
36
+ declarationMap
37
+ }
38
+ }, typescript.default.sys, cwd);
39
+ const program = typescript.default.createProgram(parsed.fileNames, parsed.options);
40
+ const emitResult = program.emit();
41
+ const errors = typescript.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === typescript.default.DiagnosticCategory.Error);
42
+ if (errors.length > 0) console.error(typescript.default.formatDiagnosticsWithColorAndContext(errors, host));
43
+ await (0, tsc_alias.replaceTscAliasPaths)({
44
+ configFile: tsconfigPath,
45
+ outDir
46
+ });
47
+ done = true;
48
+ console.log("DTS generation complete");
49
+ }
50
+ }
51
+ };
52
+ };
53
+ //#endregion
54
+ exports.typescript = typescript$1;
55
+
56
+ //# sourceMappingURL=typescript.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.cjs","names":["typescript","toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\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: outDir,\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({});\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 parsed.options,\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({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;AAcA,MAAaA,gBAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,EAAE,KAA2B;CACtC,IAAI,OAAO;AAEX,QAAO;EACL,MAAM;EACN,QAAQ,MAAM;AAIZ,QAAK,WAAW,CAAC,GAHAC,8BAAAA,QAAQ,KAAK,SAAS,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,OAC5C,EAC6B,qBAAqB;AACnD,UAAO;;EAET,aAAa;GACX,OAAO;GACP,MAAM,UAAU;AACd,QAAI,KAAM;IACV,MAAM,MAAM,QAAQ,KAAK;IAEzB,MAAM,eAAeC,WAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,gBACD;IAED,MAAM,aAAaC,kDAAAA,aAAa,aAAa;IAC7C,MAAM,OAAOF,WAAAA,QAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,SAASA,WAAAA,QAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAGD,8BAAAA,QAAQ,QAAQ,EAAE,OAAO;KACtC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;MACD;KACF,EACDC,WAAAA,QAAG,KACH,IACD;IAED,MAAM,UAAUA,WAAAA,QAAG,cACjB,OAAO,WACP,OAAO,QAER;IAED,MAAM,aAAa,QAAQ,MAAM;IAEjC,MAAM,SAASA,WAAAA,QACZ,sBAAsB,QAAQ,CAC9B,OAAO,WAAW,YAAY,CAC9B,QAAO,MAAK,EAAE,aAAaA,WAAAA,QAAG,mBAAmB,MAAM;AAE1D,QAAI,OAAO,SAAS,EAClB,SAAQ,MACNA,WAAAA,QAAG,qCAAqC,QAAQ,KAAK,CACtD;AAGH,WAAA,GAAA,UAAA,sBAA2B;KACzB,YAAY;KACZ;KACD,CAAC;AAEF,WAAO;AACP,YAAQ,IAAI,0BAA0B;;GAEzC;EACF"}
@@ -0,0 +1,58 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ let path = require("path");
4
+ let fs = require("fs");
5
+ let typescript = require("typescript");
6
+ typescript = require_runtime.__toESM(typescript);
7
+ //#region src/rolldown-config/plugins/typescript.config.ts
8
+ const _readFile = (filePath) => {
9
+ try {
10
+ return (0, fs.readFileSync)(filePath, "utf-8");
11
+ } catch {
12
+ return;
13
+ }
14
+ };
15
+ const _readDirectory = (rootDir, extensions, _, __, depth) => {
16
+ const results = [];
17
+ const walk = (dir, currentDepth) => {
18
+ if (depth !== void 0 && currentDepth > depth) return;
19
+ let entries;
20
+ try {
21
+ entries = (0, fs.readdirSync)(dir);
22
+ } catch {
23
+ return;
24
+ }
25
+ for (const entry of entries) {
26
+ const fullPath = (0, path.join)(dir, entry);
27
+ let stat;
28
+ try {
29
+ stat = (0, fs.statSync)(fullPath);
30
+ } catch {
31
+ continue;
32
+ }
33
+ if (stat.isDirectory()) walk(fullPath, currentDepth + 1);
34
+ else if (!extensions || extensions.some((ext) => entry.endsWith(ext))) results.push(fullPath);
35
+ }
36
+ };
37
+ walk(rootDir, 0);
38
+ return results;
39
+ };
40
+ const _host = {
41
+ useCaseSensitiveFileNames: true,
42
+ readDirectory: _readDirectory,
43
+ fileExists: fs.existsSync,
44
+ readFile: _readFile
45
+ };
46
+ const readTsConfig = (path$1) => {
47
+ const configFile = typescript.default.readConfigFile(path$1, _readFile);
48
+ if (configFile.error) throw new Error(typescript.default.formatDiagnostic(configFile.error, {
49
+ getCanonicalFileName: (f) => f,
50
+ getCurrentDirectory: () => process.cwd(),
51
+ getNewLine: () => "\n"
52
+ }));
53
+ return typescript.default.parseJsonConfigFileContent(configFile.config, _host, (0, path.resolve)(path$1.split("/").slice(0, -1).join("/")));
54
+ };
55
+ //#endregion
56
+ exports.readTsConfig = readTsConfig;
57
+
58
+ //# sourceMappingURL=typescript.config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n resolve(path.split('/').slice(0, -1).join('/')),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAIA,MAAM,aAAa,aAAyC;AAC1D,KAAI;AACF,UAAA,GAAA,GAAA,cAAoB,UAAU,QAAQ;SAChC;AACN;;;AAIJ,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,EAAE;CAE5B,MAAM,QAAQ,KAAa,iBAAyB;AAClD,MAAI,UAAU,KAAA,KAAa,eAAe,MAAO;EAEjD,IAAI;AACJ,MAAI;AACF,cAAA,GAAA,GAAA,aAAsB,IAAI;UACpB;AACN;;AAGF,OAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAA,KAAA,MAAgB,KAAK,MAAM;GACjC,IAAI;AACJ,OAAI;AACF,YAAA,GAAA,GAAA,UAAgB,SAAS;WACnB;AACN;;AAGF,OAAI,KAAK,aAAa,CACpB,MAAK,UAAU,eAAe,EAAE;YAEhC,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,IAAI,CAAC,CAE3C,SAAQ,KAAK,SAAS;;;AAK5B,MAAK,SAAS,EAAE;AAChB,QAAO;;AAGT,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYA,GAAAA;CACZ,UAAU;CACX;AAED,MAAa,gBAAgB,WAAiB;CAC5C,MAAM,aAAaC,WAAAA,QAAG,eAAeC,QAAM,UAAU;AAErD,KAAI,WAAW,MACb,OAAM,IAAI,MACRD,WAAAA,QAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,KAAK;EACxC,kBAAkB;EACnB,CAAC,CACH;AASH,QANqBA,WAAAA,QAAG,2BACtB,WAAW,QACX,QAAA,GAAA,KAAA,SACQC,OAAK,MAAM,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC,CAChD"}
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const readTsConfig: (path: string) => ts.ParsedCommandLine;
@@ -0,0 +1,55 @@
1
+ import { join, resolve } from "path";
2
+ import { existsSync, readFileSync, readdirSync, statSync } from "fs";
3
+ import ts from "typescript";
4
+ //#region src/rolldown-config/plugins/typescript.config.ts
5
+ const _readFile = (filePath) => {
6
+ try {
7
+ return readFileSync(filePath, "utf-8");
8
+ } catch {
9
+ return;
10
+ }
11
+ };
12
+ const _readDirectory = (rootDir, extensions, _, __, depth) => {
13
+ const results = [];
14
+ const walk = (dir, currentDepth) => {
15
+ if (depth !== void 0 && currentDepth > depth) return;
16
+ let entries;
17
+ try {
18
+ entries = readdirSync(dir);
19
+ } catch {
20
+ return;
21
+ }
22
+ for (const entry of entries) {
23
+ const fullPath = join(dir, entry);
24
+ let stat;
25
+ try {
26
+ stat = statSync(fullPath);
27
+ } catch {
28
+ continue;
29
+ }
30
+ if (stat.isDirectory()) walk(fullPath, currentDepth + 1);
31
+ else if (!extensions || extensions.some((ext) => entry.endsWith(ext))) results.push(fullPath);
32
+ }
33
+ };
34
+ walk(rootDir, 0);
35
+ return results;
36
+ };
37
+ const _host = {
38
+ useCaseSensitiveFileNames: true,
39
+ readDirectory: _readDirectory,
40
+ fileExists: existsSync,
41
+ readFile: _readFile
42
+ };
43
+ const readTsConfig = (path) => {
44
+ const configFile = ts.readConfigFile(path, _readFile);
45
+ if (configFile.error) throw new Error(ts.formatDiagnostic(configFile.error, {
46
+ getCanonicalFileName: (f) => f,
47
+ getCurrentDirectory: () => process.cwd(),
48
+ getNewLine: () => "\n"
49
+ }));
50
+ return ts.parseJsonConfigFileContent(configFile.config, _host, resolve(path.split("/").slice(0, -1).join("/")));
51
+ };
52
+ //#endregion
53
+ export { readTsConfig };
54
+
55
+ //# sourceMappingURL=typescript.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n resolve(path.split('/').slice(0, -1).join('/')),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAIA,MAAM,aAAa,aAAyC;AAC1D,KAAI;AACF,SAAO,aAAa,UAAU,QAAQ;SAChC;AACN;;;AAIJ,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,EAAE;CAE5B,MAAM,QAAQ,KAAa,iBAAyB;AAClD,MAAI,UAAU,KAAA,KAAa,eAAe,MAAO;EAEjD,IAAI;AACJ,MAAI;AACF,aAAU,YAAY,IAAI;UACpB;AACN;;AAGF,OAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,MAAM;GACjC,IAAI;AACJ,OAAI;AACF,WAAO,SAAS,SAAS;WACnB;AACN;;AAGF,OAAI,KAAK,aAAa,CACpB,MAAK,UAAU,eAAe,EAAE;YAEhC,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,IAAI,CAAC,CAE3C,SAAQ,KAAK,SAAS;;;AAK5B,MAAK,SAAS,EAAE;AAChB,QAAO;;AAGT,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;CACX;AAED,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,UAAU;AAErD,KAAI,WAAW,MACb,OAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,KAAK;EACxC,kBAAkB;EACnB,CAAC,CACH;AASH,QANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC,CAChD"}
@@ -0,0 +1,9 @@
1
+ import type { RolldownPluginOption } from 'rolldown';
2
+ type Props = {
3
+ exclude?: string | string[];
4
+ include?: Record<string, string>;
5
+ declarationMap?: boolean;
6
+ dir?: string;
7
+ };
8
+ export declare const typescript: ({ exclude, include, declarationMap, dir: outDir, }?: Props) => RolldownPluginOption;
9
+ export {};
@@ -0,0 +1,53 @@
1
+ import { toArray } from "../utils.js";
2
+ import { readTsConfig } from "./typescript.config.js";
3
+ import { existsSync } from "fs";
4
+ import { replaceTscAliasPaths } from "tsc-alias";
5
+ import ts from "typescript";
6
+ //#region src/rolldown-config/plugins/typescript.ts
7
+ const typescript = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
8
+ let done = false;
9
+ return {
10
+ name: "bemedev-dts",
11
+ options(opts) {
12
+ opts.external = [...toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
13
+ return opts;
14
+ },
15
+ closeBundle: {
16
+ order: "pre",
17
+ async handler() {
18
+ if (done) return;
19
+ const cwd = process.cwd();
20
+ const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
21
+ const configFile = readTsConfig(tsconfigPath);
22
+ const host = ts.createCompilerHost({});
23
+ const parsed = ts.parseJsonConfigFileContent({
24
+ ...configFile,
25
+ include,
26
+ exclude: [...toArray(exclude), "*.ts"],
27
+ compilerOptions: {
28
+ ...configFile.options,
29
+ outDir,
30
+ noEmit: false,
31
+ emitDeclarationOnly: true,
32
+ declaration: true,
33
+ declarationMap
34
+ }
35
+ }, ts.sys, cwd);
36
+ const program = ts.createProgram(parsed.fileNames, parsed.options);
37
+ const emitResult = program.emit();
38
+ const errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === ts.DiagnosticCategory.Error);
39
+ if (errors.length > 0) console.error(ts.formatDiagnosticsWithColorAndContext(errors, host));
40
+ await replaceTscAliasPaths({
41
+ configFile: tsconfigPath,
42
+ outDir
43
+ });
44
+ done = true;
45
+ console.log("DTS generation complete");
46
+ }
47
+ }
48
+ };
49
+ };
50
+ //#endregion
51
+ export { typescript };
52
+
53
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\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: outDir,\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({});\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 parsed.options,\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({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;AAcA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,EAAE,KAA2B;CACtC,IAAI,OAAO;AAEX,QAAO;EACL,MAAM;EACN,QAAQ,MAAM;AAIZ,QAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,SAAS,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,OAC5C,EAC6B,qBAAqB;AACnD,UAAO;;EAET,aAAa;GACX,OAAO;GACP,MAAM,UAAU;AACd,QAAI,KAAM;IACV,MAAM,MAAM,QAAQ,KAAK;IAEzB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,gBACD;IAED,MAAM,aAAa,aAAa,aAAa;IAC7C,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,SAAS,GAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAG,QAAQ,QAAQ,EAAE,OAAO;KACtC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;MACD;KACF,EACD,GAAG,KACH,IACD;IAED,MAAM,UAAU,GAAG,cACjB,OAAO,WACP,OAAO,QAER;IAED,MAAM,aAAa,QAAQ,MAAM;IAEjC,MAAM,SAAS,GACZ,sBAAsB,QAAQ,CAC9B,OAAO,WAAW,YAAY,CAC9B,QAAO,MAAK,EAAE,aAAa,GAAG,mBAAmB,MAAM;AAE1D,QAAI,OAAO,SAAS,EAClB,SAAQ,MACN,GAAG,qCAAqC,QAAQ,KAAK,CACtD;AAGH,UAAM,qBAAqB;KACzB,YAAY;KACZ;KACD,CAAC;AAEF,WAAO;AACP,YAAQ,IAAI,0BAA0B;;GAEzC;EACF"}
@@ -0,0 +1,20 @@
1
+ import type { RolldownPluginOption, RolldownOptions } from 'rolldown';
2
+ export type { RolldownOptions };
3
+ import type { PLUGIN_BUILDERS } from './plugins';
4
+ export type ToArray_F = <T>(value?: T | T[]) => T[];
5
+ export type Params = {
6
+ circularDeps?: string | string[];
7
+ excludesTS?: string | string[];
8
+ ignoresJS?: string | string[];
9
+ externals?: string | string[];
10
+ dir?: string;
11
+ sourcemap?: boolean;
12
+ declarationMap?: boolean;
13
+ plugins?: (RolldownPluginOption | keyof typeof PLUGIN_BUILDERS)[];
14
+ };
15
+ export type BuildInput_F = (...ignores: string[]) => Record<string, string>;
16
+ export type Config_F = {
17
+ (additionals?: Params): RolldownOptions;
18
+ bemedev: (additionals?: Params) => RolldownOptions;
19
+ default: (additionals?: Params) => RolldownOptions;
20
+ };
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/rolldown-config/utils.ts
3
+ const toArray = (value) => {
4
+ if (value === void 0 || value === null) return [];
5
+ if (Array.isArray(value)) return value;
6
+ return [value];
7
+ };
8
+ //#endregion
9
+ exports.toArray = toArray;
10
+
11
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":[],"sources":["../../src/rolldown-config/utils.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n"],"mappings":";;AAEA,MAAa,WAAqB,UAAS;AAGzC,KAFe,UAAU,KAAA,KAAa,UAAU,KAEpC,QAAO,EAAE;AACrB,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO;AAEjC,QAAO,CAAC,MAAM"}
@@ -0,0 +1,2 @@
1
+ import type { ToArray_F } from './types';
2
+ export declare const toArray: ToArray_F;
@@ -0,0 +1,10 @@
1
+ //#region src/rolldown-config/utils.ts
2
+ const toArray = (value) => {
3
+ if (value === void 0 || value === null) return [];
4
+ if (Array.isArray(value)) return value;
5
+ return [value];
6
+ };
7
+ //#endregion
8
+ export { toArray };
9
+
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/rolldown-config/utils.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n"],"mappings":";AAEA,MAAa,WAAqB,UAAS;AAGzC,KAFe,UAAU,KAAA,KAAa,UAAU,KAEpC,QAAO,EAAE;AACrB,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO;AAEjC,QAAO,CAAC,MAAM"}
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_utils_sleep = require("./sleep.cjs");
3
+ exports.sleep = require_utils_sleep.sleep;
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './sleep';
@@ -0,0 +1,2 @@
1
+ import { sleep } from "./sleep.js";
2
+ export { sleep };
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/sleep.ts
3
+ const sleep = (ms) => {
4
+ return new Promise((resolve) => setTimeout(resolve, ms));
5
+ };
6
+ //#endregion
7
+ exports.sleep = sleep;
8
+
9
+ //# sourceMappingURL=sleep.cjs.map
@@ -0,0 +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;AACnC,QAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,GAAG,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -0,0 +1,8 @@
1
+ //#region src/utils/sleep.ts
2
+ const sleep = (ms) => {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ };
5
+ //#endregion
6
+ export { sleep };
7
+
8
+ //# sourceMappingURL=sleep.js.map
@@ -0,0 +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;AACnC,QAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,GAAG,CAAC"}
@@ -0,0 +1 @@
1
+ export type Fn<Args extends unknown[], Return = void> = (...args: Args) => Return;
@@ -0,0 +1,19 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_vitest_alias_vitest = require("./vitest.cjs");
4
+ //#region src/vitest-alias/index.ts
5
+ var vitest_alias_exports = /* @__PURE__ */ require_runtime.__exportAll({
6
+ aliasTs: () => require_vitest_alias_vitest.aliasTs,
7
+ createAlias: () => require_vitest_alias_vitest.createAlias
8
+ });
9
+ //#endregion
10
+ exports.aliasTs = require_vitest_alias_vitest.aliasTs;
11
+ exports.createAlias = require_vitest_alias_vitest.createAlias;
12
+ Object.defineProperty(exports, "vitest_alias_exports", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return vitest_alias_exports;
16
+ }
17
+ });
18
+
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/vitest-alias/index.ts"],"sourcesContent":["export * from './vitest';\n"],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './vitest';
@@ -0,0 +1,11 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { aliasTs, createAlias } from "./vitest.js";
3
+ //#region src/vitest-alias/index.ts
4
+ var vitest_alias_exports = /* @__PURE__ */ __exportAll({
5
+ aliasTs: () => aliasTs,
6
+ createAlias: () => createAlias
7
+ });
8
+ //#endregion
9
+ export { aliasTs, createAlias, vitest_alias_exports };
10
+
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/vitest-alias/index.ts"],"sourcesContent":["export * from './vitest';\n"],"mappings":""}
@@ -0,0 +1,77 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ let path = require("path");
4
+ //#region src/vitest-alias/vitest.ts
5
+ const configPaths = (arg) => {
6
+ return arg.replace("/*", "");
7
+ };
8
+ const checkBaseUrl = (url) => {
9
+ return url && url !== "." && url !== "./";
10
+ };
11
+ const transformer = (baseUrl) => {
12
+ return ([_key, _value]) => {
13
+ const key = configPaths(_key);
14
+ const lastPath = configPaths(_value);
15
+ const cwd = process.cwd();
16
+ return [key, (0, path.resolve)(...checkBaseUrl(baseUrl) ? [
17
+ cwd,
18
+ baseUrl,
19
+ lastPath
20
+ ] : [cwd, lastPath])];
21
+ };
22
+ };
23
+ /**
24
+ * Add manually your alias with this function
25
+ * @param tsconfig The tsconfig json
26
+ * @returns a vitest config
27
+ *
28
+ * @example
29
+ * <code>
30
+ * {
31
+ * test: {
32
+ * alias: createAlias(tsconfig),
33
+ * }
34
+ * }
35
+ *</code>
36
+ */
37
+ const createAlias = (tsconfig) => {
38
+ const paths = tsconfig?.compilerOptions?.paths;
39
+ if (!paths) return {};
40
+ const array = Object.entries(paths).map(([key, [value]]) => {
41
+ return [key, value];
42
+ });
43
+ const baseUrl = tsconfig?.compilerOptions?.baseUrl;
44
+ const transformedArray = array.map(transformer(baseUrl));
45
+ return Object.fromEntries(transformedArray);
46
+ };
47
+ /**
48
+ * Plugin to add alias from tsconfig to test.alias
49
+ *
50
+ * @param tsconfig The tsconfig json
51
+ * @returns a vitest config
52
+ *
53
+ * @remarks
54
+ * Make sure you add "resolveJsonModule": true
55
+ * inside your tsconfig.json at compilerOPtions
56
+ * or add the json directly
57
+ */
58
+ const aliasTs = (tsconfig) => ({
59
+ name: "aliasTs",
60
+ enforce: "pre",
61
+ config: (options) => {
62
+ const testConfig = options?.test;
63
+ const alias = createAlias(tsconfig);
64
+ return {
65
+ ...options,
66
+ test: {
67
+ ...testConfig,
68
+ alias
69
+ }
70
+ };
71
+ }
72
+ });
73
+ //#endregion
74
+ exports.aliasTs = aliasTs;
75
+ exports.createAlias = createAlias;
76
+
77
+ //# sourceMappingURL=vitest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.cjs","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport type { UserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<UserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: TsConf) => {\n const paths = tsconfig?.compilerOptions?.paths;\n if (!paths) return {};\n const entries = Object.entries(paths);\n const array = entries.map(([key, [value]]) => {\n return [key, value];\n }) as Entry[];\n\n const baseUrl = tsconfig?.compilerOptions?.baseUrl;\n const transformedArray = array.map(transformer(baseUrl));\n const object = Object.fromEntries(transformedArray);\n\n return object;\n};\n\n/**\n * Plugin to add alias from tsconfig to test.alias\n *\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @remarks\n * Make sure you add \"resolveJsonModule\": true\n * inside your tsconfig.json at compilerOPtions\n * or add the json directly\n */\nexport const aliasTs = (tsconfig?: TsConf): Plugin => ({\n name: 'aliasTs',\n enforce: 'pre',\n config: options => {\n const testConfig = options?.test;\n const alias = createAlias(tsconfig);\n\n return {\n ...options,\n test: {\n ...testConfig,\n alias,\n },\n };\n },\n});\n"],"mappings":";;;;AAcA,MAAM,eAAe,QAAgB;AACnC,QAAO,IAAI,QAAQ,MAAM,GAAG;;AAG9B,MAAM,gBAAgB,QAA4B;AAChD,QAAO,OAAO,QAAQ,OAAO,QAAQ;;AAGvC,MAAM,eAAe,YAAqB;AACxC,SAAQ,CAAC,MAAM,YAAmB;EAChC,MAAM,MAAM,YAAY,KAAK;EAC7B,MAAM,WAAW,YAAY,OAAO;EACpC,MAAM,MAAM,QAAQ,KAAK;AAMzB,SAAO,CAAC,MAAA,GAAA,KAAA,SAFc,GAHT,aAAa,QAAQ,GAEd;GAAC;GAAK;GAAS;GAAS,GAAG,CAAC,KAAK,SAAS,CAChC,CAEX;;;;;;;;;;;;;;;;;AAkBvB,MAAa,eAAe,aAAsB;CAChD,MAAM,QAAQ,UAAU,iBAAiB;AACzC,KAAI,CAAC,MAAO,QAAO,EAAE;CAErB,MAAM,QADU,OAAO,QAAQ,MAAM,CACf,KAAK,CAAC,KAAK,CAAC,YAAY;AAC5C,SAAO,CAAC,KAAK,MAAM;GACnB;CAEF,MAAM,UAAU,UAAU,iBAAiB;CAC3C,MAAM,mBAAmB,MAAM,IAAI,YAAY,QAAQ,CAAC;AAGxD,QAFe,OAAO,YAAY,iBAAiB;;;;;;;;;;;;;AAgBrD,MAAa,WAAW,cAA+B;CACrD,MAAM;CACN,SAAS;CACT,SAAQ,YAAW;EACjB,MAAM,aAAa,SAAS;EAC5B,MAAM,QAAQ,YAAY,SAAS;AAEnC,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG;IACH;IACD;GACF;;CAEJ"}
@@ -0,0 +1,38 @@
1
+ import type { UserConfig } from 'vitest/config';
2
+ type TsConf = {
3
+ compilerOptions?: {
4
+ paths?: Record<string, string[]>;
5
+ baseUrl?: string;
6
+ };
7
+ };
8
+ type Plugin = Exclude<UserConfig['plugins'], undefined>[number];
9
+ /**
10
+ * Add manually your alias with this function
11
+ * @param tsconfig The tsconfig json
12
+ * @returns a vitest config
13
+ *
14
+ * @example
15
+ * <code>
16
+ * {
17
+ * test: {
18
+ * alias: createAlias(tsconfig),
19
+ * }
20
+ * }
21
+ *</code>
22
+ */
23
+ export declare const createAlias: (tsconfig?: TsConf) => {
24
+ [k: string]: string;
25
+ };
26
+ /**
27
+ * Plugin to add alias from tsconfig to test.alias
28
+ *
29
+ * @param tsconfig The tsconfig json
30
+ * @returns a vitest config
31
+ *
32
+ * @remarks
33
+ * Make sure you add "resolveJsonModule": true
34
+ * inside your tsconfig.json at compilerOPtions
35
+ * or add the json directly
36
+ */
37
+ export declare const aliasTs: (tsconfig?: TsConf) => Plugin;
38
+ export {};