keri-ts 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +44 -120
  2. package/esm/app/cli/agent.js +0 -19
  3. package/esm/app/cli/annotate.js +7 -2
  4. package/esm/app/cli/benchmark.js +210 -0
  5. package/esm/app/cli/cli.js +50 -52
  6. package/esm/app/cli/command-definitions.js +258 -6
  7. package/esm/app/cli/common/existing.js +40 -0
  8. package/esm/app/cli/common/parsing.js +20 -0
  9. package/esm/app/cli/export.js +51 -0
  10. package/esm/app/cli/incept.js +106 -0
  11. package/esm/app/cli/index.js +9 -0
  12. package/esm/app/cli/init.js +72 -41
  13. package/esm/app/configing.js +261 -0
  14. package/esm/app/habbing.js +386 -0
  15. package/esm/app/index.js +10 -0
  16. package/esm/app/keeping.js +321 -0
  17. package/esm/app/version.js +2 -2
  18. package/esm/db/basing.js +66 -1
  19. package/esm/db/core/lmdber.js +13 -7
  20. package/esm/db/core/path-manager.js +193 -169
  21. package/esm/db/index.js +1 -0
  22. package/esm/db/keeping.js +214 -0
  23. package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
  24. package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
  25. package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
  26. package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
  27. package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
  28. package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
  29. package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
  30. package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
  31. package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
  32. package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
  33. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
  34. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
  35. package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
  36. package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
  37. package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
  38. package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
  39. package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
  40. package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
  41. package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
  42. package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
  43. package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
  44. package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
  45. package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
  46. package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
  47. package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
  48. package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
  49. package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
  50. package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
  51. package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
  52. package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
  53. package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
  54. package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
  55. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
  56. package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
  57. package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
  58. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
  59. package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
  60. package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
  61. package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
  62. package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
  63. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
  64. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
  65. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
  66. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
  67. package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
  68. package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
  69. package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
  70. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
  71. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
  72. package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
  73. package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
  74. package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
  75. package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
  76. package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
  77. package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
  78. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
  79. package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
  80. package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
  81. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
  82. package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
  83. package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
  84. package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
  85. package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
  86. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
  87. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
  88. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
  89. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
  90. package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
  91. package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
  92. package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
  93. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
  94. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
  95. package/esm/npm/index.js +7 -2
  96. package/package.json +6 -3
  97. package/types/app/cli/agent.d.ts.map +1 -1
  98. package/types/app/cli/annotate.d.ts.map +1 -1
  99. package/types/app/cli/benchmark.d.ts +11 -0
  100. package/types/app/cli/benchmark.d.ts.map +1 -0
  101. package/types/app/cli/cli.d.ts.map +1 -1
  102. package/types/app/cli/command-definitions.d.ts +5 -2
  103. package/types/app/cli/command-definitions.d.ts.map +1 -1
  104. package/types/app/cli/command-types.d.ts +12 -0
  105. package/types/app/cli/command-types.d.ts.map +1 -1
  106. package/types/app/cli/common/existing.d.ts +4 -0
  107. package/types/app/cli/common/existing.d.ts.map +1 -0
  108. package/types/app/cli/common/parsing.d.ts +15 -0
  109. package/types/app/cli/common/parsing.d.ts.map +1 -0
  110. package/types/app/cli/export.d.ts +8 -0
  111. package/types/app/cli/export.d.ts.map +1 -0
  112. package/types/app/cli/incept.d.ts +8 -0
  113. package/types/app/cli/incept.d.ts.map +1 -0
  114. package/types/app/cli/index.d.ts +10 -0
  115. package/types/app/cli/index.d.ts.map +1 -0
  116. package/types/app/cli/init.d.ts +5 -0
  117. package/types/app/cli/init.d.ts.map +1 -1
  118. package/types/app/configing.d.ts +57 -0
  119. package/types/app/configing.d.ts.map +1 -0
  120. package/types/app/habbing.d.ts +107 -0
  121. package/types/app/habbing.d.ts.map +1 -0
  122. package/types/app/index.d.ts +11 -0
  123. package/types/app/index.d.ts.map +1 -0
  124. package/types/app/keeping.d.ts +72 -0
  125. package/types/app/keeping.d.ts.map +1 -0
  126. package/types/app/version.d.ts +2 -2
  127. package/types/app/version.d.ts.map +1 -1
  128. package/types/db/basing.d.ts +16 -1
  129. package/types/db/basing.d.ts.map +1 -1
  130. package/types/db/core/lmdber.d.ts +8 -4
  131. package/types/db/core/lmdber.d.ts.map +1 -1
  132. package/types/db/core/path-manager.d.ts +88 -24
  133. package/types/db/core/path-manager.d.ts.map +1 -1
  134. package/types/db/index.d.ts +1 -0
  135. package/types/db/index.d.ts.map +1 -1
  136. package/types/db/keeping.d.ts +73 -0
  137. package/types/db/keeping.d.ts.map +1 -0
  138. package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
  139. package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
  140. package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
  141. package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
  142. package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
  143. package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
  144. package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
  145. package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
  146. package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
  147. package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
  148. package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
  149. package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
  150. package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
  151. package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
  152. package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
  153. package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
  154. package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
  155. package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
  156. package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
  157. package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
  158. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
  159. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
  160. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
  161. package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
  162. package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
  163. package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
  164. package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
  165. package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
  166. package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
  167. package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
  168. package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
  169. package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
  170. package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
  171. package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
  172. package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
  173. package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
  174. package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
  175. package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
  176. package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
  177. package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
  178. package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
  179. package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
  180. package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
  181. package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
  182. package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
  183. package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
  184. package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
  185. package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
  186. package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
  187. package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
  188. package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
  189. package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
  190. package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
  191. package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
  192. package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
  193. package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
  194. package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
  195. package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
  196. package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
  197. package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
  198. package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
  199. package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
  200. package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
  201. package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
  202. package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
  203. package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
  204. package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
  205. package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
  206. package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
  207. package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
  208. package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
  209. package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
  210. package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
  211. package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
  212. package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
  213. package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
  214. package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
  215. package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
  216. package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
  217. package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
  218. package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
  219. package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
  220. package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
  221. package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
  222. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
  223. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
  224. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
  225. package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
  226. package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
  227. package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
  228. package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
  229. package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
  230. package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
  231. package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
  232. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
  233. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
  234. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
  235. package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
  236. package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
  237. package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
  238. package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
  239. package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
  240. package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
  241. package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
  242. package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
  243. package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
  244. package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
  245. package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
  246. package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
  247. package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
  248. package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
  249. package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
  250. package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
  251. package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
  252. package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
  253. package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
  254. package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
  255. package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
  256. package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
  257. package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
  258. package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
  259. package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
  260. package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
  261. package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
  262. package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
  263. package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
  264. package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
  265. package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
  266. package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
  267. package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
  268. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
  269. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
  270. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
  271. package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
  272. package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
  273. package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
  274. package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
  275. package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
  276. package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
  277. package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
  278. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
  279. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
  280. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
  281. package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
  282. package/types/npm/index.d.ts +7 -2
  283. package/types/npm/index.d.ts.map +1 -1
  284. package/esm/app/cli/stub-commands.js +0 -61
  285. package/types/app/cli/stub-commands.d.ts +0 -6
  286. package/types/app/cli/stub-commands.d.ts.map +0 -1
