track-cli 3.0.0-rc

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 (224) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +3 -0
  3. package/esm/_dnt.polyfills.d.ts +6 -0
  4. package/esm/_dnt.polyfills.js +1 -0
  5. package/esm/_dnt.shims.d.ts +19 -0
  6. package/esm/_dnt.shims.js +78 -0
  7. package/esm/deps/deno.land/std@0.170.0/fmt/colors.d.ts +270 -0
  8. package/esm/deps/deno.land/std@0.170.0/fmt/colors.js +473 -0
  9. package/esm/deps/deno.land/std@0.195.0/_util/os.d.ts +4 -0
  10. package/esm/deps/deno.land/std@0.195.0/_util/os.js +18 -0
  11. package/esm/deps/deno.land/std@0.195.0/assert/assert.d.ts +2 -0
  12. package/esm/deps/deno.land/std@0.195.0/assert/assert.js +8 -0
  13. package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.d.ts +4 -0
  14. package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.js +12 -0
  15. package/esm/deps/deno.land/std@0.195.0/datetime/_common.d.ts +50 -0
  16. package/esm/deps/deno.land/std@0.195.0/datetime/_common.js +545 -0
  17. package/esm/deps/deno.land/std@0.195.0/datetime/constants.d.ts +55 -0
  18. package/esm/deps/deno.land/std@0.195.0/datetime/constants.js +57 -0
  19. package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.d.ts +26 -0
  20. package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.js +45 -0
  21. package/esm/deps/deno.land/std@0.195.0/datetime/difference.d.ts +38 -0
  22. package/esm/deps/deno.land/std@0.195.0/datetime/difference.js +93 -0
  23. package/esm/deps/deno.land/std@0.195.0/datetime/format.d.ts +22 -0
  24. package/esm/deps/deno.land/std@0.195.0/datetime/format.js +28 -0
  25. package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.d.ts +49 -0
  26. package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.js +60 -0
  27. package/esm/deps/deno.land/std@0.195.0/datetime/mod.d.ts +43 -0
  28. package/esm/deps/deno.land/std@0.195.0/datetime/mod.js +45 -0
  29. package/esm/deps/deno.land/std@0.195.0/datetime/parse.d.ts +21 -0
  30. package/esm/deps/deno.land/std@0.195.0/datetime/parse.js +29 -0
  31. package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.d.ts +17 -0
  32. package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.js +44 -0
  33. package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.d.ts +13 -0
  34. package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.js +38 -0
  35. package/esm/deps/deno.land/std@0.195.0/fmt/colors.d.ts +270 -0
  36. package/esm/deps/deno.land/std@0.195.0/fmt/colors.js +474 -0
  37. package/esm/deps/deno.land/std@0.195.0/fmt/duration.d.ts +15 -0
  38. package/esm/deps/deno.land/std@0.195.0/fmt/duration.js +96 -0
  39. package/esm/deps/deno.land/std@0.195.0/fs/_util.d.ts +35 -0
  40. package/esm/deps/deno.land/std@0.195.0/fs/_util.js +80 -0
  41. package/esm/deps/deno.land/std@0.195.0/fs/copy.d.ts +51 -0
  42. package/esm/deps/deno.land/std@0.195.0/fs/copy.js +244 -0
  43. package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.d.ts +31 -0
  44. package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.js +74 -0
  45. package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.d.ts +27 -0
  46. package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.js +55 -0
  47. package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.d.ts +33 -0
  48. package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.js +75 -0
  49. package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.d.ts +31 -0
  50. package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.js +43 -0
  51. package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.d.ts +17 -0
  52. package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.js +68 -0
  53. package/esm/deps/deno.land/std@0.195.0/fs/eol.d.ts +40 -0
  54. package/esm/deps/deno.land/std@0.195.0/fs/eol.js +53 -0
  55. package/esm/deps/deno.land/std@0.195.0/fs/exists.d.ts +102 -0
  56. package/esm/deps/deno.land/std@0.195.0/fs/exists.js +163 -0
  57. package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.d.ts +37 -0
  58. package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.js +216 -0
  59. package/esm/deps/deno.land/std@0.195.0/fs/mod.d.ts +16 -0
  60. package/esm/deps/deno.land/std@0.195.0/fs/mod.js +17 -0
  61. package/esm/deps/deno.land/std@0.195.0/fs/move.d.ts +29 -0
  62. package/esm/deps/deno.land/std@0.195.0/fs/move.js +88 -0
  63. package/esm/deps/deno.land/std@0.195.0/fs/walk.d.ts +40 -0
  64. package/esm/deps/deno.land/std@0.195.0/fs/walk.js +158 -0
  65. package/esm/deps/deno.land/std@0.195.0/path/_constants.d.ts +39 -0
  66. package/esm/deps/deno.land/std@0.195.0/path/_constants.js +46 -0
  67. package/esm/deps/deno.land/std@0.195.0/path/_interface.d.ts +26 -0
  68. package/esm/deps/deno.land/std@0.195.0/path/_interface.js +3 -0
  69. package/esm/deps/deno.land/std@0.195.0/path/_util.d.ts +11 -0
  70. package/esm/deps/deno.land/std@0.195.0/path/_util.js +161 -0
  71. package/esm/deps/deno.land/std@0.195.0/path/common.d.ts +13 -0
  72. package/esm/deps/deno.land/std@0.195.0/path/common.js +36 -0
  73. package/esm/deps/deno.land/std@0.195.0/path/glob.d.ts +83 -0
  74. package/esm/deps/deno.land/std@0.195.0/path/glob.js +361 -0
  75. package/esm/deps/deno.land/std@0.195.0/path/mod.d.ts +9 -0
  76. package/esm/deps/deno.land/std@0.195.0/path/mod.js +33 -0
  77. package/esm/deps/deno.land/std@0.195.0/path/posix.d.ts +86 -0
  78. package/esm/deps/deno.land/std@0.195.0/path/posix.js +442 -0
  79. package/esm/deps/deno.land/std@0.195.0/path/separator.d.ts +2 -0
  80. package/esm/deps/deno.land/std@0.195.0/path/separator.js +5 -0
  81. package/esm/deps/deno.land/std@0.195.0/path/win32.d.ts +91 -0
  82. package/esm/deps/deno.land/std@0.195.0/path/win32.js +909 -0
  83. package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.d.ts +1 -0
  84. package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.js +26 -0
  85. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.d.ts +76 -0
  86. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.js +154 -0
  87. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.d.ts +32 -0
  88. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.js +105 -0
  89. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.d.ts +831 -0
  90. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.js +1701 -0
  91. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.d.ts +17 -0
  92. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.js +201 -0
  93. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.d.ts +14 -0
  94. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.js +141 -0
  95. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.d.ts +21 -0
  96. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.js +285 -0
  97. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.d.ts +6 -0
  98. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.js +38 -0
  99. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.d.ts +8 -0
  100. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.js +32 -0
  101. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.d.ts +6 -0
  102. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.js +38 -0
  103. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.d.ts +6 -0
  104. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.js +46 -0
  105. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.d.ts +6 -0
  106. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.js +38 -0
  107. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.d.ts +45 -0
  108. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.js +2 -0
  109. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.d.ts +1 -0
  110. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.js +1 -0
  111. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.d.ts +27 -0
  112. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.js +323 -0
  113. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.d.ts +6 -0
  114. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.js +34 -0
  115. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.d.ts +18 -0
  116. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.js +17 -0
  117. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.d.ts +41 -0
  118. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.js +24 -0
  119. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.d.ts +9 -0
  120. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.js +20 -0
  121. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.d.ts +9 -0
  122. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.js +13 -0
  123. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.d.ts +9 -0
  124. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.js +27 -0
  125. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.d.ts +7 -0
  126. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.js +9 -0
  127. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.d.ts +10 -0
  128. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.js +29 -0
  129. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.d.ts +5 -0
  130. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.js +12 -0
  131. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.d.ts +7 -0
  132. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.js +9 -0
  133. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.d.ts +7 -0
  134. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.js +9 -0
  135. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.d.ts +7 -0
  136. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.js +9 -0
  137. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.d.ts +118 -0
  138. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.js +2 -0
  139. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.d.ts +5 -0
  140. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.js +5 -0
  141. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.d.ts +14 -0
  142. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.js +46 -0
  143. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.d.ts +26 -0
  144. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.js +118 -0
  145. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.d.ts +14 -0
  146. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.js +55 -0
  147. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.d.ts +27 -0
  148. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.js +102 -0
  149. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.d.ts +17 -0
  150. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.js +75 -0
  151. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.d.ts +60 -0
  152. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.js +117 -0
  153. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.d.ts +18 -0
  154. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.js +106 -0
  155. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.d.ts +10 -0
  156. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.js +157 -0
  157. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.d.ts +24 -0
  158. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.js +9 -0
  159. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.d.ts +33 -0
  160. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.js +402 -0
  161. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.d.ts +3 -0
  162. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.js +11 -0
  163. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.d.ts +3 -0
  164. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.js +9 -0
  165. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.d.ts +3 -0
  166. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.js +9 -0
  167. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.d.ts +3 -0
  168. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.js +4 -0
  169. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.d.ts +59 -0
  170. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.js +1 -0
  171. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.d.ts +20 -0
  172. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.js +18 -0
  173. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.d.ts +78 -0
  174. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.js +128 -0
  175. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.d.ts +1 -0
  176. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.js +1 -0
  177. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.d.ts +99 -0
  178. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.js +529 -0
  179. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.d.ts +49 -0
  180. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.js +74 -0
  181. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.d.ts +135 -0
  182. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.js +237 -0
  183. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.d.ts +13 -0
  184. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.js +60 -0
  185. package/esm/package.json +3 -0
  186. package/esm/src/action/add.d.ts +1 -0
  187. package/esm/src/action/add.js +57 -0
  188. package/esm/src/action/clone.d.ts +6 -0
  189. package/esm/src/action/clone.js +108 -0
  190. package/esm/src/action/lang.d.ts +1 -0
  191. package/esm/src/action/lang.js +40 -0
  192. package/esm/src/action/pull.d.ts +1 -0
  193. package/esm/src/action/pull.js +22 -0
  194. package/esm/src/action/remove.d.ts +4 -0
  195. package/esm/src/action/remove.js +67 -0
  196. package/esm/src/action/reset.d.ts +1 -0
  197. package/esm/src/action/reset.js +21 -0
  198. package/esm/src/action/run.d.ts +4 -0
  199. package/esm/src/action/run.js +163 -0
  200. package/esm/src/action/status.d.ts +1 -0
  201. package/esm/src/action/status.js +5 -0
  202. package/esm/src/main.d.ts +2 -0
  203. package/esm/src/main.js +96 -0
  204. package/esm/src/meta.d.ts +3 -0
  205. package/esm/src/meta.js +51 -0
  206. package/esm/src/orca/client.d.ts +20 -0
  207. package/esm/src/orca/client.js +152 -0
  208. package/esm/src/orca/types.d.ts +54 -0
  209. package/esm/src/orca/types.js +12 -0
  210. package/esm/src/shared/config.d.ts +24 -0
  211. package/esm/src/shared/config.js +24 -0
  212. package/esm/src/shared/errors.d.ts +82 -0
  213. package/esm/src/shared/errors.js +228 -0
  214. package/esm/src/shared/file.d.ts +30 -0
  215. package/esm/src/shared/file.js +110 -0
  216. package/esm/src/shared/mod.d.ts +40 -0
  217. package/esm/src/shared/mod.js +383 -0
  218. package/esm/src/shared/types.d.ts +12 -0
  219. package/esm/src/shared/types.js +1 -0
  220. package/esm/src/track/client.d.ts +60 -0
  221. package/esm/src/track/client.js +268 -0
  222. package/esm/src/track/types.d.ts +210 -0
  223. package/esm/src/track/types.js +40 -0
  224. package/package.json +35 -0
