@plugjs/plug 0.6.117 → 0.7.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 (388) hide show
  1. package/dist/asserts.d.ts +1 -0
  2. package/dist/asserts.d.ts.map +1 -0
  3. package/dist/asserts.js +68 -0
  4. package/dist/asserts.js.map +1 -0
  5. package/dist/async.d.ts +2 -1
  6. package/dist/async.d.ts.map +1 -0
  7. package/dist/async.js +52 -0
  8. package/dist/async.js.map +1 -0
  9. package/dist/build.d.ts +2 -1
  10. package/dist/build.d.ts.map +1 -0
  11. package/dist/build.js +236 -0
  12. package/dist/build.js.map +1 -0
  13. package/dist/{cli.d.mts → cli.d.ts} +3 -1
  14. package/dist/cli.d.ts.map +1 -0
  15. package/dist/cli.js +330 -0
  16. package/dist/cli.js.map +1 -0
  17. package/dist/files.d.ts +2 -1
  18. package/dist/files.d.ts.map +1 -0
  19. package/dist/files.js +93 -0
  20. package/dist/files.js.map +1 -0
  21. package/dist/fork.d.ts +5 -4
  22. package/dist/fork.d.ts.map +1 -0
  23. package/dist/fork.js +259 -0
  24. package/dist/fork.js.map +1 -0
  25. package/dist/fs.d.ts +1 -0
  26. package/dist/fs.d.ts.map +1 -0
  27. package/dist/fs.js +72 -0
  28. package/dist/fs.js.map +1 -0
  29. package/dist/globals.d.ts +4 -0
  30. package/dist/globals.d.ts.map +1 -0
  31. package/dist/globals.js +2 -0
  32. package/dist/globals.js.map +1 -0
  33. package/dist/helpers.d.ts +8 -7
  34. package/dist/helpers.d.ts.map +1 -0
  35. package/dist/helpers.js +231 -0
  36. package/dist/helpers.js.map +1 -0
  37. package/dist/index.d.ts +22 -21
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +21 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/logging/colors.d.ts +2 -1
  42. package/dist/logging/colors.d.ts.map +1 -0
  43. package/dist/logging/colors.js +121 -0
  44. package/dist/logging/colors.js.map +1 -0
  45. package/dist/logging/emit.d.ts +2 -1
  46. package/dist/logging/emit.d.ts.map +1 -0
  47. package/dist/logging/emit.js +137 -0
  48. package/dist/logging/emit.js.map +1 -0
  49. package/dist/logging/github.d.ts +2 -1
  50. package/dist/logging/github.d.ts.map +1 -0
  51. package/dist/logging/github.js +46 -0
  52. package/dist/logging/github.js.map +1 -0
  53. package/dist/logging/levels.d.ts +1 -0
  54. package/dist/logging/levels.d.ts.map +1 -0
  55. package/dist/logging/levels.js +50 -0
  56. package/dist/logging/levels.js.map +1 -0
  57. package/dist/logging/logger.d.ts +4 -3
  58. package/dist/logging/logger.d.ts.map +1 -0
  59. package/dist/logging/logger.js +161 -0
  60. package/dist/logging/logger.js.map +1 -0
  61. package/dist/logging/options.d.ts +2 -1
  62. package/dist/logging/options.d.ts.map +1 -0
  63. package/dist/logging/options.js +182 -0
  64. package/dist/logging/options.js.map +1 -0
  65. package/dist/logging/report.d.ts +4 -3
  66. package/dist/logging/report.d.ts.map +1 -0
  67. package/dist/logging/report.js +346 -0
  68. package/dist/logging/report.js.map +1 -0
  69. package/dist/logging/spinner.d.ts +1 -0
  70. package/dist/logging/spinner.d.ts.map +1 -0
  71. package/dist/logging/spinner.js +70 -0
  72. package/dist/logging/spinner.js.map +1 -0
  73. package/dist/logging.d.ts +8 -7
  74. package/dist/logging.d.ts.map +1 -0
  75. package/dist/logging.js +66 -0
  76. package/dist/logging.js.map +1 -0
  77. package/dist/paths.d.ts +33 -13
  78. package/dist/paths.d.ts.map +1 -0
  79. package/dist/paths.js +223 -0
  80. package/dist/paths.js.map +1 -0
  81. package/dist/pipe.d.ts +8 -5
  82. package/dist/pipe.d.ts.map +1 -0
  83. package/dist/pipe.js +205 -0
  84. package/dist/pipe.js.map +1 -0
  85. package/dist/plugs/build.d.ts +5 -4
  86. package/dist/plugs/build.d.ts.map +1 -0
  87. package/dist/plugs/build.js +56 -0
  88. package/dist/plugs/build.js.map +1 -0
  89. package/dist/plugs/copy.d.ts +1 -0
  90. package/dist/plugs/copy.d.ts.map +1 -0
  91. package/dist/plugs/copy.js +92 -0
  92. package/dist/plugs/copy.js.map +1 -0
  93. package/dist/plugs/debug.d.ts +1 -0
  94. package/dist/plugs/debug.d.ts.map +1 -0
  95. package/dist/plugs/debug.js +25 -0
  96. package/dist/plugs/debug.js.map +1 -0
  97. package/dist/plugs/edit.d.ts +2 -1
  98. package/dist/plugs/edit.d.ts.map +1 -0
  99. package/dist/plugs/edit.js +22 -0
  100. package/dist/plugs/edit.js.map +1 -0
  101. package/dist/plugs/esbuild/bundle-locals.d.ts +1 -0
  102. package/dist/plugs/esbuild/bundle-locals.d.ts.map +1 -0
  103. package/dist/plugs/esbuild/bundle-locals.js +29 -0
  104. package/dist/plugs/esbuild/bundle-locals.js.map +1 -0
  105. package/dist/plugs/esbuild/fix-extensions.d.ts +1 -0
  106. package/dist/plugs/esbuild/fix-extensions.d.ts.map +1 -0
  107. package/dist/plugs/esbuild/fix-extensions.js +98 -0
  108. package/dist/plugs/esbuild/fix-extensions.js.map +1 -0
  109. package/dist/plugs/esbuild.d.ts +21 -2
  110. package/dist/plugs/esbuild.d.ts.map +1 -0
  111. package/dist/plugs/esbuild.js +193 -0
  112. package/dist/plugs/esbuild.js.map +1 -0
  113. package/dist/plugs/exec.d.ts +2 -1
  114. package/dist/plugs/exec.d.ts.map +1 -0
  115. package/dist/plugs/exec.js +33 -0
  116. package/dist/plugs/exec.js.map +1 -0
  117. package/dist/plugs/exports.d.ts +1 -0
  118. package/dist/plugs/exports.d.ts.map +1 -0
  119. package/dist/plugs/exports.js +110 -0
  120. package/dist/plugs/exports.js.map +1 -0
  121. package/dist/plugs/filter.d.ts +2 -1
  122. package/dist/plugs/filter.d.ts.map +1 -0
  123. package/dist/plugs/filter.js +34 -0
  124. package/dist/plugs/filter.js.map +1 -0
  125. package/dist/plugs/rmf.d.ts +1 -0
  126. package/dist/plugs/rmf.d.ts.map +1 -0
  127. package/dist/plugs/rmf.js +24 -0
  128. package/dist/plugs/rmf.js.map +1 -0
  129. package/dist/plugs.d.ts +9 -8
  130. package/dist/plugs.d.ts.map +1 -0
  131. package/dist/plugs.js +9 -0
  132. package/dist/plugs.js.map +1 -0
  133. package/dist/types.d.ts +4 -3
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +2 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/utils/ansi.d.ts +1 -0
  138. package/dist/utils/ansi.d.ts.map +1 -0
  139. package/dist/utils/ansi.js +10 -0
  140. package/dist/utils/ansi.js.map +1 -0
  141. package/dist/utils/caller.d.ts +2 -1
  142. package/dist/utils/caller.d.ts.map +1 -0
  143. package/dist/utils/caller.js +33 -0
  144. package/dist/utils/caller.js.map +1 -0
  145. package/dist/utils/diff.d.ts +1 -0
  146. package/dist/utils/diff.d.ts.map +1 -0
  147. package/dist/utils/diff.js +278 -0
  148. package/dist/utils/diff.js.map +1 -0
  149. package/dist/utils/exec.d.ts +2 -1
  150. package/dist/utils/exec.d.ts.map +1 -0
  151. package/dist/utils/exec.js +84 -0
  152. package/dist/utils/exec.js.map +1 -0
  153. package/dist/utils/jsonc.d.ts +1 -0
  154. package/dist/utils/jsonc.d.ts.map +1 -0
  155. package/dist/utils/jsonc.js +46 -0
  156. package/dist/utils/jsonc.js.map +1 -0
  157. package/dist/utils/match.d.ts +1 -0
  158. package/dist/utils/match.d.ts.map +1 -0
  159. package/dist/utils/match.js +40 -0
  160. package/dist/utils/match.js.map +1 -0
  161. package/dist/utils/options.d.ts +1 -0
  162. package/dist/utils/options.d.ts.map +1 -0
  163. package/dist/utils/options.js +17 -0
  164. package/dist/utils/options.js.map +1 -0
  165. package/dist/utils/singleton.d.ts +1 -0
  166. package/dist/utils/singleton.d.ts.map +1 -0
  167. package/dist/utils/singleton.js +20 -0
  168. package/dist/utils/singleton.js.map +1 -0
  169. package/dist/utils/walk.d.ts +3 -2
  170. package/dist/utils/walk.d.ts.map +1 -0
  171. package/dist/utils/walk.js +84 -0
  172. package/dist/utils/walk.js.map +1 -0
  173. package/dist/utils.d.ts +9 -8
  174. package/dist/utils.d.ts.map +1 -0
  175. package/dist/utils.js +9 -0
  176. package/dist/utils.js.map +1 -0
  177. package/package.json +27 -87
  178. package/src/asserts.ts +2 -2
  179. package/src/async.ts +3 -3
  180. package/src/build.ts +10 -10
  181. package/src/{cli.mts → cli.ts} +27 -16
  182. package/src/files.ts +4 -4
  183. package/src/fork.ts +17 -17
  184. package/src/globals.ts +3 -0
  185. package/src/helpers.ts +20 -20
  186. package/src/index.ts +21 -21
  187. package/src/logging/colors.ts +4 -4
  188. package/src/logging/emit.ts +6 -6
  189. package/src/logging/github.ts +3 -3
  190. package/src/logging/logger.ts +12 -12
  191. package/src/logging/options.ts +10 -10
  192. package/src/logging/report.ts +10 -10
  193. package/src/logging/spinner.ts +3 -3
  194. package/src/logging.ts +14 -14
  195. package/src/paths.ts +42 -23
  196. package/src/pipe.ts +13 -8
  197. package/src/plugs/build.ts +8 -8
  198. package/src/plugs/copy.ts +8 -8
  199. package/src/plugs/debug.ts +4 -4
  200. package/src/plugs/edit.ts +5 -5
  201. package/src/plugs/esbuild/fix-extensions.ts +8 -10
  202. package/src/plugs/esbuild.ts +88 -27
  203. package/src/plugs/exec.ts +6 -6
  204. package/src/plugs/exports.ts +32 -35
  205. package/src/plugs/filter.ts +7 -7
  206. package/src/plugs/rmf.ts +5 -5
  207. package/src/plugs.ts +8 -8
  208. package/src/types.ts +3 -3
  209. package/src/utils/caller.ts +4 -4
  210. package/src/utils/diff.ts +2 -2
  211. package/src/utils/exec.ts +7 -7
  212. package/src/utils/jsonc.ts +1 -1
  213. package/src/utils/walk.ts +6 -6
  214. package/src/utils.ts +8 -8
  215. package/dist/asserts.cjs +0 -86
  216. package/dist/asserts.cjs.map +0 -6
  217. package/dist/asserts.mjs +0 -58
  218. package/dist/asserts.mjs.map +0 -6
  219. package/dist/async.cjs +0 -64
  220. package/dist/async.cjs.map +0 -6
  221. package/dist/async.mjs +0 -36
  222. package/dist/async.mjs.map +0 -6
  223. package/dist/build.cjs +0 -222
  224. package/dist/build.cjs.map +0 -6
  225. package/dist/build.mjs +0 -192
  226. package/dist/build.mjs.map +0 -6
  227. package/dist/cli.mjs +0 -258
  228. package/dist/cli.mjs.map +0 -6
  229. package/dist/files.cjs +0 -113
  230. package/dist/files.cjs.map +0 -6
  231. package/dist/files.mjs +0 -93
  232. package/dist/files.mjs.map +0 -6
  233. package/dist/fork.cjs +0 -224
  234. package/dist/fork.cjs.map +0 -6
  235. package/dist/fork.mjs +0 -198
  236. package/dist/fork.mjs.map +0 -6
  237. package/dist/fs.cjs +0 -146
  238. package/dist/fs.cjs.map +0 -6
  239. package/dist/fs.mjs +0 -82
  240. package/dist/fs.mjs.map +0 -6
  241. package/dist/globals.cjs +0 -2
  242. package/dist/globals.cjs.map +0 -6
  243. package/dist/globals.mjs +0 -1
  244. package/dist/globals.mjs.map +0 -6
  245. package/dist/helpers.cjs +0 -182
  246. package/dist/helpers.cjs.map +0 -6
  247. package/dist/helpers.mjs +0 -151
  248. package/dist/helpers.mjs.map +0 -6
  249. package/dist/index.cjs +0 -114
  250. package/dist/index.cjs.map +0 -6
  251. package/dist/index.mjs +0 -48
  252. package/dist/index.mjs.map +0 -6
  253. package/dist/logging/colors.cjs +0 -136
  254. package/dist/logging/colors.cjs.map +0 -6
  255. package/dist/logging/colors.mjs +0 -99
  256. package/dist/logging/colors.mjs.map +0 -6
  257. package/dist/logging/emit.cjs +0 -134
  258. package/dist/logging/emit.cjs.map +0 -6
  259. package/dist/logging/emit.mjs +0 -106
  260. package/dist/logging/emit.mjs.map +0 -6
  261. package/dist/logging/github.cjs +0 -60
  262. package/dist/logging/github.cjs.map +0 -6
  263. package/dist/logging/github.mjs +0 -35
  264. package/dist/logging/github.mjs.map +0 -6
  265. package/dist/logging/levels.cjs +0 -69
  266. package/dist/logging/levels.cjs.map +0 -6
  267. package/dist/logging/levels.mjs +0 -35
  268. package/dist/logging/levels.mjs.map +0 -6
  269. package/dist/logging/logger.cjs +0 -165
  270. package/dist/logging/logger.cjs.map +0 -6
  271. package/dist/logging/logger.mjs +0 -139
  272. package/dist/logging/logger.mjs.map +0 -6
  273. package/dist/logging/options.cjs +0 -192
  274. package/dist/logging/options.cjs.map +0 -6
  275. package/dist/logging/options.mjs +0 -167
  276. package/dist/logging/options.mjs.map +0 -6
  277. package/dist/logging/report.cjs +0 -298
  278. package/dist/logging/report.cjs.map +0 -6
  279. package/dist/logging/report.mjs +0 -273
  280. package/dist/logging/report.mjs.map +0 -6
  281. package/dist/logging/spinner.cjs +0 -100
  282. package/dist/logging/spinner.cjs.map +0 -6
  283. package/dist/logging/spinner.mjs +0 -72
  284. package/dist/logging/spinner.mjs.map +0 -6
  285. package/dist/logging.cjs +0 -91
  286. package/dist/logging.cjs.map +0 -6
  287. package/dist/logging.mjs +0 -58
  288. package/dist/logging.mjs.map +0 -6
  289. package/dist/paths.cjs +0 -170
  290. package/dist/paths.cjs.map +0 -6
  291. package/dist/paths.mjs +0 -132
  292. package/dist/paths.mjs.map +0 -6
  293. package/dist/pipe.cjs +0 -163
  294. package/dist/pipe.cjs.map +0 -6
  295. package/dist/pipe.mjs +0 -135
  296. package/dist/pipe.mjs.map +0 -6
  297. package/dist/plugs/build.cjs +0 -73
  298. package/dist/plugs/build.cjs.map +0 -6
  299. package/dist/plugs/build.mjs +0 -47
  300. package/dist/plugs/build.mjs.map +0 -6
  301. package/dist/plugs/copy.cjs +0 -86
  302. package/dist/plugs/copy.cjs.map +0 -6
  303. package/dist/plugs/copy.mjs +0 -69
  304. package/dist/plugs/copy.mjs.map +0 -6
  305. package/dist/plugs/debug.cjs +0 -24
  306. package/dist/plugs/debug.cjs.map +0 -6
  307. package/dist/plugs/debug.mjs +0 -22
  308. package/dist/plugs/debug.mjs.map +0 -6
  309. package/dist/plugs/edit.cjs +0 -20
  310. package/dist/plugs/edit.cjs.map +0 -6
  311. package/dist/plugs/edit.mjs +0 -18
  312. package/dist/plugs/edit.mjs.map +0 -6
  313. package/dist/plugs/esbuild/bundle-locals.cjs +0 -48
  314. package/dist/plugs/esbuild/bundle-locals.cjs.map +0 -6
  315. package/dist/plugs/esbuild/bundle-locals.mjs +0 -23
  316. package/dist/plugs/esbuild/bundle-locals.mjs.map +0 -6
  317. package/dist/plugs/esbuild/fix-extensions.cjs +0 -89
  318. package/dist/plugs/esbuild/fix-extensions.cjs.map +0 -6
  319. package/dist/plugs/esbuild/fix-extensions.mjs +0 -54
  320. package/dist/plugs/esbuild/fix-extensions.mjs.map +0 -6
  321. package/dist/plugs/esbuild.cjs +0 -139
  322. package/dist/plugs/esbuild.cjs.map +0 -6
  323. package/dist/plugs/esbuild.mjs +0 -116
  324. package/dist/plugs/esbuild.mjs.map +0 -6
  325. package/dist/plugs/exec.cjs +0 -42
  326. package/dist/plugs/exec.cjs.map +0 -6
  327. package/dist/plugs/exec.mjs +0 -25
  328. package/dist/plugs/exec.mjs.map +0 -6
  329. package/dist/plugs/exports.cjs +0 -117
  330. package/dist/plugs/exports.cjs.map +0 -6
  331. package/dist/plugs/exports.mjs +0 -100
  332. package/dist/plugs/exports.mjs.map +0 -6
  333. package/dist/plugs/filter.cjs +0 -47
  334. package/dist/plugs/filter.cjs.map +0 -6
  335. package/dist/plugs/filter.mjs +0 -30
  336. package/dist/plugs/filter.mjs.map +0 -6
  337. package/dist/plugs/rmf.cjs +0 -25
  338. package/dist/plugs/rmf.cjs.map +0 -6
  339. package/dist/plugs/rmf.mjs +0 -23
  340. package/dist/plugs/rmf.mjs.map +0 -6
  341. package/dist/plugs.cjs +0 -39
  342. package/dist/plugs.cjs.map +0 -6
  343. package/dist/plugs.mjs +0 -10
  344. package/dist/plugs.mjs.map +0 -6
  345. package/dist/types.cjs +0 -19
  346. package/dist/types.cjs.map +0 -6
  347. package/dist/types.mjs +0 -1
  348. package/dist/types.mjs.map +0 -6
  349. package/dist/utils/ansi.cjs +0 -39
  350. package/dist/utils/ansi.cjs.map +0 -6
  351. package/dist/utils/ansi.mjs +0 -13
  352. package/dist/utils/ansi.mjs.map +0 -6
  353. package/dist/utils/caller.cjs +0 -57
  354. package/dist/utils/caller.cjs.map +0 -6
  355. package/dist/utils/caller.mjs +0 -32
  356. package/dist/utils/caller.mjs.map +0 -6
  357. package/dist/utils/diff.cjs +0 -282
  358. package/dist/utils/diff.cjs.map +0 -6
  359. package/dist/utils/diff.mjs +0 -256
  360. package/dist/utils/diff.mjs.map +0 -6
  361. package/dist/utils/exec.cjs +0 -113
  362. package/dist/utils/exec.cjs.map +0 -6
  363. package/dist/utils/exec.mjs +0 -78
  364. package/dist/utils/exec.mjs.map +0 -6
  365. package/dist/utils/jsonc.cjs +0 -74
  366. package/dist/utils/jsonc.cjs.map +0 -6
  367. package/dist/utils/jsonc.mjs +0 -48
  368. package/dist/utils/jsonc.mjs.map +0 -6
  369. package/dist/utils/match.cjs +0 -74
  370. package/dist/utils/match.cjs.map +0 -6
  371. package/dist/utils/match.mjs +0 -39
  372. package/dist/utils/match.mjs.map +0 -6
  373. package/dist/utils/options.cjs +0 -39
  374. package/dist/utils/options.cjs.map +0 -6
  375. package/dist/utils/options.mjs +0 -14
  376. package/dist/utils/options.mjs.map +0 -6
  377. package/dist/utils/singleton.cjs +0 -37
  378. package/dist/utils/singleton.cjs.map +0 -6
  379. package/dist/utils/singleton.mjs +0 -12
  380. package/dist/utils/singleton.mjs.map +0 -6
  381. package/dist/utils/walk.cjs +0 -98
  382. package/dist/utils/walk.cjs.map +0 -6
  383. package/dist/utils/walk.mjs +0 -73
  384. package/dist/utils/walk.mjs.map +0 -6
  385. package/dist/utils.cjs +0 -39
  386. package/dist/utils.cjs.map +0 -6
  387. package/dist/utils.mjs +0 -10
  388. package/dist/utils.mjs.map +0 -6
