@bolt-foundry/gambit 0.8.3 → 0.8.5-rc.10

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 (291) hide show
  1. package/CHANGELOG.md +74 -2
  2. package/README.md +87 -23
  3. package/esm/_dnt.polyfills.d.ts +17 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -1
  5. package/esm/_dnt.polyfills.js +123 -0
  6. package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts +322 -0
  7. package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.js +105 -0
  9. package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts +14 -0
  10. package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.js +34 -0
  12. package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts +13 -0
  13. package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.js +18 -0
  15. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts +10 -0
  16. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.js +17 -0
  18. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts +12 -0
  19. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.js +25 -0
  21. package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts +9 -0
  22. package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.js +13 -0
  24. package/esm/deps/jsr.io/@std/fs/1.0.23/copy.d.ts +117 -0
  25. package/esm/deps/jsr.io/@std/fs/1.0.23/copy.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@std/fs/1.0.23/copy.js +313 -0
  27. package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts +48 -0
  28. package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.js +87 -0
  30. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts +49 -0
  31. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.js +102 -0
  33. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts +47 -0
  34. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.js +90 -0
  36. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts +49 -0
  37. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.js +61 -0
  39. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts +70 -0
  40. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.js +156 -0
  42. package/esm/deps/jsr.io/@std/fs/1.0.23/eol.d.ts +52 -0
  43. package/esm/deps/jsr.io/@std/fs/1.0.23/eol.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/fs/1.0.23/eol.js +67 -0
  45. package/esm/deps/jsr.io/@std/fs/1.0.23/exists.d.ts +218 -0
  46. package/esm/deps/jsr.io/@std/fs/1.0.23/exists.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/fs/1.0.23/exists.js +271 -0
  48. package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts +267 -0
  49. package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.js +442 -0
  51. package/esm/deps/jsr.io/@std/fs/1.0.23/mod.d.ts +29 -0
  52. package/esm/deps/jsr.io/@std/fs/1.0.23/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/fs/1.0.23/mod.js +29 -0
  54. package/esm/deps/jsr.io/@std/fs/1.0.23/move.d.ts +86 -0
  55. package/esm/deps/jsr.io/@std/fs/1.0.23/move.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/fs/1.0.23/move.js +142 -0
  57. package/esm/deps/jsr.io/@std/fs/1.0.23/walk.d.ts +777 -0
  58. package/esm/deps/jsr.io/@std/fs/1.0.23/walk.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/fs/1.0.23/walk.js +846 -0
  60. package/esm/deps/jsr.io/@std/json/1.0.3/types.d.ts +7 -0
  61. package/esm/deps/jsr.io/@std/json/1.0.3/types.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/json/1.0.3/types.js +3 -0
  63. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  64. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.js +21 -0
  66. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  67. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js +320 -0
  69. package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
  70. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  71. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
  73. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  74. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.js +110 -0
  76. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  77. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
  79. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  80. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  81. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.js +283 -0
  82. package/esm/gambit/simulator-ui/dist/bundle.js +11454 -4639
  83. package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
  84. package/esm/mod.d.ts +13 -3
  85. package/esm/mod.d.ts.map +1 -1
  86. package/esm/mod.js +8 -2
  87. package/esm/src/cli_utils.d.ts +1 -0
  88. package/esm/src/cli_utils.d.ts.map +1 -1
  89. package/esm/src/cli_utils.js +13 -1
  90. package/esm/src/default_runtime.d.ts +46 -0
  91. package/esm/src/default_runtime.d.ts.map +1 -0
  92. package/esm/src/default_runtime.js +415 -0
  93. package/esm/src/durable_streams.js +26 -1
  94. package/esm/src/model_matchers.d.ts +10 -0
  95. package/esm/src/model_matchers.d.ts.map +1 -0
  96. package/esm/src/model_matchers.js +26 -0
  97. package/esm/src/openai_compat.d.ts +12 -1
  98. package/esm/src/openai_compat.d.ts.map +1 -1
  99. package/esm/src/openai_compat.js +53 -1
  100. package/esm/src/project_config.d.ts +47 -0
  101. package/esm/src/project_config.d.ts.map +1 -0
  102. package/esm/src/project_config.js +134 -0
  103. package/esm/src/providers/codex.d.ts +37 -0
  104. package/esm/src/providers/codex.d.ts.map +1 -0
  105. package/esm/src/providers/codex.js +810 -0
  106. package/esm/src/providers/google.d.ts +3 -1
  107. package/esm/src/providers/google.d.ts.map +1 -1
  108. package/esm/src/providers/google.js +82 -6
  109. package/esm/src/providers/ollama.d.ts +3 -1
  110. package/esm/src/providers/ollama.d.ts.map +1 -1
  111. package/esm/src/providers/ollama.js +295 -15
  112. package/esm/src/providers/openrouter.d.ts +6 -2
  113. package/esm/src/providers/openrouter.d.ts.map +1 -1
  114. package/esm/src/providers/openrouter.js +317 -23
  115. package/esm/src/providers/router.d.ts +19 -0
  116. package/esm/src/providers/router.d.ts.map +1 -0
  117. package/esm/src/providers/router.js +93 -0
  118. package/esm/src/server.d.ts +9 -0
  119. package/esm/src/server.d.ts.map +1 -1
  120. package/esm/src/server.js +3314 -659
  121. package/esm/src/server_feedback_grading_routes.d.ts +32 -0
  122. package/esm/src/server_feedback_grading_routes.d.ts.map +1 -0
  123. package/esm/src/server_feedback_grading_routes.js +305 -0
  124. package/esm/src/server_helpers.d.ts +4 -0
  125. package/esm/src/server_helpers.d.ts.map +1 -0
  126. package/esm/src/server_helpers.js +46 -0
  127. package/esm/src/server_session_store.d.ts +87 -0
  128. package/esm/src/server_session_store.d.ts.map +1 -0
  129. package/esm/src/server_session_store.js +873 -0
  130. package/esm/src/server_types.d.ts +110 -0
  131. package/esm/src/server_types.d.ts.map +1 -0
  132. package/esm/src/server_types.js +1 -0
  133. package/esm/src/server_ui_routes.d.ts +33 -0
  134. package/esm/src/server_ui_routes.d.ts.map +1 -0
  135. package/esm/src/server_ui_routes.js +136 -0
  136. package/esm/src/session_artifacts.d.ts +22 -0
  137. package/esm/src/session_artifacts.d.ts.map +1 -0
  138. package/esm/src/session_artifacts.js +243 -0
  139. package/esm/src/trace.d.ts.map +1 -1
  140. package/esm/src/trace.js +6 -3
  141. package/esm/src/workspace.d.ts +19 -0
  142. package/esm/src/workspace.d.ts.map +1 -0
  143. package/esm/src/workspace.js +162 -0
  144. package/esm/src/workspace_contract.d.ts +78 -0
  145. package/esm/src/workspace_contract.d.ts.map +1 -0
  146. package/esm/src/workspace_contract.js +76 -0
  147. package/package.json +2 -2
  148. package/script/_dnt.polyfills.d.ts +17 -0
  149. package/script/_dnt.polyfills.d.ts.map +1 -1
  150. package/script/_dnt.polyfills.js +123 -0
  151. package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts +322 -0
  152. package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts.map +1 -0
  153. package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.js +108 -0
  154. package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts +14 -0
  155. package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts.map +1 -0
  156. package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.js +71 -0
  157. package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts +13 -0
  158. package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts.map +1 -0
  159. package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.js +21 -0
  160. package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts +10 -0
  161. package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts.map +1 -0
  162. package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.js +20 -0
  163. package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts +12 -0
  164. package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts.map +1 -0
  165. package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.js +28 -0
  166. package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts +9 -0
  167. package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts.map +1 -0
  168. package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.js +16 -0
  169. package/script/deps/jsr.io/@std/fs/1.0.23/copy.d.ts +117 -0
  170. package/script/deps/jsr.io/@std/fs/1.0.23/copy.d.ts.map +1 -0
  171. package/script/deps/jsr.io/@std/fs/1.0.23/copy.js +350 -0
  172. package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts +48 -0
  173. package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts.map +1 -0
  174. package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.js +124 -0
  175. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts +49 -0
  176. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts.map +1 -0
  177. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.js +139 -0
  178. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts +47 -0
  179. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts.map +1 -0
  180. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.js +127 -0
  181. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts +49 -0
  182. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts.map +1 -0
  183. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.js +98 -0
  184. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts +70 -0
  185. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts.map +1 -0
  186. package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.js +193 -0
  187. package/script/deps/jsr.io/@std/fs/1.0.23/eol.d.ts +52 -0
  188. package/script/deps/jsr.io/@std/fs/1.0.23/eol.d.ts.map +1 -0
  189. package/script/deps/jsr.io/@std/fs/1.0.23/eol.js +105 -0
  190. package/script/deps/jsr.io/@std/fs/1.0.23/exists.d.ts +218 -0
  191. package/script/deps/jsr.io/@std/fs/1.0.23/exists.d.ts.map +1 -0
  192. package/script/deps/jsr.io/@std/fs/1.0.23/exists.js +308 -0
  193. package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts +267 -0
  194. package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts.map +1 -0
  195. package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.js +479 -0
  196. package/script/deps/jsr.io/@std/fs/1.0.23/mod.d.ts +29 -0
  197. package/script/deps/jsr.io/@std/fs/1.0.23/mod.d.ts.map +1 -0
  198. package/script/deps/jsr.io/@std/fs/1.0.23/mod.js +45 -0
  199. package/script/deps/jsr.io/@std/fs/1.0.23/move.d.ts +86 -0
  200. package/script/deps/jsr.io/@std/fs/1.0.23/move.d.ts.map +1 -0
  201. package/script/deps/jsr.io/@std/fs/1.0.23/move.js +179 -0
  202. package/script/deps/jsr.io/@std/fs/1.0.23/walk.d.ts +777 -0
  203. package/script/deps/jsr.io/@std/fs/1.0.23/walk.d.ts.map +1 -0
  204. package/script/deps/jsr.io/@std/fs/1.0.23/walk.js +883 -0
  205. package/script/deps/jsr.io/@std/json/1.0.3/types.d.ts +7 -0
  206. package/script/deps/jsr.io/@std/json/1.0.3/types.d.ts.map +1 -0
  207. package/script/deps/jsr.io/@std/json/1.0.3/types.js +4 -0
  208. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  209. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  210. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.js +37 -0
  211. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  212. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  213. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.js +323 -0
  214. package/script/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
  215. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  216. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  217. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
  218. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  219. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  220. package/script/deps/jsr.io/@std/toml/1.0.11/mod.js +126 -0
  221. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  222. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  223. package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
  224. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  225. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.js +286 -0
  227. package/script/gambit/simulator-ui/dist/bundle.js +11454 -4639
  228. package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
  229. package/script/mod.d.ts +13 -3
  230. package/script/mod.d.ts.map +1 -1
  231. package/script/mod.js +14 -5
  232. package/script/src/cli_utils.d.ts +1 -0
  233. package/script/src/cli_utils.d.ts.map +1 -1
  234. package/script/src/cli_utils.js +14 -1
  235. package/script/src/default_runtime.d.ts +46 -0
  236. package/script/src/default_runtime.d.ts.map +1 -0
  237. package/script/src/default_runtime.js +452 -0
  238. package/script/src/durable_streams.js +26 -1
  239. package/script/src/model_matchers.d.ts +10 -0
  240. package/script/src/model_matchers.d.ts.map +1 -0
  241. package/script/src/model_matchers.js +29 -0
  242. package/script/src/openai_compat.d.ts +12 -1
  243. package/script/src/openai_compat.d.ts.map +1 -1
  244. package/script/src/openai_compat.js +85 -0
  245. package/script/src/project_config.d.ts +47 -0
  246. package/script/src/project_config.d.ts.map +1 -0
  247. package/script/src/project_config.js +173 -0
  248. package/script/src/providers/codex.d.ts +37 -0
  249. package/script/src/providers/codex.d.ts.map +1 -0
  250. package/script/src/providers/codex.js +850 -0
  251. package/script/src/providers/google.d.ts +3 -1
  252. package/script/src/providers/google.d.ts.map +1 -1
  253. package/script/src/providers/google.js +82 -6
  254. package/script/src/providers/ollama.d.ts +3 -1
  255. package/script/src/providers/ollama.d.ts.map +1 -1
  256. package/script/src/providers/ollama.js +295 -15
  257. package/script/src/providers/openrouter.d.ts +6 -2
  258. package/script/src/providers/openrouter.d.ts.map +1 -1
  259. package/script/src/providers/openrouter.js +317 -23
  260. package/script/src/providers/router.d.ts +19 -0
  261. package/script/src/providers/router.d.ts.map +1 -0
  262. package/script/src/providers/router.js +96 -0
  263. package/script/src/server.d.ts +9 -0
  264. package/script/src/server.d.ts.map +1 -1
  265. package/script/src/server.js +3321 -666
  266. package/script/src/server_feedback_grading_routes.d.ts +32 -0
  267. package/script/src/server_feedback_grading_routes.d.ts.map +1 -0
  268. package/script/src/server_feedback_grading_routes.js +343 -0
  269. package/script/src/server_helpers.d.ts +4 -0
  270. package/script/src/server_helpers.d.ts.map +1 -0
  271. package/script/src/server_helpers.js +84 -0
  272. package/script/src/server_session_store.d.ts +87 -0
  273. package/script/src/server_session_store.d.ts.map +1 -0
  274. package/script/src/server_session_store.js +910 -0
  275. package/script/src/server_types.d.ts +110 -0
  276. package/script/src/server_types.d.ts.map +1 -0
  277. package/script/src/server_types.js +2 -0
  278. package/script/src/server_ui_routes.d.ts +33 -0
  279. package/script/src/server_ui_routes.d.ts.map +1 -0
  280. package/script/src/server_ui_routes.js +173 -0
  281. package/script/src/session_artifacts.d.ts +22 -0
  282. package/script/src/session_artifacts.d.ts.map +1 -0
  283. package/script/src/session_artifacts.js +279 -0
  284. package/script/src/trace.d.ts.map +1 -1
  285. package/script/src/trace.js +6 -3
  286. package/script/src/workspace.d.ts +19 -0
  287. package/script/src/workspace.d.ts.map +1 -0
  288. package/script/src/workspace.js +199 -0
  289. package/script/src/workspace_contract.d.ts +78 -0
  290. package/script/src/workspace_contract.d.ts.map +1 -0
  291. package/script/src/workspace_contract.js +84 -0