@@ -0,0 +1,82 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { _globToRegExp, } from "../_common/glob_to_reg_exp.js";
4
+ const constants = {
5
+ sep: "/+",
6
+ sepMaybe: "/*",
7
+ seps: ["/"],
8
+ globstar: "(?:[^/]*(?:/|$)+)*",
9
+ wildcard: "[^/]*",
10
+ escapePrefix: "\\",
11
+ };
12
+ /** Convert a glob string to a regular expression.
13
+ *
14
+ * Tries to match bash glob expansion as closely as possible.
15
+ *
16
+ * Basic glob syntax:
17
+ * - `*` - Matches everything without leaving the path segment.
18
+ * - `?` - Matches any single character.
19
+ * - `{foo,bar}` - Matches `foo` or `bar`.
20
+ * - `[abcd]` - Matches `a`, `b`, `c` or `d`.
21
+ * - `[a-d]` - Matches `a`, `b`, `c` or `d`.
22
+ * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`.
23
+ * - `[[:<class>:]]` - Matches any character belonging to `<class>`.
24
+ * - `[[:alnum:]]` - Matches any digit or letter.
25
+ * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`.
26
+ * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes
27
+ * for a complete list of supported character classes.
28
+ * - `\` - Escapes the next character for an `os` other than `"windows"`.
29
+ * - \` - Escapes the next character for `os` set to `"windows"`.
30
+ * - `/` - Path separator.
31
+ * - `\` - Additional path separator only for `os` set to `"windows"`.
32
+ *
33
+ * Extended syntax:
34
+ * - Requires `{ extended: true }`.
35
+ * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`.
36
+ * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same.
37
+ * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`.
38
+ * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`.
39
+ * - `!(foo|bar)` - Matches anything other than `{foo,bar}`.
40
+ * - See https://www.linuxjournal.com/content/bash-extended-globbing.
41
+ *
42
+ * Globstar syntax:
43
+ * - Requires `{ globstar: true }`.
44
+ * - `**` - Matches any number of any path segments.
45
+ * - Must comprise its entire path segment in the provided glob.
46
+ * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
47
+ *
48
+ * Note the following properties:
49
+ * - The generated `RegExp` is anchored at both start and end.
50
+ * - Repeating and trailing separators are tolerated. Trailing separators in the
51
+ * provided glob have no meaning and are discarded.
52
+ * - Absolute globs will only match absolute paths, etc.
53
+ * - Empty globs will match nothing.
54
+ * - Any special glob syntax must be contained to one path segment. For example,
55
+ * `?(foo|bar/baz)` is invalid. The separator will take precedence and the
56
+ * first segment ends with an unclosed group.
57
+ * - If a path segment ends with unclosed groups or a dangling escape prefix, a
58
+ * parse error has occurred. Every character for that segment is taken
59
+ * literally in this event.
60
+ *
61
+ * Limitations:
62
+ * - A negative group like `!(foo|bar)` will wrongly be converted to a negative
63
+ * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly
64
+ * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively,
65
+ * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if
66
+ * the group occurs not nested at the end of the segment.
67
+ *
68
+ * @example Usage
69
+ * ```ts
70
+ * import { globToRegExp } from "@std/path/posix/glob-to-regexp";
71
+ * import { assertEquals } from "@std/assert";
72
+ *
73
+ * assertEquals(globToRegExp("*.js"), /^[^/]*\.js\/*$/);
74
+ * ```
75
+ *
76
+ * @param glob Glob string to convert.
77
+ * @param options Conversion options.
78
+ * @returns The regular expression equivalent to the glob.
79
+ */
80
+ export function globToRegExp(glob, options = {}) {
81
+ return _globToRegExp(constants, glob, options);
82
+ }
@@ -0,0 +1,23 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { assertPath } from "../_common/assert_path.js";
4
+ import { isPosixPathSeparator } from "./_util.js";
5
+ /**
6
+ * Verifies whether provided path is absolute.
7
+ *
8
+ * @example Usage
9
+ * ```ts
10
+ * import { isAbsolute } from "@std/path/posix/is-absolute";
11
+ * import { assert, assertFalse } from "@std/assert";
12
+ *
13
+ * assert(isAbsolute("/home/user/Documents/"));
14
+ * assertFalse(isAbsolute("home/user/Documents/"));
15
+ * ```
16
+ *
17
+ * @param path The path to verify.
18
+ * @returns Whether the path is absolute.
19
+ */
20
+ export function isAbsolute(path) {
21
+ assertPath(path);
22
+ return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
23
+ }
@@ -0,0 +1,45 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { assertPath } from "../_common/assert_path.js";
4
+ import { fromFileUrl } from "./from_file_url.js";
5
+ import { normalize } from "./normalize.js";
6
+ /**
7
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
8
+ *
9
+ * @example Usage
10
+ * ```ts
11
+ * import { join } from "@std/path/posix/join";
12
+ * import { assertEquals } from "@std/assert";
13
+ *
14
+ * assertEquals(join("/foo", "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf");
15
+ * assertEquals(join(new URL("file:///foo"), "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf");
16
+ * ```
17
+ *
18
+ * @example Working with URLs
19
+ * ```ts
20
+ * import { join } from "@std/path/posix/join";
21
+ * import { assertEquals } from "@std/assert";
22
+ *
23
+ * const url = new URL("https://deno.land");
24
+ * url.pathname = join("std", "path", "mod.ts");
25
+ * assertEquals(url.href, "https://deno.land/std/path/mod.ts");
26
+ *
27
+ * url.pathname = join("//std", "path/", "/mod.ts");
28
+ * assertEquals(url.href, "https://deno.land/std/path/mod.ts");
29
+ * ```
30
+ *
31
+ * @param path The path to join. This can be string or file URL.
32
+ * @param paths The paths to join.
33
+ * @returns The joined path.
34
+ */
35
+ export function join(path, ...paths) {
36
+ if (path === undefined)
37
+ return ".";
38
+ if (path instanceof URL) {
39
+ path = fromFileUrl(path);
40
+ }
41
+ paths = path ? [path, ...paths] : paths;
42
+ paths.forEach((path) => assertPath(path));
43
+ const joined = paths.filter((path) => path.length > 0).join("/");
44
+ return joined === "" ? "." : normalize(joined);
45
+ }
@@ -0,0 +1,40 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { join } from "./join.js";
4
+ import { SEPARATOR } from "./constants.js";
5
+ import { normalizeGlob } from "./normalize_glob.js";
6
+ /**
7
+ * Like join(), but doesn't collapse "**\/.." when `globstar` is true.
8
+ *
9
+ * @example Usage
10
+ * ```ts
11
+ * import { joinGlobs } from "@std/path/posix/join-globs";
12
+ * import { assertEquals } from "@std/assert";
13
+ *
14
+ * const path = joinGlobs(["foo", "bar", "**"], { globstar: true });
15
+ * assertEquals(path, "foo/bar/**");
16
+ * ```
17
+ *
18
+ * @param globs The globs to join.
19
+ * @param options The options to use.
20
+ * @returns The joined path.
21
+ */
22
+ export function joinGlobs(globs, options = {}) {
23
+ const { globstar = false } = options;
24
+ if (!globstar || globs.length === 0) {
25
+ return join(...globs);
26
+ }
27
+ let joined;
28
+ for (const glob of globs) {
29
+ const path = glob;
30
+ if (path.length > 0) {
31
+ if (!joined)
32
+ joined = path;
33
+ else
34
+ joined += `${SEPARATOR}${path}`;
35
+ }
36
+ }
37
+ if (!joined)
38
+ return ".";
39
+ return normalizeGlob(joined, { globstar });
40
+ }
@@ -0,0 +1,58 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { assertArg } from "../_common/normalize.js";
4
+ import { normalizeString } from "../_common/normalize_string.js";
5
+ import { isPosixPathSeparator } from "./_util.js";
6
+ import { fromFileUrl } from "./from_file_url.js";
7
+ /**
8
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
9
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
10
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
11
+ *
12
+ * @example Usage
13
+ * ```ts
14
+ * import { normalize } from "@std/path/posix/normalize";
15
+ * import { assertEquals } from "@std/assert";
16
+ *
17
+ * assertEquals(normalize("/foo/bar//baz/asdf/quux/.."), "/foo/bar/baz/asdf");
18
+ * assertEquals(normalize(new URL("file:///foo/bar//baz/asdf/quux/..")), "/foo/bar/baz/asdf/");
19
+ * ```
20
+ *
21
+ * @example Working with URLs
22
+ *
23
+ * Note: This function will remove the double slashes from a URL's scheme.
24
+ * Hence, do not pass a full URL to this function. Instead, pass the pathname of
25
+ * the URL.
26
+ *
27
+ * ```ts
28
+ * import { normalize } from "@std/path/posix/normalize";
29
+ * import { assertEquals } from "@std/assert";
30
+ *
31
+ * const url = new URL("https://deno.land");
32
+ * url.pathname = normalize("//std//assert//.//mod.ts");
33
+ * assertEquals(url.href, "https://deno.land/std/assert/mod.ts");
34
+ *
35
+ * url.pathname = normalize("std/assert/../async/retry.ts");
36
+ * assertEquals(url.href, "https://deno.land/std/async/retry.ts");
37
+ * ```
38
+ *
39
+ * @param path The path to normalize.
40
+ * @returns The normalized path.
41
+ */
42
+ export function normalize(path) {
43
+ if (path instanceof URL) {
44
+ path = fromFileUrl(path);
45
+ }
46
+ assertArg(path);
47
+ const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
48
+ const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
49
+ // Normalize the path
50
+ path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
51
+ if (path.length === 0 && !isAbsolute)
52
+ path = ".";
53
+ if (path.length > 0 && trailingSeparator)
54
+ path += "/";
55
+ if (isAbsolute)
56
+ return `/${path}`;
57
+ return path;
58
+ }
@@ -0,0 +1,32 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { normalize } from "./normalize.js";
4
+ import { SEPARATOR_PATTERN } from "./constants.js";
5
+ /**
6
+ * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
7
+ *
8
+ * @example Usage
9
+ * ```ts
10
+ * import { normalizeGlob } from "@std/path/posix/normalize-glob";
11
+ * import { assertEquals } from "@std/assert";
12
+ *
13
+ * const path = normalizeGlob("foo/bar/../*", { globstar: true });
14
+ * assertEquals(path, "foo/*");
15
+ * ```
16
+ *
17
+ * @param glob The glob to normalize.
18
+ * @param options The options to use.
19
+ * @returns The normalized path.
20
+ */
21
+ export function normalizeGlob(glob, options = {}) {
22
+ const { globstar = false } = options;
23
+ if (glob.match(/\0/g)) {
24
+ throw new Error(`Glob contains invalid characters: "${glob}"`);
25
+ }
26
+ if (!globstar) {
27
+ return normalize(glob);
28
+ }
29
+ const s = SEPARATOR_PATTERN.source;
30
+ const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
31
+ return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
32
+ }
@@ -0,0 +1,115 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { CHAR_DOT } from "../_common/constants.js";
4
+ import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
5
+ import { assertPath } from "../_common/assert_path.js";
6
+ import { isPosixPathSeparator } from "./_util.js";
7
+ /**
8
+ * Return a `ParsedPath` object of the `path`.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { parse } from "@std/path/posix/parse";
13
+ * import { assertEquals } from "@std/assert";
14
+ *
15
+ * const path = parse("/home/user/file.txt");
16
+ * assertEquals(path, {
17
+ * root: "/",
18
+ * dir: "/home/user",
19
+ * base: "file.txt",
20
+ * ext: ".txt",
21
+ * name: "file"
22
+ * });
23
+ * ```
24
+ *
25
+ * @param path The path to parse.
26
+ * @returns The parsed path object.
27
+ */
28
+ export function parse(path) {
29
+ assertPath(path);
30
+ const ret = { root: "", dir: "", base: "", ext: "", name: "" };
31
+ if (path.length === 0)
32
+ return ret;
33
+ const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
34
+ let start;
35
+ if (isAbsolute) {
36
+ ret.root = "/";
37
+ start = 1;
38
+ }
39
+ else {
40
+ start = 0;
41
+ }
42
+ let startDot = -1;
43
+ let startPart = 0;
44
+ let end = -1;
45
+ let matchedSlash = true;
46
+ let i = path.length - 1;
47
+ // Track the state of characters (if any) we see before our first dot and
48
+ // after any path separator we find
49
+ let preDotState = 0;
50
+ // Get non-dir info
51
+ for (; i >= start; --i) {
52
+ const code = path.charCodeAt(i);
53
+ if (isPosixPathSeparator(code)) {
54
+ // If we reached a path separator that was not part of a set of path
55
+ // separators at the end of the string, stop now
56
+ if (!matchedSlash) {
57
+ startPart = i + 1;
58
+ break;
59
+ }
60
+ continue;
61
+ }
62
+ if (end === -1) {
63
+ // We saw the first non-path separator, mark this as the end of our
64
+ // extension
65
+ matchedSlash = false;
66
+ end = i + 1;
67
+ }
68
+ if (code === CHAR_DOT) {
69
+ // If this is our first dot, mark it as the start of our extension
70
+ if (startDot === -1)
71
+ startDot = i;
72
+ else if (preDotState !== 1)
73
+ preDotState = 1;
74
+ }
75
+ else if (startDot !== -1) {
76
+ // We saw a non-dot and non-path separator before our dot, so we should
77
+ // have a good chance at having a non-empty extension
78
+ preDotState = -1;
79
+ }
80
+ }
81
+ if (startDot === -1 ||
82
+ end === -1 ||
83
+ // We saw a non-dot character immediately before the dot
84
+ preDotState === 0 ||
85
+ // The (right-most) trimmed path component is exactly '..'
86
+ (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
87
+ if (end !== -1) {
88
+ if (startPart === 0 && isAbsolute) {
89
+ ret.base = ret.name = path.slice(1, end);
90
+ }
91
+ else {
92
+ ret.base = ret.name = path.slice(startPart, end);
93
+ }
94
+ }
95
+ // Fallback to '/' in case there is no basename
96
+ ret.base = ret.base || "/";
97
+ }
98
+ else {
99
+ if (startPart === 0 && isAbsolute) {
100
+ ret.name = path.slice(1, startDot);
101
+ ret.base = path.slice(1, end);
102
+ }
103
+ else {
104
+ ret.name = path.slice(startPart, startDot);
105
+ ret.base = path.slice(startPart, end);
106
+ }
107
+ ret.ext = path.slice(startDot, end);
108
+ }
109
+ if (startPart > 0) {
110
+ ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
111
+ }
112
+ else if (isAbsolute)
113
+ ret.dir = "/";
114
+ return ret;
115
+ }
@@ -0,0 +1,106 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { isPosixPathSeparator } from "./_util.js";
4
+ import { resolve } from "./resolve.js";
5
+ import { assertArgs } from "../_common/relative.js";
6
+ /**
7
+ * Return the relative path from `from` to `to` based on current working directory.
8
+ *
9
+ * If `from` and `to` are the same, return an empty string.
10
+ *
11
+ * @example Usage
12
+ * ```ts
13
+ * import { relative } from "@std/path/posix/relative";
14
+ * import { assertEquals } from "@std/assert";
15
+ *
16
+ * const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb");
17
+ * assertEquals(path, "../../impl/bbb");
18
+ * ```
19
+ *
20
+ * @param from The path to start from.
21
+ * @param to The path to reach.
22
+ * @returns The relative path.
23
+ */
24
+ export function relative(from, to) {
25
+ assertArgs(from, to);
26
+ from = resolve(from);
27
+ to = resolve(to);
28
+ if (from === to)
29
+ return "";
30
+ // Trim any leading backslashes
31
+ let fromStart = 1;
32
+ const fromEnd = from.length;
33
+ for (; fromStart < fromEnd; ++fromStart) {
34
+ if (!isPosixPathSeparator(from.charCodeAt(fromStart)))
35
+ break;
36
+ }
37
+ const fromLen = fromEnd - fromStart;
38
+ // Trim any leading backslashes
39
+ let toStart = 1;
40
+ const toEnd = to.length;
41
+ for (; toStart < toEnd; ++toStart) {
42
+ if (!isPosixPathSeparator(to.charCodeAt(toStart)))
43
+ break;
44
+ }
45
+ const toLen = toEnd - toStart;
46
+ // Compare paths to find the longest common path from root
47
+ const length = fromLen < toLen ? fromLen : toLen;
48
+ let lastCommonSep = -1;
49
+ let i = 0;
50
+ for (; i <= length; ++i) {
51
+ if (i === length) {
52
+ if (toLen > length) {
53
+ if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
54
+ // We get here if `from` is the exact base path for `to`.
55
+ // For example: from='/foo/bar'; to='/foo/bar/baz'
56
+ return to.slice(toStart + i + 1);
57
+ }
58
+ else if (i === 0) {
59
+ // We get here if `from` is the root
60
+ // For example: from='/'; to='/foo'
61
+ return to.slice(toStart + i);
62
+ }
63
+ }
64
+ else if (fromLen > length) {
65
+ if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
66
+ // We get here if `to` is the exact base path for `from`.
67
+ // For example: from='/foo/bar/baz'; to='/foo/bar'
68
+ lastCommonSep = i;
69
+ }
70
+ else if (i === 0) {
71
+ // We get here if `to` is the root.
72
+ // For example: from='/foo'; to='/'
73
+ lastCommonSep = 0;
74
+ }
75
+ }
76
+ break;
77
+ }
78
+ const fromCode = from.charCodeAt(fromStart + i);
79
+ const toCode = to.charCodeAt(toStart + i);
80
+ if (fromCode !== toCode)
81
+ break;
82
+ else if (isPosixPathSeparator(fromCode))
83
+ lastCommonSep = i;
84
+ }
85
+ let out = "";
86
+ // Generate the relative path based on the path difference between `to`
87
+ // and `from`
88
+ for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
89
+ if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
90
+ if (out.length === 0)
91
+ out += "..";
92
+ else
93
+ out += "/..";
94
+ }
95
+ }
96
+ // Lastly, append the rest of the destination (`to`) path that comes after
97
+ // the common path parts
98
+ if (out.length > 0)
99
+ return out + to.slice(toStart + lastCommonSep);
100
+ else {
101
+ toStart += lastCommonSep;
102
+ if (isPosixPathSeparator(to.charCodeAt(toStart)))
103
+ ++toStart;
104
+ return to.slice(toStart);
105
+ }
106
+ }
@@ -0,0 +1,59 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import * as dntShim from "../../../../../../_dnt.shims.js";
4
+ import { normalizeString } from "../_common/normalize_string.js";
5
+ import { assertPath } from "../_common/assert_path.js";
6
+ import { isPosixPathSeparator } from "./_util.js";
7
+ /**
8
+ * Resolves path segments into a `path`.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { resolve } from "@std/path/posix/resolve";
13
+ * import { assertEquals } from "@std/assert";
14
+ *
15
+ * const path = resolve("/foo", "bar", "baz/asdf", "quux", "..");
16
+ * assertEquals(path, "/foo/bar/baz/asdf");
17
+ * ```
18
+ *
19
+ * @param pathSegments The path segments to resolve.
20
+ * @returns The resolved path.
21
+ */
22
+ export function resolve(...pathSegments) {
23
+ let resolvedPath = "";
24
+ let resolvedAbsolute = false;
25
+ for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
26
+ let path;
27
+ if (i >= 0)
28
+ path = pathSegments[i];
29
+ else {
30
+ // deno-lint-ignore no-explicit-any
31
+ const { Deno } = dntShim.dntGlobalThis;
32
+ if (typeof Deno?.cwd !== "function") {
33
+ throw new TypeError("Resolved a relative path without a current working directory (CWD)");
34
+ }
35
+ path = Deno.cwd();
36
+ }
37
+ assertPath(path);
38
+ // Skip empty entries
39
+ if (path.length === 0) {
40
+ continue;
41
+ }
42
+ resolvedPath = `${path}/${resolvedPath}`;
43
+ resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
44
+ }
45
+ // At this point the path should be resolved to a full absolute path, but
46
+ // handle relative paths to be safe (might happen when Deno.cwd() fails)
47
+ // Normalize the path
48
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
49
+ if (resolvedAbsolute) {
50
+ if (resolvedPath.length > 0)
51
+ return `/${resolvedPath}`;
52
+ else
53
+ return "/";
54
+ }
55
+ else if (resolvedPath.length > 0)
56
+ return resolvedPath;
57
+ else
58
+ return ".";
59
+ }
@@ -0,0 +1,27 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { encodeWhitespace } from "../_common/to_file_url.js";
4
+ import { isAbsolute } from "./is_absolute.js";
5
+ /**
6
+ * Converts a path string to a file URL.
7
+ *
8
+ * @example Usage
9
+ * ```ts
10
+ * import { toFileUrl } from "@std/path/posix/to-file-url";
11
+ * import { assertEquals } from "@std/assert";
12
+ *
13
+ * assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
14
+ * assertEquals(toFileUrl("/home/foo bar"), new URL("file:///home/foo%20bar"));
15
+ * ```
16
+ *
17
+ * @param path The path to convert.
18
+ * @returns The file URL.
19
+ */
20
+ export function toFileUrl(path) {
21
+ if (!isAbsolute(path)) {
22
+ throw new TypeError(`Path must be absolute: received "${path}"`);
23
+ }
24
+ const url = new URL("file:///");
25
+ url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
26
+ return url;
27
+ }
@@ -0,0 +1,20 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ /**
4
+ * Converts a path to a namespaced path. This function returns the path as is on posix.
5
+ *
6
+ * @example Usage
7
+ * ```ts
8
+ * import { toNamespacedPath } from "@std/path/posix/to-namespaced-path";
9
+ * import { assertEquals } from "@std/assert";
10
+ *
11
+ * assertEquals(toNamespacedPath("/home/foo"), "/home/foo");
12
+ * ```
13
+ *
14
+ * @param path The path.
15
+ * @returns The namespaced path.
16
+ */
17
+ export function toNamespacedPath(path) {
18
+ // Non-op on posix systems
19
+ return path;
20
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { isWindows } from "../../internal/1.0.12/os.js";
4
+ import { relative as posixRelative } from "./posix/relative.js";
5
+ import { relative as windowsRelative } from "./windows/relative.js";
6
+ /**
7
+ * Return the relative path from `from` to `to` based on current working
8
+ * directory.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { relative } from "@std/path/relative";
13
+ * import { assertEquals } from "@std/assert";
14
+ *
15
+ * if (Deno.build.os === "windows") {
16
+ * const path = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
17
+ * assertEquals(path, "..\\..\\impl\\bbb");
18
+ * } else {
19
+ * const path = relative("/data/foobar/test/aaa", "/data/foobar/impl/bbb");
20
+ * assertEquals(path, "../../impl/bbb");
21
+ * }
22
+ * ```
23
+ *
24
+ * @param from Path in current working directory.
25
+ * @param to Path in current working directory.
26
+ * @returns The relative path from `from` to `to`.
27
+ */
28
+ export function relative(from, to) {
29
+ return isWindows ? windowsRelative(from, to) : posixRelative(from, to);
30
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { isWindows } from "../../internal/1.0.12/os.js";
4
+ import { resolve as posixResolve } from "./posix/resolve.js";
5
+ import { resolve as windowsResolve } from "./windows/resolve.js";
6
+ /**
7
+ * Resolves path segments into a path.
8
+ *
9
+ * @example Usage
10
+ * ```ts
11
+ * import { resolve } from "@std/path/resolve";
12
+ * import { assertEquals } from "@std/assert";
13
+ *
14
+ * if (Deno.build.os === "windows") {
15
+ * assertEquals(resolve("C:\\foo", "bar", "baz"), "C:\\foo\\bar\\baz");
16
+ * assertEquals(resolve("C:\\foo", "C:\\bar", "baz"), "C:\\bar\\baz");
17
+ * } else {
18
+ * assertEquals(resolve("/foo", "bar", "baz"), "/foo/bar/baz");
19
+ * assertEquals(resolve("/foo", "/bar", "baz"), "/bar/baz");
20
+ * }
21
+ * ```
22
+ *
23
+ * @param pathSegments Path segments to process to path.
24
+ * @returns The resolved path.
25
+ */
26
+ export function resolve(...pathSegments) {
27
+ return isWindows
28
+ ? windowsResolve(...pathSegments)
29
+ : posixResolve(...pathSegments);
30
+ }