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,36 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { SEP } from "./separator.js";
4
+ /** Determines the common path from a set of paths, using an optional separator,
5
+ * which defaults to the OS default separator.
6
+ *
7
+ * ```ts
8
+ * import { common } from "https://deno.land/std@$STD_VERSION/path/mod.ts";
9
+ * const p = common([
10
+ * "./deno/std/path/mod.ts",
11
+ * "./deno/std/fs/mod.ts",
12
+ * ]);
13
+ * console.log(p); // "./deno/std/"
14
+ * ```
15
+ */
16
+ export function common(paths, sep = SEP) {
17
+ const [first = "", ...remaining] = paths;
18
+ if (first === "" || remaining.length === 0) {
19
+ return first.substring(0, first.lastIndexOf(sep) + 1);
20
+ }
21
+ const parts = first.split(sep);
22
+ let endOfPrefix = parts.length;
23
+ for (const path of remaining) {
24
+ const compare = path.split(sep);
25
+ for (let i = 0; i < endOfPrefix; i++) {
26
+ if (compare[i] !== parts[i]) {
27
+ endOfPrefix = i;
28
+ }
29
+ }
30
+ if (endOfPrefix === 0) {
31
+ return "";
32
+ }
33
+ }
34
+ const prefix = parts.slice(0, endOfPrefix).join(sep);
35
+ return prefix.endsWith(sep) ? prefix : `${prefix}${sep}`;
36
+ }
@@ -0,0 +1,83 @@
1
+ import type { OSType } from "../_util/os.js";
2
+ export interface GlobOptions {
3
+ /** Extended glob syntax.
4
+ * See https://www.linuxjournal.com/content/bash-extended-globbing.
5
+ *
6
+ * @default {true}
7
+ */
8
+ extended?: boolean;
9
+ /** Globstar syntax.
10
+ * See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
11
+ * If false, `**` is treated like `*`.
12
+ *
13
+ * @default {true}
14
+ */
15
+ globstar?: boolean;
16
+ /** Whether globstar should be case-insensitive. */
17
+ caseInsensitive?: boolean;
18
+ /** Operating system. Defaults to the native OS. */
19
+ os?: OSType;
20
+ }
21
+ export type GlobToRegExpOptions = GlobOptions;
22
+ /** Convert a glob string to a regular expression.
23
+ *
24
+ * Tries to match bash glob expansion as closely as possible.
25
+ *
26
+ * Basic glob syntax:
27
+ * - `*` - Matches everything without leaving the path segment.
28
+ * - `?` - Matches any single character.
29
+ * - `{foo,bar}` - Matches `foo` or `bar`.
30
+ * - `[abcd]` - Matches `a`, `b`, `c` or `d`.
31
+ * - `[a-d]` - Matches `a`, `b`, `c` or `d`.
32
+ * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`.
33
+ * - `[[:<class>:]]` - Matches any character belonging to `<class>`.
34
+ * - `[[:alnum:]]` - Matches any digit or letter.
35
+ * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`.
36
+ * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes
37
+ * for a complete list of supported character classes.
38
+ * - `\` - Escapes the next character for an `os` other than `"windows"`.
39
+ * - \` - Escapes the next character for `os` set to `"windows"`.
40
+ * - `/` - Path separator.
41
+ * - `\` - Additional path separator only for `os` set to `"windows"`.
42
+ *
43
+ * Extended syntax:
44
+ * - Requires `{ extended: true }`.
45
+ * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`.
46
+ * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same.
47
+ * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`.
48
+ * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`.
49
+ * - `!(foo|bar)` - Matches anything other than `{foo,bar}`.
50
+ * - See https://www.linuxjournal.com/content/bash-extended-globbing.
51
+ *
52
+ * Globstar syntax:
53
+ * - Requires `{ globstar: true }`.
54
+ * - `**` - Matches any number of any path segments.
55
+ * - Must comprise its entire path segment in the provided glob.
56
+ * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
57
+ *
58
+ * Note the following properties:
59
+ * - The generated `RegExp` is anchored at both start and end.
60
+ * - Repeating and trailing separators are tolerated. Trailing separators in the
61
+ * provided glob have no meaning and are discarded.
62
+ * - Absolute globs will only match absolute paths, etc.
63
+ * - Empty globs will match nothing.
64
+ * - Any special glob syntax must be contained to one path segment. For example,
65
+ * `?(foo|bar/baz)` is invalid. The separator will take precedence and the
66
+ * first segment ends with an unclosed group.
67
+ * - If a path segment ends with unclosed groups or a dangling escape prefix, a
68
+ * parse error has occurred. Every character for that segment is taken
69
+ * literally in this event.
70
+ *
71
+ * Limitations:
72
+ * - A negative group like `!(foo|bar)` will wrongly be converted to a negative
73
+ * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly
74
+ * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively,
75
+ * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if
76
+ * the group occurs not nested at the end of the segment. */
77
+ export declare function globToRegExp(glob: string, { extended, globstar: globstarOption, os, caseInsensitive, }?: GlobToRegExpOptions): RegExp;
78
+ /** Test whether the given string is a glob */
79
+ export declare function isGlob(str: string): boolean;
80
+ /** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */
81
+ export declare function normalizeGlob(glob: string, { globstar }?: GlobOptions): string;
82
+ /** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */
83
+ export declare function joinGlobs(globs: string[], { extended, globstar }?: GlobOptions): string;
@@ -0,0 +1,361 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { isWindows, osType } from "../_util/os.js";
4
+ import { SEP, SEP_PATTERN } from "./separator.js";
5
+ import * as _win32 from "./win32.js";
6
+ import * as _posix from "./posix.js";
7
+ const path = isWindows ? _win32 : _posix;
8
+ const { join, normalize } = path;
9
+ const regExpEscapeChars = [
10
+ "!",
11
+ "$",
12
+ "(",
13
+ ")",
14
+ "*",
15
+ "+",
16
+ ".",
17
+ "=",
18
+ "?",
19
+ "[",
20
+ "\\",
21
+ "^",
22
+ "{",
23
+ "|",
24
+ ];
25
+ const rangeEscapeChars = ["-", "\\", "]"];
26
+ /** Convert a glob string to a regular expression.
27
+ *
28
+ * Tries to match bash glob expansion as closely as possible.
29
+ *
30
+ * Basic glob syntax:
31
+ * - `*` - Matches everything without leaving the path segment.
32
+ * - `?` - Matches any single character.
33
+ * - `{foo,bar}` - Matches `foo` or `bar`.
34
+ * - `[abcd]` - Matches `a`, `b`, `c` or `d`.
35
+ * - `[a-d]` - Matches `a`, `b`, `c` or `d`.
36
+ * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`.
37
+ * - `[[:<class>:]]` - Matches any character belonging to `<class>`.
38
+ * - `[[:alnum:]]` - Matches any digit or letter.
39
+ * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`.
40
+ * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes
41
+ * for a complete list of supported character classes.
42
+ * - `\` - Escapes the next character for an `os` other than `"windows"`.
43
+ * - \` - Escapes the next character for `os` set to `"windows"`.
44
+ * - `/` - Path separator.
45
+ * - `\` - Additional path separator only for `os` set to `"windows"`.
46
+ *
47
+ * Extended syntax:
48
+ * - Requires `{ extended: true }`.
49
+ * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`.
50
+ * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same.
51
+ * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`.
52
+ * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`.
53
+ * - `!(foo|bar)` - Matches anything other than `{foo,bar}`.
54
+ * - See https://www.linuxjournal.com/content/bash-extended-globbing.
55
+ *
56
+ * Globstar syntax:
57
+ * - Requires `{ globstar: true }`.
58
+ * - `**` - Matches any number of any path segments.
59
+ * - Must comprise its entire path segment in the provided glob.
60
+ * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
61
+ *
62
+ * Note the following properties:
63
+ * - The generated `RegExp` is anchored at both start and end.
64
+ * - Repeating and trailing separators are tolerated. Trailing separators in the
65
+ * provided glob have no meaning and are discarded.
66
+ * - Absolute globs will only match absolute paths, etc.
67
+ * - Empty globs will match nothing.
68
+ * - Any special glob syntax must be contained to one path segment. For example,
69
+ * `?(foo|bar/baz)` is invalid. The separator will take precedence and the
70
+ * first segment ends with an unclosed group.
71
+ * - If a path segment ends with unclosed groups or a dangling escape prefix, a
72
+ * parse error has occurred. Every character for that segment is taken
73
+ * literally in this event.
74
+ *
75
+ * Limitations:
76
+ * - A negative group like `!(foo|bar)` will wrongly be converted to a negative
77
+ * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly
78
+ * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively,
79
+ * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if
80
+ * the group occurs not nested at the end of the segment. */
81
+ export function globToRegExp(glob, { extended = true, globstar: globstarOption = true, os = osType, caseInsensitive = false, } = {}) {
82
+ if (glob == "") {
83
+ return /(?!)/;
84
+ }
85
+ const sep = os == "windows" ? "(?:\\\\|/)+" : "/+";
86
+ const sepMaybe = os == "windows" ? "(?:\\\\|/)*" : "/*";
87
+ const seps = os == "windows" ? ["\\", "/"] : ["/"];
88
+ const globstar = os == "windows"
89
+ ? "(?:[^\\\\/]*(?:\\\\|/|$)+)*"
90
+ : "(?:[^/]*(?:/|$)+)*";
91
+ const wildcard = os == "windows" ? "[^\\\\/]*" : "[^/]*";
92
+ const escapePrefix = os == "windows" ? "`" : "\\";
93
+ // Remove trailing separators.
94
+ let newLength = glob.length;
95
+ for (; newLength > 1 && seps.includes(glob[newLength - 1]); newLength--)
96
+ ;
97
+ glob = glob.slice(0, newLength);
98
+ let regExpString = "";
99
+ // Terminates correctly. Trust that `j` is incremented every iteration.
100
+ for (let j = 0; j < glob.length;) {
101
+ let segment = "";
102
+ const groupStack = [];
103
+ let inRange = false;
104
+ let inEscape = false;
105
+ let endsWithSep = false;
106
+ let i = j;
107
+ // Terminates with `i` at the non-inclusive end of the current segment.
108
+ for (; i < glob.length && !seps.includes(glob[i]); i++) {
109
+ if (inEscape) {
110
+ inEscape = false;
111
+ const escapeChars = inRange ? rangeEscapeChars : regExpEscapeChars;
112
+ segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
113
+ continue;
114
+ }
115
+ if (glob[i] == escapePrefix) {
116
+ inEscape = true;
117
+ continue;
118
+ }
119
+ if (glob[i] == "[") {
120
+ if (!inRange) {
121
+ inRange = true;
122
+ segment += "[";
123
+ if (glob[i + 1] == "!") {
124
+ i++;
125
+ segment += "^";
126
+ }
127
+ else if (glob[i + 1] == "^") {
128
+ i++;
129
+ segment += "\\^";
130
+ }
131
+ continue;
132
+ }
133
+ else if (glob[i + 1] == ":") {
134
+ let k = i + 1;
135
+ let value = "";
136
+ while (glob[k + 1] != null && glob[k + 1] != ":") {
137
+ value += glob[k + 1];
138
+ k++;
139
+ }
140
+ if (glob[k + 1] == ":" && glob[k + 2] == "]") {
141
+ i = k + 2;
142
+ if (value == "alnum")
143
+ segment += "\\dA-Za-z";
144
+ else if (value == "alpha")
145
+ segment += "A-Za-z";
146
+ else if (value == "ascii")
147
+ segment += "\x00-\x7F";
148
+ else if (value == "blank")
149
+ segment += "\t ";
150
+ else if (value == "cntrl")
151
+ segment += "\x00-\x1F\x7F";
152
+ else if (value == "digit")
153
+ segment += "\\d";
154
+ else if (value == "graph")
155
+ segment += "\x21-\x7E";
156
+ else if (value == "lower")
157
+ segment += "a-z";
158
+ else if (value == "print")
159
+ segment += "\x20-\x7E";
160
+ else if (value == "punct") {
161
+ segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~";
162
+ }
163
+ else if (value == "space")
164
+ segment += "\\s\v";
165
+ else if (value == "upper")
166
+ segment += "A-Z";
167
+ else if (value == "word")
168
+ segment += "\\w";
169
+ else if (value == "xdigit")
170
+ segment += "\\dA-Fa-f";
171
+ continue;
172
+ }
173
+ }
174
+ }
175
+ if (glob[i] == "]" && inRange) {
176
+ inRange = false;
177
+ segment += "]";
178
+ continue;
179
+ }
180
+ if (inRange) {
181
+ if (glob[i] == "\\") {
182
+ segment += `\\\\`;
183
+ }
184
+ else {
185
+ segment += glob[i];
186
+ }
187
+ continue;
188
+ }
189
+ if (glob[i] == ")" && groupStack.length > 0 &&
190
+ groupStack[groupStack.length - 1] != "BRACE") {
191
+ segment += ")";
192
+ const type = groupStack.pop();
193
+ if (type == "!") {
194
+ segment += wildcard;
195
+ }
196
+ else if (type != "@") {
197
+ segment += type;
198
+ }
199
+ continue;
200
+ }
201
+ if (glob[i] == "|" && groupStack.length > 0 &&
202
+ groupStack[groupStack.length - 1] != "BRACE") {
203
+ segment += "|";
204
+ continue;
205
+ }
206
+ if (glob[i] == "+" && extended && glob[i + 1] == "(") {
207
+ i++;
208
+ groupStack.push("+");
209
+ segment += "(?:";
210
+ continue;
211
+ }
212
+ if (glob[i] == "@" && extended && glob[i + 1] == "(") {
213
+ i++;
214
+ groupStack.push("@");
215
+ segment += "(?:";
216
+ continue;
217
+ }
218
+ if (glob[i] == "?") {
219
+ if (extended && glob[i + 1] == "(") {
220
+ i++;
221
+ groupStack.push("?");
222
+ segment += "(?:";
223
+ }
224
+ else {
225
+ segment += ".";
226
+ }
227
+ continue;
228
+ }
229
+ if (glob[i] == "!" && extended && glob[i + 1] == "(") {
230
+ i++;
231
+ groupStack.push("!");
232
+ segment += "(?!";
233
+ continue;
234
+ }
235
+ if (glob[i] == "{") {
236
+ groupStack.push("BRACE");
237
+ segment += "(?:";
238
+ continue;
239
+ }
240
+ if (glob[i] == "}" && groupStack[groupStack.length - 1] == "BRACE") {
241
+ groupStack.pop();
242
+ segment += ")";
243
+ continue;
244
+ }
245
+ if (glob[i] == "," && groupStack[groupStack.length - 1] == "BRACE") {
246
+ segment += "|";
247
+ continue;
248
+ }
249
+ if (glob[i] == "*") {
250
+ if (extended && glob[i + 1] == "(") {
251
+ i++;
252
+ groupStack.push("*");
253
+ segment += "(?:";
254
+ }
255
+ else {
256
+ const prevChar = glob[i - 1];
257
+ let numStars = 1;
258
+ while (glob[i + 1] == "*") {
259
+ i++;
260
+ numStars++;
261
+ }
262
+ const nextChar = glob[i + 1];
263
+ if (globstarOption && numStars == 2 &&
264
+ [...seps, undefined].includes(prevChar) &&
265
+ [...seps, undefined].includes(nextChar)) {
266
+ segment += globstar;
267
+ endsWithSep = true;
268
+ }
269
+ else {
270
+ segment += wildcard;
271
+ }
272
+ }
273
+ continue;
274
+ }
275
+ segment += regExpEscapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
276
+ }
277
+ // Check for unclosed groups or a dangling backslash.
278
+ if (groupStack.length > 0 || inRange || inEscape) {
279
+ // Parse failure. Take all characters from this segment literally.
280
+ segment = "";
281
+ for (const c of glob.slice(j, i)) {
282
+ segment += regExpEscapeChars.includes(c) ? `\\${c}` : c;
283
+ endsWithSep = false;
284
+ }
285
+ }
286
+ regExpString += segment;
287
+ if (!endsWithSep) {
288
+ regExpString += i < glob.length ? sep : sepMaybe;
289
+ endsWithSep = true;
290
+ }
291
+ // Terminates with `i` at the start of the next segment.
292
+ while (seps.includes(glob[i]))
293
+ i++;
294
+ // Check that the next value of `j` is indeed higher than the current value.
295
+ if (!(i > j)) {
296
+ throw new Error("Assertion failure: i > j (potential infinite loop)");
297
+ }
298
+ j = i;
299
+ }
300
+ regExpString = `^${regExpString}$`;
301
+ return new RegExp(regExpString, caseInsensitive ? "i" : "");
302
+ }
303
+ /** Test whether the given string is a glob */
304
+ export function isGlob(str) {
305
+ const chars = { "{": "}", "(": ")", "[": "]" };
306
+ const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
307
+ if (str === "") {
308
+ return false;
309
+ }
310
+ let match;
311
+ while ((match = regex.exec(str))) {
312
+ if (match[2])
313
+ return true;
314
+ let idx = match.index + match[0].length;
315
+ // if an open bracket/brace/paren is escaped,
316
+ // set the index to the next closing character
317
+ const open = match[1];
318
+ const close = open ? chars[open] : null;
319
+ if (open && close) {
320
+ const n = str.indexOf(close, idx);
321
+ if (n !== -1) {
322
+ idx = n + 1;
323
+ }
324
+ }
325
+ str = str.slice(idx);
326
+ }
327
+ return false;
328
+ }
329
+ /** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */
330
+ export function normalizeGlob(glob, { globstar = false } = {}) {
331
+ if (glob.match(/\0/g)) {
332
+ throw new Error(`Glob contains invalid characters: "${glob}"`);
333
+ }
334
+ if (!globstar) {
335
+ return normalize(glob);
336
+ }
337
+ const s = SEP_PATTERN.source;
338
+ const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
339
+ return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
340
+ }
341
+ /** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */
342
+ export function joinGlobs(globs, { extended = true, globstar = false } = {}) {
343
+ if (!globstar || globs.length == 0) {
344
+ return join(...globs);
345
+ }
346
+ if (globs.length === 0)
347
+ return ".";
348
+ let joined;
349
+ for (const glob of globs) {
350
+ const path = glob;
351
+ if (path.length > 0) {
352
+ if (!joined)
353
+ joined = path;
354
+ else
355
+ joined += `${SEP}${path}`;
356
+ }
357
+ }
358
+ if (!joined)
359
+ return ".";
360
+ return normalizeGlob(joined, { extended, globstar });
361
+ }
@@ -0,0 +1,9 @@
1
+ import * as _win32 from "./win32.js";
2
+ import * as _posix from "./posix.js";
3
+ export declare const win32: typeof _win32;
4
+ export declare const posix: typeof _posix;
5
+ export declare const basename: typeof _posix.basename | typeof _win32.basename, delimiter: string, dirname: typeof _posix.dirname | typeof _win32.dirname, extname: typeof _posix.extname | typeof _win32.extname, format: typeof _posix.format | typeof _win32.format, fromFileUrl: typeof _posix.fromFileUrl | typeof _win32.fromFileUrl, isAbsolute: typeof _win32.isAbsolute | typeof _posix.isAbsolute, join: typeof _posix.join | typeof _win32.join, normalize: typeof _win32.normalize | typeof _posix.normalize, parse: typeof _posix.parse | typeof _win32.parse, relative: typeof _posix.relative | typeof _win32.relative, resolve: typeof _win32.resolve | typeof _posix.resolve, toFileUrl: typeof _posix.toFileUrl | typeof _win32.toFileUrl, toNamespacedPath: typeof _posix.toNamespacedPath | typeof _win32.toNamespacedPath;
6
+ export * from "./common.js";
7
+ export { SEP, SEP_PATTERN } from "./separator.js";
8
+ export * from "./_interface.js";
9
+ export * from "./glob.js";
@@ -0,0 +1,33 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // Copyright the Browserify authors. MIT License.
3
+ // Ported mostly from https://github.com/browserify/path-browserify/
4
+ // This module is browser compatible.
5
+ /**
6
+ * Utilities for working with OS-specific file paths.
7
+ *
8
+ * Codes in the examples uses POSIX path but it automatically use Windows path
9
+ * on Windows. Use methods under `posix` or `win32` object instead to handle non
10
+ * platform specific path like:
11
+ * ```ts
12
+ * import { posix, win32 } from "https://deno.land/std@$STD_VERSION/path/mod.ts";
13
+ * const p1 = posix.fromFileUrl("file:///home/foo");
14
+ * const p2 = win32.fromFileUrl("file:///home/foo");
15
+ * console.log(p1); // "/home/foo"
16
+ * console.log(p2); // "\\home\\foo"
17
+ * ```
18
+ *
19
+ * This module is browser compatible.
20
+ *
21
+ * @module
22
+ */
23
+ import { isWindows } from "../_util/os.js";
24
+ import * as _win32 from "./win32.js";
25
+ import * as _posix from "./posix.js";
26
+ const path = isWindows ? _win32 : _posix;
27
+ export const win32 = _win32;
28
+ export const posix = _posix;
29
+ export const { basename, delimiter, dirname, extname, format, fromFileUrl, isAbsolute, join, normalize, parse, relative, resolve, toFileUrl, toNamespacedPath, } = path;
30
+ export * from "./common.js";
31
+ export { SEP, SEP_PATTERN } from "./separator.js";
32
+ export * from "./_interface.js";
33
+ export * from "./glob.js";
@@ -0,0 +1,86 @@
1
+ /// <reference types="node" />
2
+ import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
3
+ export declare const sep = "/";
4
+ export declare const delimiter = ":";
5
+ /**
6
+ * Resolves `pathSegments` into an absolute path.
7
+ * @param pathSegments an array of path segments
8
+ */
9
+ export declare function resolve(...pathSegments: string[]): string;
10
+ /**
11
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
12
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
13
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
14
+ * @param path to be normalized
15
+ */
16
+ export declare function normalize(path: string): string;
17
+ /**
18
+ * Verifies whether provided path is absolute
19
+ * @param path to be verified as absolute
20
+ */
21
+ export declare function isAbsolute(path: string): boolean;
22
+ /**
23
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
24
+ * @param paths to be joined and normalized
25
+ */
26
+ export declare function join(...paths: string[]): string;
27
+ /**
28
+ * Return the relative path from `from` to `to` based on current working directory.
29
+ * @param from path in current working directory
30
+ * @param to path in current working directory
31
+ */
32
+ export declare function relative(from: string, to: string): string;
33
+ /**
34
+ * Resolves path to a namespace path
35
+ * @param path to resolve to namespace
36
+ */
37
+ export declare function toNamespacedPath(path: string): string;
38
+ /**
39
+ * Return the directory path of a `path`.
40
+ * @param path - path to extract the directory from.
41
+ */
42
+ export declare function dirname(path: string): string;
43
+ /**
44
+ * Return the last portion of a `path`.
45
+ * Trailing directory separators are ignored, and optional suffix is removed.
46
+ *
47
+ * @param path - path to extract the name from.
48
+ * @param [suffix] - suffix to remove from extracted name.
49
+ */
50
+ export declare function basename(path: string, suffix?: string): string;
51
+ /**
52
+ * Return the extension of the `path` with leading period.
53
+ * @param path with extension
54
+ * @returns extension (ex. for `file.ts` returns `.ts`)
55
+ */
56
+ export declare function extname(path: string): string;
57
+ /**
58
+ * Generate a path from `FormatInputPathObject` object.
59
+ * @param pathObject with path
60
+ */
61
+ export declare function format(pathObject: FormatInputPathObject): string;
62
+ /**
63
+ * Return a `ParsedPath` object of the `path`.
64
+ * @param path to process
65
+ */
66
+ export declare function parse(path: string): ParsedPath;
67
+ /**
68
+ * Converts a file URL to a path string.
69
+ *
70
+ * ```ts
71
+ * import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
72
+ * fromFileUrl("file:///home/foo"); // "/home/foo"
73
+ * ```
74
+ * @param url of a file URL
75
+ */
76
+ export declare function fromFileUrl(url: string | URL): string;
77
+ /**
78
+ * Converts a path string to a file URL.
79
+ *
80
+ * ```ts
81
+ * import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
82
+ * toFileUrl("/home/foo"); // new URL("file:///home/foo")
83
+ * ```
84
+ * @param path to convert to file URL
85
+ */
86
+ export declare function toFileUrl(path: string): URL;