@@ -0,0 +1,117 @@
1
+ /** Options for {@linkcode copy} and {@linkcode copySync}. */
2
+ export interface CopyOptions {
3
+ /**
4
+ * Whether to overwrite existing file or directory.
5
+ *
6
+ * @default {false}
7
+ */
8
+ overwrite?: boolean;
9
+ /**
10
+ * When `true`, will set last modification and access times to the ones of
11
+ * the original source files. When `false`, timestamp behavior is
12
+ * OS-dependent.
13
+ *
14
+ * > [!NOTE]
15
+ * > This option is currently unsupported for symbolic links.
16
+ *
17
+ * @default {false}
18
+ */
19
+ preserveTimestamps?: boolean;
20
+ }
21
+ /**
22
+ * Asynchronously copy a file or directory (along with its contents), like
23
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=c-cp-command#cp__cp_flagr | cp -r}.
24
+ *
25
+ * Both `src` and `dest` must both be a file or directory.
26
+ *
27
+ * Requires `--allow-read` and `--allow-write` permissions.
28
+ *
29
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
30
+ * for more information on Deno's permissions system.
31
+ *
32
+ * @param src The source file/directory path as a string or URL.
33
+ * @param dest The destination file/directory path as a string or URL.
34
+ * @param options Options for copying.
35
+ *
36
+ * @returns A promise that resolves once the copy operation completes.
37
+ *
38
+ * @example Basic usage
39
+ * ```ts ignore
40
+ * import { copy } from "@std/fs/copy";
41
+ *
42
+ * await copy("./foo", "./bar");
43
+ * ```
44
+ *
45
+ * This will copy the file or directory at `./foo` to `./bar` without
46
+ * overwriting.
47
+ *
48
+ * @example Overwriting files/directories
49
+ * ```ts ignore
50
+ * import { copy } from "@std/fs/copy";
51
+ *
52
+ * await copy("./foo", "./bar", { overwrite: true });
53
+ * ```
54
+ *
55
+ * This will copy the file or directory at `./foo` to `./bar` and overwrite
56
+ * any existing files or directories.
57
+ *
58
+ * @example Preserving timestamps
59
+ * ```ts ignore
60
+ * import { copy } from "@std/fs/copy";
61
+ *
62
+ * await copy("./foo", "./bar", { preserveTimestamps: true });
63
+ * ```
64
+ *
65
+ * This will copy the file or directory at `./foo` to `./bar` and set the
66
+ * last modification and access times to the ones of the original source files.
67
+ */
68
+ export declare function copy(src: string | URL, dest: string | URL, options?: CopyOptions): Promise<void>;
69
+ /**
70
+ * Synchronously copy a file or directory (along with its contents), like
71
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=c-cp-command#cp__cp_flagr | cp -r}.
72
+ *
73
+ * Both `src` and `dest` must both be a file or directory.
74
+ *
75
+ * Requires `--allow-read` and `--allow-write` permissions.
76
+ *
77
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
78
+ * for more information on Deno's permissions system.
79
+ *
80
+ * @param src The source file/directory path as a string or URL.
81
+ * @param dest The destination file/directory path as a string or URL.
82
+ * @param options Options for copying.
83
+ *
84
+ * @returns A void value that returns once the copy operation completes.
85
+ *
86
+ * @example Basic usage
87
+ * ```ts ignore
88
+ * import { copySync } from "@std/fs/copy";
89
+ *
90
+ * copySync("./foo", "./bar");
91
+ * ```
92
+ *
93
+ * This will copy the file or directory at `./foo` to `./bar` without
94
+ * overwriting.
95
+ *
96
+ * @example Overwriting files/directories
97
+ * ```ts ignore
98
+ * import { copySync } from "@std/fs/copy";
99
+ *
100
+ * copySync("./foo", "./bar", { overwrite: true });
101
+ * ```
102
+ *
103
+ * This will copy the file or directory at `./foo` to `./bar` and overwrite
104
+ * any existing files or directories.
105
+ *
106
+ * @example Preserving timestamps
107
+ * ```ts ignore
108
+ * import { copySync } from "@std/fs/copy";
109
+ *
110
+ * copySync("./foo", "./bar", { preserveTimestamps: true });
111
+ * ```
112
+ *
113
+ * This will copy the file or directory at `./foo` to `./bar` and set the
114
+ * last modification and access times to the ones of the original source files.
115
+ */
116
+ export declare function copySync(src: string | URL, dest: string | URL, options?: CopyOptions): void;
117
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.23/copy.ts"],"names":[],"mappings":"AAaA,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;OASG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAoOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,GAAE,WAAgB,iBAwB1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,GAAE,WAAgB,QAwB1B"}
@@ -0,0 +1,313 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ import * as dntShim from "../../../../../_dnt.shims.js";
3
+ import { basename } from "../../path/1.1.4/basename.js";
4
+ import { join } from "../../path/1.1.4/join.js";
5
+ import { resolve } from "../../path/1.1.4/resolve.js";
6
+ import { ensureDir, ensureDirSync } from "./ensure_dir.js";
7
+ import { getFileInfoType } from "./_get_file_info_type.js";
8
+ import { toPathString } from "./_to_path_string.js";
9
+ import { isSubdir } from "./_is_subdir.js";
10
+ import { isWindows } from "../../internal/1.0.12/os.js";
11
+ function assertIsDate(date, name) {
12
+ if (date === null) {
13
+ throw new Error(`${name} is unavailable`);
14
+ }
15
+ }
16
+ async function ensureValidCopy(src, dest, options) {
17
+ let destStat;
18
+ try {
19
+ destStat = await dntShim.Deno.lstat(dest);
20
+ }
21
+ catch (err) {
22
+ if (err instanceof dntShim.Deno.errors.NotFound) {
23
+ return;
24
+ }
25
+ throw err;
26
+ }
27
+ if (options.isFolder && !destStat.isDirectory) {
28
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'`);
29
+ }
30
+ if (!options.overwrite) {
31
+ throw new dntShim.Deno.errors.AlreadyExists(`'${dest}' already exists.`);
32
+ }
33
+ return destStat;
34
+ }
35
+ function ensureValidCopySync(src, dest, options) {
36
+ let destStat;
37
+ try {
38
+ destStat = dntShim.Deno.lstatSync(dest);
39
+ }
40
+ catch (err) {
41
+ if (err instanceof dntShim.Deno.errors.NotFound) {
42
+ return;
43
+ }
44
+ throw err;
45
+ }
46
+ if (options.isFolder && !destStat.isDirectory) {
47
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'`);
48
+ }
49
+ if (!options.overwrite) {
50
+ throw new dntShim.Deno.errors.AlreadyExists(`'${dest}' already exists`);
51
+ }
52
+ return destStat;
53
+ }
54
+ /* copy file to dest */
55
+ async function copyFile(src, dest, options) {
56
+ await ensureValidCopy(src, dest, options);
57
+ await dntShim.Deno.copyFile(src, dest);
58
+ if (options.preserveTimestamps) {
59
+ const statInfo = await dntShim.Deno.stat(src);
60
+ assertIsDate(statInfo.atime, "statInfo.atime");
61
+ assertIsDate(statInfo.mtime, "statInfo.mtime");
62
+ await dntShim.Deno.utime(dest, statInfo.atime, statInfo.mtime);
63
+ }
64
+ }
65
+ /* copy file to dest synchronously */
66
+ function copyFileSync(src, dest, options) {
67
+ ensureValidCopySync(src, dest, options);
68
+ dntShim.Deno.copyFileSync(src, dest);
69
+ if (options.preserveTimestamps) {
70
+ const statInfo = dntShim.Deno.statSync(src);
71
+ assertIsDate(statInfo.atime, "statInfo.atime");
72
+ assertIsDate(statInfo.mtime, "statInfo.mtime");
73
+ dntShim.Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
74
+ }
75
+ }
76
+ /* copy symlink to dest */
77
+ async function copySymLink(src, dest, options) {
78
+ await ensureValidCopy(src, dest, options);
79
+ const originSrcFilePath = await dntShim.Deno.readLink(src);
80
+ const type = getFileInfoType(await dntShim.Deno.lstat(src));
81
+ if (isWindows) {
82
+ await dntShim.Deno.symlink(originSrcFilePath, dest, {
83
+ type: type === "dir" ? "dir" : "file",
84
+ });
85
+ }
86
+ else {
87
+ await dntShim.Deno.symlink(originSrcFilePath, dest);
88
+ }
89
+ if (options.preserveTimestamps) {
90
+ const statInfo = await dntShim.Deno.lstat(src);
91
+ assertIsDate(statInfo.atime, "statInfo.atime");
92
+ assertIsDate(statInfo.mtime, "statInfo.mtime");
93
+ await dntShim.Deno.utime(dest, statInfo.atime, statInfo.mtime);
94
+ }
95
+ }
96
+ /* copy symlink to dest synchronously */
97
+ function copySymlinkSync(src, dest, options) {
98
+ ensureValidCopySync(src, dest, options);
99
+ const originSrcFilePath = dntShim.Deno.readLinkSync(src);
100
+ const type = getFileInfoType(dntShim.Deno.lstatSync(src));
101
+ if (isWindows) {
102
+ dntShim.Deno.symlinkSync(originSrcFilePath, dest, {
103
+ type: type === "dir" ? "dir" : "file",
104
+ });
105
+ }
106
+ else {
107
+ dntShim.Deno.symlinkSync(originSrcFilePath, dest);
108
+ }
109
+ if (options.preserveTimestamps) {
110
+ const statInfo = dntShim.Deno.lstatSync(src);
111
+ assertIsDate(statInfo.atime, "statInfo.atime");
112
+ assertIsDate(statInfo.mtime, "statInfo.mtime");
113
+ dntShim.Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
114
+ }
115
+ }
116
+ /* copy folder from src to dest. */
117
+ async function copyDir(src, dest, options) {
118
+ const destStat = await ensureValidCopy(src, dest, {
119
+ ...options,
120
+ isFolder: true,
121
+ });
122
+ if (!destStat) {
123
+ await ensureDir(dest);
124
+ }
125
+ if (options.preserveTimestamps) {
126
+ const srcStatInfo = await dntShim.Deno.stat(src);
127
+ assertIsDate(srcStatInfo.atime, "statInfo.atime");
128
+ assertIsDate(srcStatInfo.mtime, "statInfo.mtime");
129
+ await dntShim.Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
130
+ }
131
+ src = toPathString(src);
132
+ dest = toPathString(dest);
133
+ const promises = [];
134
+ for await (const entry of dntShim.Deno.readDir(src)) {
135
+ const srcPath = join(src, entry.name);
136
+ const destPath = join(dest, basename(srcPath));
137
+ if (entry.isSymlink) {
138
+ promises.push(copySymLink(srcPath, destPath, options));
139
+ }
140
+ else if (entry.isDirectory) {
141
+ promises.push(copyDir(srcPath, destPath, options));
142
+ }
143
+ else if (entry.isFile) {
144
+ promises.push(copyFile(srcPath, destPath, options));
145
+ }
146
+ }
147
+ await Promise.all(promises);
148
+ }
149
+ /* copy folder from src to dest synchronously */
150
+ function copyDirSync(src, dest, options) {
151
+ const destStat = ensureValidCopySync(src, dest, {
152
+ ...options,
153
+ isFolder: true,
154
+ });
155
+ if (!destStat) {
156
+ ensureDirSync(dest);
157
+ }
158
+ if (options.preserveTimestamps) {
159
+ const srcStatInfo = dntShim.Deno.statSync(src);
160
+ assertIsDate(srcStatInfo.atime, "statInfo.atime");
161
+ assertIsDate(srcStatInfo.mtime, "statInfo.mtime");
162
+ dntShim.Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
163
+ }
164
+ src = toPathString(src);
165
+ dest = toPathString(dest);
166
+ for (const entry of dntShim.Deno.readDirSync(src)) {
167
+ const srcPath = join(src, entry.name);
168
+ const destPath = join(dest, basename(srcPath));
169
+ if (entry.isSymlink) {
170
+ copySymlinkSync(srcPath, destPath, options);
171
+ }
172
+ else if (entry.isDirectory) {
173
+ copyDirSync(srcPath, destPath, options);
174
+ }
175
+ else if (entry.isFile) {
176
+ copyFileSync(srcPath, destPath, options);
177
+ }
178
+ }
179
+ }
180
+ /**
181
+ * Asynchronously copy a file or directory (along with its contents), like
182
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=c-cp-command#cp__cp_flagr | cp -r}.
183
+ *
184
+ * Both `src` and `dest` must both be a file or directory.
185
+ *
186
+ * Requires `--allow-read` and `--allow-write` permissions.
187
+ *
188
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
189
+ * for more information on Deno's permissions system.
190
+ *
191
+ * @param src The source file/directory path as a string or URL.
192
+ * @param dest The destination file/directory path as a string or URL.
193
+ * @param options Options for copying.
194
+ *
195
+ * @returns A promise that resolves once the copy operation completes.
196
+ *
197
+ * @example Basic usage
198
+ * ```ts ignore
199
+ * import { copy } from "@std/fs/copy";
200
+ *
201
+ * await copy("./foo", "./bar");
202
+ * ```
203
+ *
204
+ * This will copy the file or directory at `./foo` to `./bar` without
205
+ * overwriting.
206
+ *
207
+ * @example Overwriting files/directories
208
+ * ```ts ignore
209
+ * import { copy } from "@std/fs/copy";
210
+ *
211
+ * await copy("./foo", "./bar", { overwrite: true });
212
+ * ```
213
+ *
214
+ * This will copy the file or directory at `./foo` to `./bar` and overwrite
215
+ * any existing files or directories.
216
+ *
217
+ * @example Preserving timestamps
218
+ * ```ts ignore
219
+ * import { copy } from "@std/fs/copy";
220
+ *
221
+ * await copy("./foo", "./bar", { preserveTimestamps: true });
222
+ * ```
223
+ *
224
+ * This will copy the file or directory at `./foo` to `./bar` and set the
225
+ * last modification and access times to the ones of the original source files.
226
+ */
227
+ export async function copy(src, dest, options = {}) {
228
+ src = resolve(toPathString(src));
229
+ dest = resolve(toPathString(dest));
230
+ if (src === dest) {
231
+ throw new Error("Source and destination cannot be the same");
232
+ }
233
+ const srcStat = await dntShim.Deno.lstat(src);
234
+ if (srcStat.isDirectory && isSubdir(src, dest)) {
235
+ throw new Error(`Cannot copy '${src}' to a subdirectory of itself: '${dest}'`);
236
+ }
237
+ if (srcStat.isSymlink) {
238
+ await copySymLink(src, dest, options);
239
+ }
240
+ else if (srcStat.isDirectory) {
241
+ await copyDir(src, dest, options);
242
+ }
243
+ else if (srcStat.isFile) {
244
+ await copyFile(src, dest, options);
245
+ }
246
+ }
247
+ /**
248
+ * Synchronously copy a file or directory (along with its contents), like
249
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=c-cp-command#cp__cp_flagr | cp -r}.
250
+ *
251
+ * Both `src` and `dest` must both be a file or directory.
252
+ *
253
+ * Requires `--allow-read` and `--allow-write` permissions.
254
+ *
255
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
256
+ * for more information on Deno's permissions system.
257
+ *
258
+ * @param src The source file/directory path as a string or URL.
259
+ * @param dest The destination file/directory path as a string or URL.
260
+ * @param options Options for copying.
261
+ *
262
+ * @returns A void value that returns once the copy operation completes.
263
+ *
264
+ * @example Basic usage
265
+ * ```ts ignore
266
+ * import { copySync } from "@std/fs/copy";
267
+ *
268
+ * copySync("./foo", "./bar");
269
+ * ```
270
+ *
271
+ * This will copy the file or directory at `./foo` to `./bar` without
272
+ * overwriting.
273
+ *
274
+ * @example Overwriting files/directories
275
+ * ```ts ignore
276
+ * import { copySync } from "@std/fs/copy";
277
+ *
278
+ * copySync("./foo", "./bar", { overwrite: true });
279
+ * ```
280
+ *
281
+ * This will copy the file or directory at `./foo` to `./bar` and overwrite
282
+ * any existing files or directories.
283
+ *
284
+ * @example Preserving timestamps
285
+ * ```ts ignore
286
+ * import { copySync } from "@std/fs/copy";
287
+ *
288
+ * copySync("./foo", "./bar", { preserveTimestamps: true });
289
+ * ```
290
+ *
291
+ * This will copy the file or directory at `./foo` to `./bar` and set the
292
+ * last modification and access times to the ones of the original source files.
293
+ */
294
+ export function copySync(src, dest, options = {}) {
295
+ src = resolve(toPathString(src));
296
+ dest = resolve(toPathString(dest));
297
+ if (src === dest) {
298
+ throw new Error("Source and destination cannot be the same");
299
+ }
300
+ const srcStat = dntShim.Deno.lstatSync(src);
301
+ if (srcStat.isDirectory && isSubdir(src, dest)) {
302
+ throw new Error(`Cannot copy '${src}' to a subdirectory of itself: '${dest}'`);
303
+ }
304
+ if (srcStat.isSymlink) {
305
+ copySymlinkSync(src, dest, options);
306
+ }
307
+ else if (srcStat.isDirectory) {
308
+ copyDirSync(src, dest, options);
309
+ }
310
+ else if (srcStat.isFile) {
311
+ copyFileSync(src, dest, options);
312
+ }
313
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Asynchronously ensures that a directory is empty.
3
+ *
4
+ * If the directory does not exist, it is created. The directory itself is not
5
+ * deleted.
6
+ *
7
+ * Requires `--allow-read` and `--allow-write` permissions.
8
+ *
9
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
10
+ * for more information on Deno's permissions system.
11
+ *
12
+ * @param dir The path of the directory to empty, as a string or URL.
13
+ *
14
+ * @returns A void promise that resolves once the directory is empty.
15
+ *
16
+ * @example Usage
17
+ * ```ts ignore
18
+ * import { emptyDir } from "@std/fs/empty-dir";
19
+ *
20
+ * await emptyDir("./foo");
21
+ * ```
22
+ */
23
+ export declare function emptyDir(dir: string | URL): Promise<void>;
24
+ /**
25
+ * Synchronously ensures that a directory is empty deletes the directory
26
+ * contents it is not empty.
27
+ *
28
+ * If the directory does not exist, it is created. The directory itself is not
29
+ * deleted.
30
+ *
31
+ * Requires `--allow-read` and `--allow-write` permissions.
32
+ *
33
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
34
+ * for more information on Deno's permissions system.
35
+ *
36
+ * @param dir The path of the directory to empty, as a string or URL.
37
+ *
38
+ * @returns A void value that returns once the directory is empty.
39
+ *
40
+ * @example Usage
41
+ * ```ts ignore
42
+ * import { emptyDirSync } from "@std/fs/empty-dir";
43
+ *
44
+ * emptyDirSync("./foo");
45
+ * ```
46
+ */
47
+ export declare function emptyDirSync(dir: string | URL): void;
48
+ //# sourceMappingURL=empty_dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty_dir.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.23/empty_dir.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,iBAkB/C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,QAmB7C"}
@@ -0,0 +1,87 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ import * as dntShim from "../../../../../_dnt.shims.js";
3
+ import { join } from "../../path/1.1.4/join.js";
4
+ import { toPathString } from "./_to_path_string.js";
5
+ /**
6
+ * Asynchronously ensures that a directory is empty.
7
+ *
8
+ * If the directory does not exist, it is created. The directory itself is not
9
+ * deleted.
10
+ *
11
+ * Requires `--allow-read` and `--allow-write` permissions.
12
+ *
13
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
14
+ * for more information on Deno's permissions system.
15
+ *
16
+ * @param dir The path of the directory to empty, as a string or URL.
17
+ *
18
+ * @returns A void promise that resolves once the directory is empty.
19
+ *
20
+ * @example Usage
21
+ * ```ts ignore
22
+ * import { emptyDir } from "@std/fs/empty-dir";
23
+ *
24
+ * await emptyDir("./foo");
25
+ * ```
26
+ */
27
+ export async function emptyDir(dir) {
28
+ try {
29
+ const items = await Array.fromAsync(dntShim.Deno.readDir(dir));
30
+ await Promise.all(items.map((item) => {
31
+ if (item && item.name) {
32
+ const filepath = join(toPathString(dir), item.name);
33
+ return dntShim.Deno.remove(filepath, { recursive: true });
34
+ }
35
+ }));
36
+ }
37
+ catch (err) {
38
+ if (!(err instanceof dntShim.Deno.errors.NotFound)) {
39
+ throw err;
40
+ }
41
+ // if not exist. then create it
42
+ await dntShim.Deno.mkdir(dir, { recursive: true });
43
+ }
44
+ }
45
+ /**
46
+ * Synchronously ensures that a directory is empty deletes the directory
47
+ * contents it is not empty.
48
+ *
49
+ * If the directory does not exist, it is created. The directory itself is not
50
+ * deleted.
51
+ *
52
+ * Requires `--allow-read` and `--allow-write` permissions.
53
+ *
54
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
55
+ * for more information on Deno's permissions system.
56
+ *
57
+ * @param dir The path of the directory to empty, as a string or URL.
58
+ *
59
+ * @returns A void value that returns once the directory is empty.
60
+ *
61
+ * @example Usage
62
+ * ```ts ignore
63
+ * import { emptyDirSync } from "@std/fs/empty-dir";
64
+ *
65
+ * emptyDirSync("./foo");
66
+ * ```
67
+ */
68
+ export function emptyDirSync(dir) {
69
+ try {
70
+ const items = [...dntShim.Deno.readDirSync(dir)];
71
+ // If the directory exists, remove all entries inside it.
72
+ while (items.length) {
73
+ const item = items.shift();
74
+ if (item && item.name) {
75
+ const filepath = join(toPathString(dir), item.name);
76
+ dntShim.Deno.removeSync(filepath, { recursive: true });
77
+ }
78
+ }
79
+ }
80
+ catch (err) {
81
+ if (!(err instanceof dntShim.Deno.errors.NotFound)) {
82
+ throw err;
83
+ }
84
+ // if not exist. then create it
85
+ dntShim.Deno.mkdirSync(dir, { recursive: true });
86
+ }
87
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Asynchronously ensures that the directory exists, like
3
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=m-mkdir-command#mkdir__row-d3e133766 | mkdir -p}.
4
+ *
5
+ * If the directory already exists, this function does nothing. If the directory
6
+ * does not exist, it is created.
7
+ *
8
+ * Requires `--allow-read` and `--allow-write` permissions.
9
+ *
10
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
11
+ * for more information on Deno's permissions system.
12
+ *
13
+ * @param dir The path of the directory to ensure, as a string or URL.
14
+ *
15
+ * @returns A promise that resolves once the directory exists.
16
+ *
17
+ * @example Usage
18
+ * ```ts ignore
19
+ * import { ensureDir } from "@std/fs/ensure-dir";
20
+ *
21
+ * await ensureDir("./bar");
22
+ * ```
23
+ */
24
+ export declare function ensureDir(dir: string | URL): Promise<void>;
25
+ /**
26
+ * Synchronously ensures that the directory exists, like
27
+ * {@linkcode https://www.ibm.com/docs/en/aix/7.3?topic=m-mkdir-command#mkdir__row-d3e133766 | mkdir -p}.
28
+ *
29
+ * If the directory already exists, this function does nothing. If the directory
30
+ * does not exist, it is created.
31
+ *
32
+ * Requires `--allow-read` and `--allow-write` permissions.
33
+ *
34
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
35
+ * for more information on Deno's permissions system.
36
+ *
37
+ * @param dir The path of the directory to ensure, as a string or URL.
38
+ *
39
+ * @returns A void value that returns once the directory exists.
40
+ *
41
+ * @example Usage
42
+ * ```ts ignore
43
+ * import { ensureDirSync } from "@std/fs/ensure-dir";
44
+ *
45
+ * ensureDirSync("./bar");
46
+ * ```
47
+ */
48
+ export declare function ensureDirSync(dir: string | URL): void;
49
+ //# sourceMappingURL=ensure_dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure_dir.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.23/ensure_dir.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,iBAuBhD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,QAuB9C"}