@@ -0,0 +1,84 @@
1
+ import { basename, join } from 'node:path';
2
+ import { opendir, stat } from "../fs.js";
3
+ import { $p, log } from "../logging.js";
4
+ import { resolveAbsolutePath } from "../paths.js";
5
+ import { match } from "./match.js";
6
+ /**
7
+ * Walk the specified directory, returning an asynchronous iterator over all
8
+ * the _relative_ files found matching the specified globs and matching options.
9
+ */
10
+ export function walk(directory, globs, options = {}) {
11
+ const { maxDepth = Infinity, followSymlinks = true, allowNodeModules = false, ...opts } = options;
12
+ /* Make sure to also ignore node modules or dot directories if we have to */
13
+ const onDirectory = (dir) => {
14
+ // if we were told to start looking into "node_modules", or in a directory
15
+ // starting with ".", then we ignore any whatsoever option here!
16
+ if (dir === directory)
17
+ return true;
18
+ const name = basename(dir);
19
+ if (name === 'node_modules')
20
+ return !!allowNodeModules;
21
+ if (name.startsWith('.'))
22
+ return !!opts.dot;
23
+ return true;
24
+ };
25
+ /* Create our positive matcher to match our globs */
26
+ const positiveMatcher = match(globs, opts);
27
+ /* Do the walk! */
28
+ log.debug('Walking directory', $p(directory), { globs, options });
29
+ return walker({
30
+ directory,
31
+ relative: '',
32
+ matcher: positiveMatcher,
33
+ onDirectory,
34
+ followSymlinks,
35
+ maxDepth,
36
+ depth: 0,
37
+ });
38
+ }
39
+ /* Walk a directory and yield matching results until the given `maxDepth` */
40
+ async function* walker(args) {
41
+ const { directory, relative, matcher: positiveMatcher, onDirectory, followSymlinks, maxDepth, depth, } = args;
42
+ /* Read the directory, including file types */
43
+ const dir = resolveAbsolutePath(directory, relative);
44
+ if (!onDirectory(dir))
45
+ return;
46
+ log.trace('Reading directory', $p(dir));
47
+ let dirents;
48
+ try {
49
+ dirents = await opendir(dir);
50
+ }
51
+ catch (error) {
52
+ if (error.code !== 'ENOENT')
53
+ throw error;
54
+ log.warn('Directory', $p(dir), 'not found');
55
+ return;
56
+ }
57
+ /* For each entry we determine the full path */
58
+ for await (const dirent of dirents) {
59
+ const path = join(relative, dirent.name);
60
+ /* If the entry is a file and matches, yield it */
61
+ if (dirent.isFile() && positiveMatcher(path))
62
+ yield path;
63
+ /* If the entry is a directory within our depth, walk it recursively */
64
+ else if (dirent.isDirectory() && (depth < maxDepth)) {
65
+ const children = walker({ ...args, relative: path, depth: depth + 1 });
66
+ for await (const child of children)
67
+ yield child;
68
+ /* If this is a symlink and we're told to check them let's see what we have */
69
+ }
70
+ else if (dirent.isSymbolicLink() && followSymlinks) {
71
+ const info = await stat(join(directory, path));
72
+ /* If the link is a file and matches, yield it */
73
+ if (info.isFile() && positiveMatcher(path))
74
+ yield path;
75
+ /* If the link is a directory within our depth, walk it recursively */
76
+ else if (info.isDirectory() && (depth < maxDepth)) {
77
+ const children = walker({ ...args, relative: path, depth: depth + 1 });
78
+ for await (const child of children)
79
+ yield child;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=walk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"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"}
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export * from './utils/ansi';
2
- export * from './utils/diff';
3
- export * from './utils/exec';
4
- export * from './utils/jsonc';
5
- export * from './utils/match';
6
- export * from './utils/options';
7
- export * from './utils/singleton';
8
- export * from './utils/walk';
1
+ export * from './utils/ansi.ts';
2
+ export * from './utils/diff.ts';
3
+ export * from './utils/exec.ts';
4
+ export * from './utils/jsonc.ts';
5
+ export * from './utils/match.ts';
6
+ export * from './utils/options.ts';
7
+ export * from './utils/singleton.ts';
8
+ export * from './utils/walk.ts';
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
package/dist/utils.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from "./utils/ansi.js";
2
+ export * from "./utils/diff.js";
3
+ export * from "./utils/exec.js";
4
+ export * from "./utils/jsonc.js";
5
+ export * from "./utils/match.js";
6
+ export * from "./utils/options.js";
7
+ export * from "./utils/singleton.js";
8
+ export * from "./utils/walk.js";
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
package/package.json CHANGED
@@ -1,117 +1,59 @@
1
1
  {
2
2
  "name": "@plugjs/plug",
3
- "version": "0.6.117",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
- "main": "./dist/index.cjs",
6
- "module": "./dist/index.mjs",
5
+ "main": "./dist/index.js",
7
6
  "types": "./dist/index.d.ts",
8
7
  "bin": {
9
- "plug": "./dist/cli.mjs"
8
+ "plug": "./dist/cli.js"
10
9
  },
11
10
  "exports": {
12
11
  ".": {
13
- "require": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.cjs"
16
- },
17
- "import": {
18
- "types": "./dist/index.d.ts",
19
- "default": "./dist/index.mjs"
20
- }
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
21
14
  },
22
15
  "./asserts": {
23
- "require": {
24
- "types": "./dist/asserts.d.ts",
25
- "default": "./dist/asserts.cjs"
26
- },
27
- "import": {
28
- "types": "./dist/asserts.d.ts",
29
- "default": "./dist/asserts.mjs"
30
- }
16
+ "types": "./dist/asserts.d.ts",
17
+ "default": "./dist/asserts.js"
31
18
  },
32
19
  "./files": {
33
- "require": {
34
- "types": "./dist/files.d.ts",
35
- "default": "./dist/files.cjs"
36
- },
37
- "import": {
38
- "types": "./dist/files.d.ts",
39
- "default": "./dist/files.mjs"
40
- }
20
+ "types": "./dist/files.d.ts",
21
+ "default": "./dist/files.js"
41
22
  },
42
23
  "./fork": {
43
- "require": {
44
- "types": "./dist/fork.d.ts",
45
- "default": "./dist/fork.cjs"
46
- },
47
- "import": {
48
- "types": "./dist/fork.d.ts",
49
- "default": "./dist/fork.mjs"
50
- }
24
+ "types": "./dist/fork.d.ts",
25
+ "default": "./dist/fork.js"
51
26
  },
52
27
  "./fs": {
53
- "require": {
54
- "types": "./dist/fs.d.ts",
55
- "default": "./dist/fs.cjs"
56
- },
57
- "import": {
58
- "types": "./dist/fs.d.ts",
59
- "default": "./dist/fs.mjs"
60
- }
28
+ "types": "./dist/fs.d.ts",
29
+ "default": "./dist/fs.js"
61
30
  },
62
31
  "./globals": {
63
- "require": {
64
- "types": "./dist/globals.d.ts",
65
- "default": "./dist/globals.cjs"
66
- },
67
- "import": {
68
- "types": "./dist/globals.d.ts",
69
- "default": "./dist/globals.mjs"
70
- }
32
+ "types": "./dist/globals.d.ts",
33
+ "default": "./dist/globals.js"
71
34
  },
72
35
  "./logging": {
73
- "require": {
74
- "types": "./dist/logging.d.ts",
75
- "default": "./dist/logging.cjs"
76
- },
77
- "import": {
78
- "types": "./dist/logging.d.ts",
79
- "default": "./dist/logging.mjs"
80
- }
36
+ "types": "./dist/logging.d.ts",
37
+ "default": "./dist/logging.js"
81
38
  },
82
39
  "./paths": {
83
- "require": {
84
- "types": "./dist/paths.d.ts",
85
- "default": "./dist/paths.cjs"
86
- },
87
- "import": {
88
- "types": "./dist/paths.d.ts",
89
- "default": "./dist/paths.mjs"
90
- }
40
+ "types": "./dist/paths.d.ts",
41
+ "default": "./dist/paths.js"
91
42
  },
92
43
  "./pipe": {
93
- "require": {
94
- "types": "./dist/pipe.d.ts",
95
- "default": "./dist/pipe.cjs"
96
- },
97
- "import": {
98
- "types": "./dist/pipe.d.ts",
99
- "default": "./dist/pipe.mjs"
100
- }
44
+ "types": "./dist/pipe.d.ts",
45
+ "default": "./dist/pipe.js"
101
46
  },
102
47
  "./utils": {
103
- "require": {
104
- "types": "./dist/utils.d.ts",
105
- "default": "./dist/utils.cjs"
106
- },
107
- "import": {
108
- "types": "./dist/utils.d.ts",
109
- "default": "./dist/utils.mjs"
110
- }
48
+ "types": "./dist/utils.d.ts",
49
+ "default": "./dist/utils.js"
111
50
  }
112
51
  },
113
52
  "author": "Juit Developers <developers@juit.com>",
114
53
  "license": "Apache-2.0",
54
+ "engines": {
55
+ "node": ">=22.16.0"
56
+ },
115
57
  "dependencies": {
116
58
  "@plugjs/tsrun": "^0.7.4",
117
59
  "@types/node": "<23",
@@ -124,14 +66,12 @@
124
66
  },
125
67
  "files": [
126
68
  "*.md",
127
- "cli/",
128
69
  "dist/",
129
- "extra/",
130
70
  "src/"
131
71
  ],
132
72
  "repository": {
133
73
  "type": "git",
134
- "url": "git+ssh://git@github.com/plugjs/plug.git"
74
+ "url": "git+https://github.com/plugjs/plug.git"
135
75
  },
136
76
  "keywords": [
137
77
  "build",
package/src/asserts.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * BUILD FAILURES *
3
3
  * ========================================================================== */
4
4
 
5
- import { githubAnnotation } from './logging/github'
5
+ import { githubAnnotation } from './logging/github.ts'
6
6
 
7
7
  /** A symbol marking {@link BuildFailure} instances */
8
8
  const buildFailure = Symbol.for('plugjs:plug:types:BuildFailure')
@@ -37,7 +37,7 @@ export class BuildFailure extends Error {
37
37
  return new BuildFailure(undefined, errors)
38
38
  }
39
39
 
40
- static [Symbol.hasInstance](instance: any): boolean {
40
+ static override [Symbol.hasInstance](instance: any): boolean {
41
41
  return instance && instance[buildFailure] === buildFailure
42
42
  }
43
43
 
package/src/async.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks'
2
2
 
3
- import { assert } from './asserts'
4
- import { getSingleton } from './utils/singleton'
3
+ import { assert } from './asserts.ts'
4
+ import { getSingleton } from './utils/singleton.ts'
5
5
 
6
- import type { Context } from './pipe'
6
+ import type { Context } from './pipe.ts'
7
7
 
8
8
  /* ========================================================================== *
9
9
  * EXPORTED *
package/src/build.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { BuildFailure, assert } from './asserts'
2
- import { runAsync } from './async'
3
- import { $grn, $gry, $ms, $p, $plur, $t, $ylw, NOTICE, getLogger, log, logOptions } from './logging'
4
- import { Context, ContextPromises, PipeImpl } from './pipe'
5
- import { findCaller } from './utils/caller'
6
- import { getSingleton } from './utils/singleton'
7
-
8
- import type { Pipe } from './index'
9
- import type { AbsolutePath } from './paths'
1
+ import { BuildFailure, assert } from './asserts.ts'
2
+ import { runAsync } from './async.ts'
3
+ import { $grn, $gry, $ms, $p, $plur, $t, $ylw, NOTICE, getLogger, log, logOptions } from './logging.ts'
4
+ import { Context, ContextPromises, PipeImpl } from './pipe.ts'
5
+ import { findCaller } from './utils/caller.ts'
6
+ import { getSingleton } from './utils/singleton.ts'
7
+
8
+ import type { Pipe } from './index.ts'
9
+ import type { AbsolutePath } from './paths.ts'
10
10
  import type {
11
11
  Build,
12
12
  BuildDef,
@@ -20,7 +20,7 @@ import type {
20
20
  TaskDef,
21
21
  Tasks,
22
22
  ThisBuild,
23
- } from './types'
23
+ } from './types.ts'
24
24
 
25
25
  /* ========================================================================== *
26
26
  * INTERNAL UTILITIES *
@@ -1,22 +1,24 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-fallthrough */
2
+ /* coverage ignore file / not tested in unit tests */
3
+ /* eslint-disable no-fallthrough */ // process.exit(...) is not caught
3
4
  /* eslint-disable no-console */
4
5
 
5
6
  import _fs from 'node:fs'
7
+ import _path from 'node:path'
6
8
 
7
9
  import { main, yargsParser } from '@plugjs/tsrun'
8
10
 
9
- import { BuildFailure } from './asserts'
10
- import { runAsync } from './async'
11
- import { invokeTasks, isBuild } from './build'
12
- import { $blu, $gry, $p, $red, $t, $und, $wht } from './logging/colors'
13
- import { logLevels } from './logging/levels'
14
- import { logOptions } from './logging/options'
15
- import { getCurrentWorkingDirectory, resolveAbsolutePath, resolveDirectory, resolveFile } from './paths'
16
- import { Context } from './pipe'
11
+ import { BuildFailure } from './asserts.ts'
12
+ import { runAsync } from './async.ts'
13
+ import { invokeTasks, isBuild } from './build.ts'
14
+ import { $blu, $gry, $p, $red, $t, $und, $wht } from './logging/colors.ts'
15
+ import { logLevels } from './logging/levels.ts'
16
+ import { logOptions } from './logging/options.ts'
17
+ import { getCurrentWorkingDirectory, resolveAbsolutePath, resolveDirectory, resolveFile } from './paths.ts'
18
+ import { Context } from './pipe.ts'
17
19
 
18
- import type { AbsolutePath } from './paths'
19
- import type { Build } from './types'
20
+ import type { AbsolutePath } from './paths.ts'
21
+ import type { Build } from './types.ts'
20
22
 
21
23
  /* Log levels */
22
24
  const { TRACE, DEBUG, INFO, NOTICE, WARN, ERROR, OFF } = logLevels
@@ -26,9 +28,18 @@ const $bnd = (s: string): string => $blu($und(s))
26
28
  const $gnd = (s: string): string => $gry($und(s))
27
29
  const $wnd = (s: string): string => $wht($und(s))
28
30
 
29
- /** Version injected by esbuild, defaulted in case of dynamic transpilation */
30
- const version = typeof __version === 'string' ? __version : '0.0.0-dev'
31
- declare const __version: string | undefined
31
+ /** Version resolved from "package.json" */
32
+ function version(): string {
33
+ try {
34
+ const packageJsonPath = _path.resolve(import.meta.dirname, '..', 'package.json')
35
+ const packageJson = JSON.parse(_fs.readFileSync(packageJsonPath, 'utf-8'))
36
+ return (typeof packageJson.version === 'string' && packageJson.version)
37
+ ? packageJson.version
38
+ : '0.0.0-dev'
39
+ } catch {
40
+ return '0.0.0-dev'
41
+ }
42
+ }
32
43
 
33
44
  /* ========================================================================== *
34
45
  * HELP SCREEN *
@@ -49,7 +60,7 @@ function help(): void {
49
60
  ${$wht('-c --colors')} Force colorful output (use ${$wnd('--no-colors')} to force plain text)
50
61
  ${$wht('-l --list')} Only list the tasks defined by the build, nothing more!
51
62
  ${$wht('-h --help')} Help! You're reading it now!
52
- ${$wht(' --version')} Version! This one: ${version}!
63
+ ${$wht(' --version')} Version! This one: ${version()}!
53
64
 
54
65
  ${$bnd('Properties:')}
55
66
 
@@ -163,7 +174,7 @@ export function parseCommandLine(args: string[]): CommandLineOptions {
163
174
  help()
164
175
  process.exit(0)
165
176
  case 'version':
166
- console.log(`PlugJS ${$gry('ver.')} ${$wnd(version)}`)
177
+ console.log(`PlugJS ${$gry('ver.')} ${$wnd(version())}`)
167
178
  process.exit(0)
168
179
  default:
169
180
  console.log(`Unsupported option ${$wnd(key)} (try ${$wnd('--help')})`)
package/src/files.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { inspect } from 'node:util'
2
2
 
3
- import { assert } from './asserts'
4
- import { mkdir, writeFile } from './fs'
3
+ import { assert } from './asserts.ts'
4
+ import { mkdir, writeFile } from './fs.ts'
5
5
  import {
6
6
  assertRelativeChildPath,
7
7
  getAbsoluteParent,
8
8
  getCurrentWorkingDirectory,
9
9
  resolveAbsolutePath,
10
- } from './paths'
10
+ } from './paths.ts'
11
11
 
12
- import type { AbsolutePath } from './paths'
12
+ import type { AbsolutePath } from './paths.ts'
13
13
 
14
14
  /** The {@link FilesBuilder} interface defines a builder for {@link Files}. */
15
15
  export interface FilesBuilder {
package/src/fork.ts CHANGED
@@ -2,18 +2,18 @@ import { fork } from 'node:child_process'
2
2
  import { Console } from 'node:console'
3
3
  import { Writable } from 'node:stream'
4
4
 
5
- import { assert, BuildFailure } from './asserts'
6
- import { runAsync } from './async'
7
- import { Files } from './files'
8
- import { $gry, $p, $red, logOptions, NOTICE, WARN } from './logging'
9
- import { emit, emitForked } from './logging/emit'
10
- import { requireFilename, resolveFile } from './paths'
11
- import { Context, install } from './pipe'
12
-
13
- import type { LogLevel } from './logging'
14
- import type { ForkedLogMessage } from './logging/emit'
15
- import type { AbsolutePath } from './paths'
16
- import type { Plug, PlugName, PlugResult } from './pipe'
5
+ import { assert, BuildFailure } from './asserts.ts'
6
+ import { runAsync } from './async.ts'
7
+ import { Files } from './files.ts'
8
+ import { $gry, $p, $red, logOptions, NOTICE, WARN } from './logging.ts'
9
+ import { emit, emitForked } from './logging/emit.ts'
10
+ import { requireFilename, resolveFile } from './paths.ts'
11
+ import { Context, install } from './pipe.ts'
12
+
13
+ import type { LogLevel } from './logging.ts'
14
+ import type { ForkedLogMessage } from './logging/emit.ts'
15
+ import type { AbsolutePath } from './paths.ts'
16
+ import type { Plug, PlugName, PlugResult } from './pipe.ts'
17
17
 
18
18
  /**
19
19
  * Options accepted by {@link ForkingPlug}'s instrumenting how the process
@@ -79,7 +79,7 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
79
79
  }
80
80
 
81
81
  /* Get _this_ filename to spawn */
82
- const script = requireFilename(__fileurl)
82
+ const script = requireFilename(import.meta.filename)
83
83
  context.log.debug('About to fork plug from', $p(this._scriptFile))
84
84
 
85
85
  /* Environment variables */
@@ -90,11 +90,11 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
90
90
  if (this._arguments[i] == null) continue // null or undefined... optionals
91
91
  if (typeof this._arguments[i] === 'object') {
92
92
  if (typeof this._arguments[i].coverageDir === 'string') {
93
- const dir = env.NODE_V8_COVERAGE = context.resolve(this._arguments[i].coverageDir)
93
+ const dir = env['NODE_V8_COVERAGE'] = context.resolve(this._arguments[i].coverageDir)
94
94
  context.log.debug('Forked process will produce coverage in', $p(dir))
95
95
  }
96
96
  if (typeof this._arguments[i].forceModule === 'string') {
97
- const force = env.__TS_LOADER_FORCE_TYPE = this._arguments[i].forceModule
97
+ const force = env['__TS_LOADER_FORCE_TYPE'] = this._arguments[i].forceModule
98
98
  context.log.debug('Forked process will force module type as', $p(force))
99
99
  }
100
100
  }
@@ -189,7 +189,7 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
189
189
  * parent process, we can safely assume we need to run our plug... So we wait
190
190
  * for the message and respond once the plug returns _something_!
191
191
  */
192
- if ((process.argv[1] === requireFilename(__fileurl)) && (process.send)) {
192
+ if ((process.argv[1] === requireFilename(import.meta.filename)) && (process.send)) {
193
193
  /* Save the original console, we'll replace it on "message" */
194
194
  const originalConsole = globalThis.console
195
195
 
@@ -228,7 +228,7 @@ if ((process.argv[1] === requireFilename(__fileurl)) && (process.send)) {
228
228
 
229
229
  /* Create a couple of writers for our fake "stdout" and "stderr" */
230
230
  const makeWritable = (level: LogLevel): Writable => new class extends Writable {
231
- _write(chunk: any, _: BufferEncoding, callback: (error?: Error | null) => void): void {
231
+ override _write(chunk: any, _: BufferEncoding, callback: (error?: Error | null) => void): void {
232
232
  const string: string = chunk.toString()
233
233
  const message = string.endsWith('\n') ? string.slice(0, -1) : string
234
234
  emit.emitter({ level, taskName }, [ message ])
package/src/globals.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * A pseudo-variable replaced by `ESBuild` resolving to either `__filename`
3
3
  * in CJS modules, or to `import.meta.url` in ESM modules.
4
+ *
5
+ * @deprecated As we are moving to ESM-only, this will be removed in the future.
6
+ * Use `import.meta.url` or `import.meta.filename` instead.
4
7
  */
5
8
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
9
  declare const __fileurl: string
package/src/helpers.ts CHANGED
@@ -2,32 +2,32 @@ import { mkdtempSync, readFileSync } from 'node:fs'
2
2
  import { tmpdir } from 'node:os'
3
3
  import { join } from 'node:path'
4
4
 
5
- import { BuildFailure, assert, assertPromises } from './asserts'
6
- import { requireContext } from './async'
7
- import { Files } from './files'
8
- import { rm } from './fs'
9
- import { $gry, $p, $plur, $wht, $ylw, log } from './logging'
5
+ import { BuildFailure, assert, assertPromises } from './asserts.ts'
6
+ import { requireContext } from './async.ts'
7
+ import { Files } from './files.ts'
8
+ import { rm } from './fs.ts'
9
+ import { $gry, $p, $plur, $wht, $ylw, log } from './logging.ts'
10
10
  import {
11
11
  commonPath,
12
12
  getAbsoluteParent,
13
13
  getCurrentWorkingDirectory,
14
14
  resolveDirectory,
15
15
  resolveFile,
16
- } from './paths'
17
- import { PipeImpl } from './pipe'
18
- import { RunBuild } from './plugs/build'
19
- import { JsoncError, parseJsonc } from './utils'
20
- import { execChild } from './utils/exec'
21
- import { parseOptions } from './utils/options'
22
- import { walk } from './utils/walk'
23
-
24
- import type { Pipe } from './index'
25
- import type { AbsolutePath } from './paths'
26
- import type { Context } from './pipe'
27
- import type { RunBuildOptions } from './plugs/build'
28
- import type { ExecChildOptions } from './utils/exec'
29
- import type { ParseOptions } from './utils/options'
30
- import type { WalkOptions } from './utils/walk'
16
+ } from './paths.ts'
17
+ import { PipeImpl } from './pipe.ts'
18
+ import { RunBuild } from './plugs/build.ts'
19
+ import { JsoncError, parseJsonc } from './utils.ts'
20
+ import { execChild } from './utils/exec.ts'
21
+ import { parseOptions } from './utils/options.ts'
22
+ import { walk } from './utils/walk.ts'
23
+
24
+ import type { Pipe } from './index.ts'
25
+ import type { AbsolutePath } from './paths.ts'
26
+ import type { Context } from './pipe.ts'
27
+ import type { RunBuildOptions } from './plugs/build.ts'
28
+ import type { ExecChildOptions } from './utils/exec.ts'
29
+ import type { ParseOptions } from './utils/options.ts'
30
+ import type { WalkOptions } from './utils/walk.ts'
31
31
 
32
32
  /* ========================================================================== *
33
33
  * EXTERNAL HELPERS *
package/src/index.ts CHANGED
@@ -1,12 +1,12 @@
1
- import './globals'
1
+ import './globals.ts'
2
2
 
3
3
  // This is a main constituent of our build system!
4
- import type { Files } from './files'
5
- import type { Plug, PlugFunction } from './pipe'
4
+ import type { Files } from './files.ts'
5
+ import type { Plug, PlugFunction } from './pipe.ts'
6
6
 
7
- export { Files } from './files'
8
- export type { AbsolutePath } from './paths'
9
- export type { Plug, PlugFunction } from './pipe'
7
+ export { Files } from './files.ts'
8
+ export type { AbsolutePath } from './paths.ts'
9
+ export type { Plug, PlugFunction } from './pipe.ts'
10
10
 
11
11
  /**
12
12
  * The {@link Pipe} interface defines a processing pipeline where multiple
@@ -25,22 +25,22 @@ export interface Pipe extends Promise<Files> {
25
25
  }
26
26
 
27
27
  // Submodule exports (our package.json exports)
28
- export * as asserts from './asserts'
29
- export * as async from './async'
30
- export * as files from './files'
31
- export * as fork from './fork'
32
- export * as fs from './fs'
33
- export * as logging from './logging'
34
- export * as paths from './paths'
35
- export * as pipe from './pipe'
36
- export * as utils from './utils'
28
+ export * as asserts from './asserts.ts'
29
+ export * as async from './async.ts'
30
+ export * as files from './files.ts'
31
+ export * as fork from './fork.ts'
32
+ export * as fs from './fs.ts'
33
+ export * as logging from './logging.ts'
34
+ export * as paths from './paths.ts'
35
+ export * as pipe from './pipe.ts'
36
+ export * as utils from './utils.ts'
37
37
 
38
38
  // Individual utilities
39
- export { BuildFailure, assert, fail } from './asserts'
40
- export { $blu, $cyn, $grn, $gry, $mgt, $ms, $p, $red, $t, $und, $wht, $ylw, banner, log } from './logging'
39
+ export { assert, BuildFailure, fail } from './asserts.ts'
40
+ export { $blu, $cyn, $grn, $gry, $mgt, $ms, $p, $red, $t, $und, $wht, $ylw, banner, log } from './logging.ts'
41
41
 
42
42
  // Our minimal exports
43
- export * from './build'
44
- export * from './helpers'
45
- export * from './plugs'
46
- export * from './types'
43
+ export * from './build.ts'
44
+ export * from './helpers.ts'
45
+ export * from './plugs.ts'
46
+ export * from './types.ts'