@@ -0,0 +1,68 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import * as path from "../path/mod.js";
4
+ import { ensureDir, ensureDirSync } from "./ensure_dir.js";
5
+ import { getFileInfoType, toPathString } from "./_util.js";
6
+ import { isWindows } from "../_util/os.js";
7
+ function resolveSymlinkTarget(target, linkName) {
8
+ if (typeof target != "string")
9
+ return target; // URL is always absolute path
10
+ if (typeof linkName == "string") {
11
+ return path.resolve(path.dirname(linkName), target);
12
+ }
13
+ else {
14
+ return new URL(target, linkName);
15
+ }
16
+ }
17
+ /**
18
+ * Ensures that the link exists, and points to a valid file.
19
+ * If the directory structure does not exist, it is created.
20
+ *
21
+ * @param target the source file path
22
+ * @param linkName the destination link path
23
+ */
24
+ export async function ensureSymlink(target, linkName) {
25
+ const targetRealPath = resolveSymlinkTarget(target, linkName);
26
+ const srcStatInfo = await dntShim.Deno.lstat(targetRealPath);
27
+ const srcFilePathType = getFileInfoType(srcStatInfo);
28
+ await ensureDir(path.dirname(toPathString(linkName)));
29
+ const options = isWindows
30
+ ? {
31
+ type: srcFilePathType === "dir" ? "dir" : "file",
32
+ }
33
+ : undefined;
34
+ try {
35
+ await dntShim.Deno.symlink(target, linkName, options);
36
+ }
37
+ catch (error) {
38
+ if (!(error instanceof dntShim.Deno.errors.AlreadyExists)) {
39
+ throw error;
40
+ }
41
+ }
42
+ }
43
+ /**
44
+ * Ensures that the link exists, and points to a valid file.
45
+ * If the directory structure does not exist, it is created.
46
+ *
47
+ * @param target the source file path
48
+ * @param linkName the destination link path
49
+ */
50
+ export function ensureSymlinkSync(target, linkName) {
51
+ const targetRealPath = resolveSymlinkTarget(target, linkName);
52
+ const srcStatInfo = dntShim.Deno.lstatSync(targetRealPath);
53
+ const srcFilePathType = getFileInfoType(srcStatInfo);
54
+ ensureDirSync(path.dirname(toPathString(linkName)));
55
+ const options = isWindows
56
+ ? {
57
+ type: srcFilePathType === "dir" ? "dir" : "file",
58
+ }
59
+ : undefined;
60
+ try {
61
+ dntShim.Deno.symlinkSync(target, linkName, options);
62
+ }
63
+ catch (error) {
64
+ if (!(error instanceof dntShim.Deno.errors.AlreadyExists)) {
65
+ throw error;
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,40 @@
1
+ /** Platform-specific conventions for the line ending format (i.e., the "end-of-line"). */
2
+ export declare enum EOL {
3
+ /** Line Feed. Typically used in Unix (and Unix-like) systems. */
4
+ LF = "\n",
5
+ /** Carriage Return + Line Feed. Historically used in Windows and early DOS systems. */
6
+ CRLF = "\r\n"
7
+ }
8
+ /**
9
+ * Detect the EOL character for string input.
10
+ * returns null if no newline.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { detect, EOL } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
15
+ *
16
+ * const CRLFinput = "deno\r\nis not\r\nnode";
17
+ * const Mixedinput = "deno\nis not\r\nnode";
18
+ * const LFinput = "deno\nis not\nnode";
19
+ * const NoNLinput = "deno is not node";
20
+ *
21
+ * detect(LFinput); // output EOL.LF
22
+ * detect(CRLFinput); // output EOL.CRLF
23
+ * detect(Mixedinput); // output EOL.CRLF
24
+ * detect(NoNLinput); // output null
25
+ * ```
26
+ */
27
+ export declare function detect(content: string): EOL | null;
28
+ /**
29
+ * Format the file to the targeted EOL.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * import { EOL, format } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
34
+ *
35
+ * const CRLFinput = "deno\r\nis not\r\nnode";
36
+ *
37
+ * format(CRLFinput, EOL.LF); // output "deno\nis not\nnode"
38
+ * ```
39
+ */
40
+ export declare function format(content: string, eol: EOL): string;
@@ -0,0 +1,53 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ /** Platform-specific conventions for the line ending format (i.e., the "end-of-line"). */
4
+ export var EOL;
5
+ (function (EOL) {
6
+ /** Line Feed. Typically used in Unix (and Unix-like) systems. */
7
+ EOL["LF"] = "\n";
8
+ /** Carriage Return + Line Feed. Historically used in Windows and early DOS systems. */
9
+ EOL["CRLF"] = "\r\n";
10
+ })(EOL || (EOL = {}));
11
+ const regDetect = /(?:\r?\n)/g;
12
+ /**
13
+ * Detect the EOL character for string input.
14
+ * returns null if no newline.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { detect, EOL } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
19
+ *
20
+ * const CRLFinput = "deno\r\nis not\r\nnode";
21
+ * const Mixedinput = "deno\nis not\r\nnode";
22
+ * const LFinput = "deno\nis not\nnode";
23
+ * const NoNLinput = "deno is not node";
24
+ *
25
+ * detect(LFinput); // output EOL.LF
26
+ * detect(CRLFinput); // output EOL.CRLF
27
+ * detect(Mixedinput); // output EOL.CRLF
28
+ * detect(NoNLinput); // output null
29
+ * ```
30
+ */
31
+ export function detect(content) {
32
+ const d = content.match(regDetect);
33
+ if (!d || d.length === 0) {
34
+ return null;
35
+ }
36
+ const hasCRLF = d.some((x) => x === EOL.CRLF);
37
+ return hasCRLF ? EOL.CRLF : EOL.LF;
38
+ }
39
+ /**
40
+ * Format the file to the targeted EOL.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import { EOL, format } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
45
+ *
46
+ * const CRLFinput = "deno\r\nis not\r\nnode";
47
+ *
48
+ * format(CRLFinput, EOL.LF); // output "deno\nis not\nnode"
49
+ * ```
50
+ */
51
+ export function format(content, eol) {
52
+ return content.replace(regDetect, eol);
53
+ }
@@ -0,0 +1,102 @@
1
+ /// <reference types="node" />
2
+ export interface ExistsOptions {
3
+ /**
4
+ * When `true`, will check if the path is readable by the user as well.
5
+ * @default {false}
6
+ */
7
+ isReadable?: boolean;
8
+ /**
9
+ * When `true`, will check if the path is a directory as well.
10
+ * Directory symlinks are included.
11
+ * @default {false}
12
+ */
13
+ isDirectory?: boolean;
14
+ /**
15
+ * When `true`, will check if the path is a file as well.
16
+ * File symlinks are included.
17
+ * @default {false}
18
+ */
19
+ isFile?: boolean;
20
+ }
21
+ /**
22
+ * Test whether or not the given path exists by checking with the file system. Please consider to check if the path is readable and either a file or a directory by providing additional `options`:
23
+ *
24
+ * ```ts
25
+ * import { exists } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
26
+ * const isReadableDir = await exists("./foo", {
27
+ * isReadable: true,
28
+ * isDirectory: true
29
+ * });
30
+ * const isReadableFile = await exists("./bar", {
31
+ * isReadable: true,
32
+ * isFile: true
33
+ * });
34
+ * ```
35
+ *
36
+ * Note: Do not use this function if performing a check before another operation on that file. Doing so creates a race condition. Instead, perform the actual file operation directly.
37
+ *
38
+ * Bad:
39
+ * ```ts
40
+ * import { exists } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
41
+ *
42
+ * if (await exists("./foo")) {
43
+ * await Deno.remove("./foo");
44
+ * }
45
+ * ```
46
+ *
47
+ * Good:
48
+ * ```ts
49
+ * // Notice no use of exists
50
+ * try {
51
+ * await Deno.remove("./foo", { recursive: true });
52
+ * } catch (error) {
53
+ * if (!(error instanceof Deno.errors.NotFound)) {
54
+ * throw error;
55
+ * }
56
+ * // Do nothing...
57
+ * }
58
+ * ```
59
+ * @see https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
60
+ */
61
+ export declare function exists(path: string | URL, options?: ExistsOptions): Promise<boolean>;
62
+ /**
63
+ * Test whether or not the given path exists by checking with the file system. Please consider to check if the path is readable and either a file or a directory by providing additional `options`:
64
+ *
65
+ * ```ts
66
+ * import { existsSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
67
+ * const isReadableDir = existsSync("./foo", {
68
+ * isReadable: true,
69
+ * isDirectory: true
70
+ * });
71
+ * const isReadableFile = existsSync("./bar", {
72
+ * isReadable: true,
73
+ * isFile: true
74
+ * });
75
+ * ```
76
+ *
77
+ * Note: do not use this function if performing a check before another operation on that file. Doing so creates a race condition. Instead, perform the actual file operation directly.
78
+ *
79
+ * Bad:
80
+ * ```ts
81
+ * import { existsSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
82
+ *
83
+ * if (existsSync("./foo")) {
84
+ * Deno.removeSync("./foo");
85
+ * }
86
+ * ```
87
+ *
88
+ * Good:
89
+ * ```ts
90
+ * // Notice no use of existsSync
91
+ * try {
92
+ * Deno.removeSync("./foo", { recursive: true });
93
+ * } catch (error) {
94
+ * if (!(error instanceof Deno.errors.NotFound)) {
95
+ * throw error;
96
+ * }
97
+ * // Do nothing...
98
+ * }
99
+ * ```
100
+ * @see https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
101
+ */
102
+ export declare function existsSync(path: string | URL, options?: ExistsOptions): boolean;
@@ -0,0 +1,163 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ /**
4
+ * Test whether or not the given path exists by checking with the file system. Please consider to check if the path is readable and either a file or a directory by providing additional `options`:
5
+ *
6
+ * ```ts
7
+ * import { exists } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
8
+ * const isReadableDir = await exists("./foo", {
9
+ * isReadable: true,
10
+ * isDirectory: true
11
+ * });
12
+ * const isReadableFile = await exists("./bar", {
13
+ * isReadable: true,
14
+ * isFile: true
15
+ * });
16
+ * ```
17
+ *
18
+ * Note: Do not use this function if performing a check before another operation on that file. Doing so creates a race condition. Instead, perform the actual file operation directly.
19
+ *
20
+ * Bad:
21
+ * ```ts
22
+ * import { exists } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
23
+ *
24
+ * if (await exists("./foo")) {
25
+ * await Deno.remove("./foo");
26
+ * }
27
+ * ```
28
+ *
29
+ * Good:
30
+ * ```ts
31
+ * // Notice no use of exists
32
+ * try {
33
+ * await Deno.remove("./foo", { recursive: true });
34
+ * } catch (error) {
35
+ * if (!(error instanceof Deno.errors.NotFound)) {
36
+ * throw error;
37
+ * }
38
+ * // Do nothing...
39
+ * }
40
+ * ```
41
+ * @see https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
42
+ */
43
+ export async function exists(path, options) {
44
+ try {
45
+ const stat = await dntShim.Deno.stat(path);
46
+ if (options &&
47
+ (options.isReadable || options.isDirectory || options.isFile)) {
48
+ if (options.isDirectory && options.isFile) {
49
+ throw new TypeError("ExistsOptions.options.isDirectory and ExistsOptions.options.isFile must not be true together.");
50
+ }
51
+ if ((options.isDirectory && !stat.isDirectory) ||
52
+ (options.isFile && !stat.isFile)) {
53
+ return false;
54
+ }
55
+ if (options.isReadable) {
56
+ if (stat.mode == null) {
57
+ return true; // Exclusive on Non-POSIX systems
58
+ }
59
+ if (dntShim.Deno.uid() == stat.uid) {
60
+ return (stat.mode & 0o400) == 0o400; // User is owner and can read?
61
+ }
62
+ else if (dntShim.Deno.gid() == stat.gid) {
63
+ return (stat.mode & 0o040) == 0o040; // User group is owner and can read?
64
+ }
65
+ return (stat.mode & 0o004) == 0o004; // Others can read?
66
+ }
67
+ }
68
+ return true;
69
+ }
70
+ catch (error) {
71
+ if (error instanceof dntShim.Deno.errors.NotFound) {
72
+ return false;
73
+ }
74
+ if (error instanceof dntShim.Deno.errors.PermissionDenied) {
75
+ if ((await dntShim.Deno.permissions.query({ name: "read", path })).state ===
76
+ "granted") {
77
+ // --allow-read not missing
78
+ return !options?.isReadable; // PermissionDenied was raised by file system, so the item exists, but can't be read
79
+ }
80
+ }
81
+ throw error;
82
+ }
83
+ }
84
+ /**
85
+ * Test whether or not the given path exists by checking with the file system. Please consider to check if the path is readable and either a file or a directory by providing additional `options`:
86
+ *
87
+ * ```ts
88
+ * import { existsSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
89
+ * const isReadableDir = existsSync("./foo", {
90
+ * isReadable: true,
91
+ * isDirectory: true
92
+ * });
93
+ * const isReadableFile = existsSync("./bar", {
94
+ * isReadable: true,
95
+ * isFile: true
96
+ * });
97
+ * ```
98
+ *
99
+ * Note: do not use this function if performing a check before another operation on that file. Doing so creates a race condition. Instead, perform the actual file operation directly.
100
+ *
101
+ * Bad:
102
+ * ```ts
103
+ * import { existsSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
104
+ *
105
+ * if (existsSync("./foo")) {
106
+ * Deno.removeSync("./foo");
107
+ * }
108
+ * ```
109
+ *
110
+ * Good:
111
+ * ```ts
112
+ * // Notice no use of existsSync
113
+ * try {
114
+ * Deno.removeSync("./foo", { recursive: true });
115
+ * } catch (error) {
116
+ * if (!(error instanceof Deno.errors.NotFound)) {
117
+ * throw error;
118
+ * }
119
+ * // Do nothing...
120
+ * }
121
+ * ```
122
+ * @see https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
123
+ */
124
+ export function existsSync(path, options) {
125
+ try {
126
+ const stat = dntShim.Deno.statSync(path);
127
+ if (options &&
128
+ (options.isReadable || options.isDirectory || options.isFile)) {
129
+ if (options.isDirectory && options.isFile) {
130
+ throw new TypeError("ExistsOptions.options.isDirectory and ExistsOptions.options.isFile must not be true together.");
131
+ }
132
+ if ((options.isDirectory && !stat.isDirectory) ||
133
+ (options.isFile && !stat.isFile)) {
134
+ return false;
135
+ }
136
+ if (options.isReadable) {
137
+ if (stat.mode == null) {
138
+ return true; // Exclusive on Non-POSIX systems
139
+ }
140
+ if (dntShim.Deno.uid() == stat.uid) {
141
+ return (stat.mode & 0o400) == 0o400; // User is owner and can read?
142
+ }
143
+ else if (dntShim.Deno.gid() == stat.gid) {
144
+ return (stat.mode & 0o040) == 0o040; // User group is owner and can read?
145
+ }
146
+ return (stat.mode & 0o004) == 0o004; // Others can read?
147
+ }
148
+ }
149
+ return true;
150
+ }
151
+ catch (error) {
152
+ if (error instanceof dntShim.Deno.errors.NotFound) {
153
+ return false;
154
+ }
155
+ if (error instanceof dntShim.Deno.errors.PermissionDenied) {
156
+ if (dntShim.Deno.permissions.querySync({ name: "read", path }).state === "granted") {
157
+ // --allow-read not missing
158
+ return !options?.isReadable; // PermissionDenied was raised by file system, so the item exists, but can't be read
159
+ }
160
+ }
161
+ throw error;
162
+ }
163
+ }
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ import { GlobOptions } from "../path/mod.js";
3
+ import { WalkEntry } from "./_util.js";
4
+ export interface ExpandGlobOptions extends Omit<GlobOptions, "os"> {
5
+ root?: string;
6
+ exclude?: string[];
7
+ includeDirs?: boolean;
8
+ followSymlinks?: boolean;
9
+ }
10
+ /**
11
+ * Expand the glob string from the specified `root` directory and yield each
12
+ * result as a `WalkEntry` object.
13
+ *
14
+ * See [`globToRegExp()`](../path/glob.ts#globToRegExp) for details on supported
15
+ * syntax.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { expandGlob } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
20
+ * for await (const file of expandGlob("**\/*.ts")) {
21
+ * console.log(file);
22
+ * }
23
+ * ```
24
+ */
25
+ export declare function expandGlob(glob: string | URL, { root, exclude, includeDirs, extended, globstar, caseInsensitive, followSymlinks, }?: ExpandGlobOptions): AsyncIterableIterator<WalkEntry>;
26
+ /**
27
+ * Synchronous version of `expandGlob()`.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { expandGlobSync } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
32
+ * for (const file of expandGlobSync("**\/*.ts")) {
33
+ * console.log(file);
34
+ * }
35
+ * ```
36
+ */
37
+ export declare function expandGlobSync(glob: string | URL, { root, exclude, includeDirs, extended, globstar, caseInsensitive, followSymlinks, }?: ExpandGlobOptions): IterableIterator<WalkEntry>;
@@ -0,0 +1,216 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import { globToRegExp, isAbsolute, isGlob, joinGlobs, resolve, SEP_PATTERN, } from "../path/mod.js";
4
+ import { walk, walkSync } from "./walk.js";
5
+ import { assert } from "../assert/assert.js";
6
+ import { isWindows } from "../_util/os.js";
7
+ import { createWalkEntry, createWalkEntrySync, toPathString, } from "./_util.js";
8
+ function split(path) {
9
+ const s = SEP_PATTERN.source;
10
+ const segments = path
11
+ .replace(new RegExp(`^${s}|${s}$`, "g"), "")
12
+ .split(SEP_PATTERN);
13
+ const isAbsolute_ = isAbsolute(path);
14
+ return {
15
+ segments,
16
+ isAbsolute: isAbsolute_,
17
+ hasTrailingSep: !!path.match(new RegExp(`${s}$`)),
18
+ winRoot: isWindows && isAbsolute_ ? segments.shift() : undefined,
19
+ };
20
+ }
21
+ function throwUnlessNotFound(error) {
22
+ if (!(error instanceof dntShim.Deno.errors.NotFound)) {
23
+ throw error;
24
+ }
25
+ }
26
+ function comparePath(a, b) {
27
+ if (a.path < b.path)
28
+ return -1;
29
+ if (a.path > b.path)
30
+ return 1;
31
+ return 0;
32
+ }
33
+ /**
34
+ * Expand the glob string from the specified `root` directory and yield each
35
+ * result as a `WalkEntry` object.
36
+ *
37
+ * See [`globToRegExp()`](../path/glob.ts#globToRegExp) for details on supported
38
+ * syntax.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { expandGlob } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
43
+ * for await (const file of expandGlob("**\/*.ts")) {
44
+ * console.log(file);
45
+ * }
46
+ * ```
47
+ */
48
+ export async function* expandGlob(glob, { root = dntShim.Deno.cwd(), exclude = [], includeDirs = true, extended = true, globstar = true, caseInsensitive, followSymlinks, } = {}) {
49
+ const globOptions = { extended, globstar, caseInsensitive };
50
+ const absRoot = resolve(root);
51
+ const resolveFromRoot = (path) => resolve(absRoot, path);
52
+ const excludePatterns = exclude
53
+ .map(resolveFromRoot)
54
+ .map((s) => globToRegExp(s, globOptions));
55
+ const shouldInclude = (path) => !excludePatterns.some((p) => !!path.match(p));
56
+ const { segments, isAbsolute: isGlobAbsolute, hasTrailingSep, winRoot, } = split(toPathString(glob));
57
+ let fixedRoot = isGlobAbsolute
58
+ ? winRoot != undefined ? winRoot : "/"
59
+ : absRoot;
60
+ while (segments.length > 0 && !isGlob(segments[0])) {
61
+ const seg = segments.shift();
62
+ assert(seg != null);
63
+ fixedRoot = joinGlobs([fixedRoot, seg], globOptions);
64
+ }
65
+ let fixedRootInfo;
66
+ try {
67
+ fixedRootInfo = await createWalkEntry(fixedRoot);
68
+ }
69
+ catch (error) {
70
+ return throwUnlessNotFound(error);
71
+ }
72
+ async function* advanceMatch(walkInfo, globSegment) {
73
+ if (!walkInfo.isDirectory) {
74
+ return;
75
+ }
76
+ else if (globSegment == "..") {
77
+ const parentPath = joinGlobs([walkInfo.path, ".."], globOptions);
78
+ try {
79
+ if (shouldInclude(parentPath)) {
80
+ return yield await createWalkEntry(parentPath);
81
+ }
82
+ }
83
+ catch (error) {
84
+ throwUnlessNotFound(error);
85
+ }
86
+ return;
87
+ }
88
+ else if (globSegment == "**") {
89
+ return yield* walk(walkInfo.path, {
90
+ skip: excludePatterns,
91
+ maxDepth: globstar ? Infinity : 1,
92
+ followSymlinks,
93
+ });
94
+ }
95
+ const globPattern = globToRegExp(globSegment, globOptions);
96
+ for await (const walkEntry of walk(walkInfo.path, {
97
+ maxDepth: 1,
98
+ skip: excludePatterns,
99
+ followSymlinks,
100
+ })) {
101
+ if (walkEntry.path != walkInfo.path &&
102
+ walkEntry.name.match(globPattern)) {
103
+ yield walkEntry;
104
+ }
105
+ }
106
+ }
107
+ let currentMatches = [fixedRootInfo];
108
+ for (const segment of segments) {
109
+ // Advancing the list of current matches may introduce duplicates, so we
110
+ // pass everything through this Map.
111
+ const nextMatchMap = new Map();
112
+ await Promise.all(currentMatches.map(async (currentMatch) => {
113
+ for await (const nextMatch of advanceMatch(currentMatch, segment)) {
114
+ nextMatchMap.set(nextMatch.path, nextMatch);
115
+ }
116
+ }));
117
+ currentMatches = [...nextMatchMap.values()].sort(comparePath);
118
+ }
119
+ if (hasTrailingSep) {
120
+ currentMatches = currentMatches.filter((entry) => entry.isDirectory);
121
+ }
122
+ if (!includeDirs) {
123
+ currentMatches = currentMatches.filter((entry) => !entry.isDirectory);
124
+ }
125
+ yield* currentMatches;
126
+ }
127
+ /**
128
+ * Synchronous version of `expandGlob()`.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * import { expandGlobSync } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
133
+ * for (const file of expandGlobSync("**\/*.ts")) {
134
+ * console.log(file);
135
+ * }
136
+ * ```
137
+ */
138
+ export function* expandGlobSync(glob, { root = dntShim.Deno.cwd(), exclude = [], includeDirs = true, extended = true, globstar = true, caseInsensitive, followSymlinks, } = {}) {
139
+ const globOptions = { extended, globstar, caseInsensitive };
140
+ const absRoot = resolve(root);
141
+ const resolveFromRoot = (path) => resolve(absRoot, path);
142
+ const excludePatterns = exclude
143
+ .map(resolveFromRoot)
144
+ .map((s) => globToRegExp(s, globOptions));
145
+ const shouldInclude = (path) => !excludePatterns.some((p) => !!path.match(p));
146
+ const { segments, isAbsolute: isGlobAbsolute, hasTrailingSep, winRoot, } = split(toPathString(glob));
147
+ let fixedRoot = isGlobAbsolute
148
+ ? winRoot != undefined ? winRoot : "/"
149
+ : absRoot;
150
+ while (segments.length > 0 && !isGlob(segments[0])) {
151
+ const seg = segments.shift();
152
+ assert(seg != null);
153
+ fixedRoot = joinGlobs([fixedRoot, seg], globOptions);
154
+ }
155
+ let fixedRootInfo;
156
+ try {
157
+ fixedRootInfo = createWalkEntrySync(fixedRoot);
158
+ }
159
+ catch (error) {
160
+ return throwUnlessNotFound(error);
161
+ }
162
+ function* advanceMatch(walkInfo, globSegment) {
163
+ if (!walkInfo.isDirectory) {
164
+ return;
165
+ }
166
+ else if (globSegment == "..") {
167
+ const parentPath = joinGlobs([walkInfo.path, ".."], globOptions);
168
+ try {
169
+ if (shouldInclude(parentPath)) {
170
+ return yield createWalkEntrySync(parentPath);
171
+ }
172
+ }
173
+ catch (error) {
174
+ throwUnlessNotFound(error);
175
+ }
176
+ return;
177
+ }
178
+ else if (globSegment == "**") {
179
+ return yield* walkSync(walkInfo.path, {
180
+ skip: excludePatterns,
181
+ maxDepth: globstar ? Infinity : 1,
182
+ followSymlinks,
183
+ });
184
+ }
185
+ const globPattern = globToRegExp(globSegment, globOptions);
186
+ for (const walkEntry of walkSync(walkInfo.path, {
187
+ maxDepth: 1,
188
+ skip: excludePatterns,
189
+ followSymlinks,
190
+ })) {
191
+ if (walkEntry.path != walkInfo.path &&
192
+ walkEntry.name.match(globPattern)) {
193
+ yield walkEntry;
194
+ }
195
+ }
196
+ }
197
+ let currentMatches = [fixedRootInfo];
198
+ for (const segment of segments) {
199
+ // Advancing the list of current matches may introduce duplicates, so we
200
+ // pass everything through this Map.
201
+ const nextMatchMap = new Map();
202
+ for (const currentMatch of currentMatches) {
203
+ for (const nextMatch of advanceMatch(currentMatch, segment)) {
204
+ nextMatchMap.set(nextMatch.path, nextMatch);
205
+ }
206
+ }
207
+ currentMatches = [...nextMatchMap.values()].sort(comparePath);
208
+ }
209
+ if (hasTrailingSep) {
210
+ currentMatches = currentMatches.filter((entry) => entry.isDirectory);
211
+ }
212
+ if (!includeDirs) {
213
+ currentMatches = currentMatches.filter((entry) => !entry.isDirectory);
214
+ }
215
+ yield* currentMatches;
216
+ }