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

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 (289) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/README.md +79 -16
  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 +122 -0
  6. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  7. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +105 -0
  9. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  10. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +34 -0
  12. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  13. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +18 -0
  15. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  16. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +17 -0
  18. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  19. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +25 -0
  21. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  22. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +13 -0
  24. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  25. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.js +313 -0
  27. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  28. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +87 -0
  30. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  31. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +102 -0
  33. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  34. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +90 -0
  36. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  37. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +61 -0
  39. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  40. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +156 -0
  42. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  43. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.js +67 -0
  45. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  46. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.js +271 -0
  48. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  49. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +442 -0
  51. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  52. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.js +29 -0
  54. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  55. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/fs/1.0.22/move.js +142 -0
  57. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  58. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.js +846 -0
  60. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  61. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/json/1.0.2/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/toml/1.0.11/_parser.d.ts +93 -0
  70. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
  72. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  73. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  74. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.js +110 -0
  75. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  76. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  77. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
  78. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  79. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  80. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.js +283 -0
  81. package/esm/gambit/simulator-ui/dist/bundle.js +10647 -4637
  82. package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
  83. package/esm/mod.d.ts +13 -3
  84. package/esm/mod.d.ts.map +1 -1
  85. package/esm/mod.js +8 -2
  86. package/esm/src/cli_utils.d.ts +1 -0
  87. package/esm/src/cli_utils.d.ts.map +1 -1
  88. package/esm/src/cli_utils.js +13 -1
  89. package/esm/src/default_runtime.d.ts +46 -0
  90. package/esm/src/default_runtime.d.ts.map +1 -0
  91. package/esm/src/default_runtime.js +415 -0
  92. package/esm/src/durable_streams.js +26 -1
  93. package/esm/src/model_matchers.d.ts +10 -0
  94. package/esm/src/model_matchers.d.ts.map +1 -0
  95. package/esm/src/model_matchers.js +26 -0
  96. package/esm/src/openai_compat.d.ts +12 -1
  97. package/esm/src/openai_compat.d.ts.map +1 -1
  98. package/esm/src/openai_compat.js +53 -1
  99. package/esm/src/project_config.d.ts +47 -0
  100. package/esm/src/project_config.d.ts.map +1 -0
  101. package/esm/src/project_config.js +134 -0
  102. package/esm/src/providers/codex.d.ts +37 -0
  103. package/esm/src/providers/codex.d.ts.map +1 -0
  104. package/esm/src/providers/codex.js +810 -0
  105. package/esm/src/providers/google.d.ts +3 -1
  106. package/esm/src/providers/google.d.ts.map +1 -1
  107. package/esm/src/providers/google.js +82 -6
  108. package/esm/src/providers/ollama.d.ts +3 -1
  109. package/esm/src/providers/ollama.d.ts.map +1 -1
  110. package/esm/src/providers/ollama.js +238 -15
  111. package/esm/src/providers/openrouter.d.ts +6 -2
  112. package/esm/src/providers/openrouter.d.ts.map +1 -1
  113. package/esm/src/providers/openrouter.js +260 -23
  114. package/esm/src/providers/router.d.ts +19 -0
  115. package/esm/src/providers/router.d.ts.map +1 -0
  116. package/esm/src/providers/router.js +93 -0
  117. package/esm/src/server.d.ts +9 -0
  118. package/esm/src/server.d.ts.map +1 -1
  119. package/esm/src/server.js +3186 -652
  120. package/esm/src/server_feedback_grading_routes.d.ts +32 -0
  121. package/esm/src/server_feedback_grading_routes.d.ts.map +1 -0
  122. package/esm/src/server_feedback_grading_routes.js +305 -0
  123. package/esm/src/server_helpers.d.ts +4 -0
  124. package/esm/src/server_helpers.d.ts.map +1 -0
  125. package/esm/src/server_helpers.js +46 -0
  126. package/esm/src/server_session_store.d.ts +87 -0
  127. package/esm/src/server_session_store.d.ts.map +1 -0
  128. package/esm/src/server_session_store.js +873 -0
  129. package/esm/src/server_types.d.ts +110 -0
  130. package/esm/src/server_types.d.ts.map +1 -0
  131. package/esm/src/server_types.js +1 -0
  132. package/esm/src/server_ui_routes.d.ts +33 -0
  133. package/esm/src/server_ui_routes.d.ts.map +1 -0
  134. package/esm/src/server_ui_routes.js +135 -0
  135. package/esm/src/session_artifacts.d.ts +22 -0
  136. package/esm/src/session_artifacts.d.ts.map +1 -0
  137. package/esm/src/session_artifacts.js +243 -0
  138. package/esm/src/trace.d.ts.map +1 -1
  139. package/esm/src/trace.js +6 -3
  140. package/esm/src/workspace.d.ts +19 -0
  141. package/esm/src/workspace.d.ts.map +1 -0
  142. package/esm/src/workspace.js +164 -0
  143. package/esm/src/workspace_contract.d.ts +76 -0
  144. package/esm/src/workspace_contract.d.ts.map +1 -0
  145. package/esm/src/workspace_contract.js +74 -0
  146. package/package.json +2 -2
  147. package/script/_dnt.polyfills.d.ts +17 -0
  148. package/script/_dnt.polyfills.d.ts.map +1 -1
  149. package/script/_dnt.polyfills.js +122 -0
  150. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  151. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  152. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +108 -0
  153. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  154. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  155. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +71 -0
  156. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  157. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  158. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +21 -0
  159. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  160. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  161. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +20 -0
  162. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  163. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  164. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +28 -0
  165. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  166. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  167. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +16 -0
  168. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  169. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  170. package/script/deps/jsr.io/@std/fs/1.0.22/copy.js +350 -0
  171. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  172. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  173. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +124 -0
  174. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  175. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  176. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +139 -0
  177. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  178. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  179. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +127 -0
  180. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  181. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  182. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +98 -0
  183. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  184. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  185. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +193 -0
  186. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  187. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  188. package/script/deps/jsr.io/@std/fs/1.0.22/eol.js +105 -0
  189. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  190. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  191. package/script/deps/jsr.io/@std/fs/1.0.22/exists.js +308 -0
  192. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  193. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  194. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +479 -0
  195. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  196. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  197. package/script/deps/jsr.io/@std/fs/1.0.22/mod.js +45 -0
  198. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  199. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  200. package/script/deps/jsr.io/@std/fs/1.0.22/move.js +179 -0
  201. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  202. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  203. package/script/deps/jsr.io/@std/fs/1.0.22/walk.js +883 -0
  204. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  205. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  206. package/script/deps/jsr.io/@std/json/1.0.2/types.js +4 -0
  207. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  208. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  209. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.js +37 -0
  210. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  211. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  212. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.js +323 -0
  213. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  214. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  215. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
  216. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  217. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  218. package/script/deps/jsr.io/@std/toml/1.0.11/mod.js +126 -0
  219. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  220. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  221. package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
  222. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  223. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.js +286 -0
  225. package/script/gambit/simulator-ui/dist/bundle.js +10647 -4637
  226. package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
  227. package/script/mod.d.ts +13 -3
  228. package/script/mod.d.ts.map +1 -1
  229. package/script/mod.js +14 -5
  230. package/script/src/cli_utils.d.ts +1 -0
  231. package/script/src/cli_utils.d.ts.map +1 -1
  232. package/script/src/cli_utils.js +14 -1
  233. package/script/src/default_runtime.d.ts +46 -0
  234. package/script/src/default_runtime.d.ts.map +1 -0
  235. package/script/src/default_runtime.js +452 -0
  236. package/script/src/durable_streams.js +26 -1
  237. package/script/src/model_matchers.d.ts +10 -0
  238. package/script/src/model_matchers.d.ts.map +1 -0
  239. package/script/src/model_matchers.js +29 -0
  240. package/script/src/openai_compat.d.ts +12 -1
  241. package/script/src/openai_compat.d.ts.map +1 -1
  242. package/script/src/openai_compat.js +85 -0
  243. package/script/src/project_config.d.ts +47 -0
  244. package/script/src/project_config.d.ts.map +1 -0
  245. package/script/src/project_config.js +173 -0
  246. package/script/src/providers/codex.d.ts +37 -0
  247. package/script/src/providers/codex.d.ts.map +1 -0
  248. package/script/src/providers/codex.js +850 -0
  249. package/script/src/providers/google.d.ts +3 -1
  250. package/script/src/providers/google.d.ts.map +1 -1
  251. package/script/src/providers/google.js +82 -6
  252. package/script/src/providers/ollama.d.ts +3 -1
  253. package/script/src/providers/ollama.d.ts.map +1 -1
  254. package/script/src/providers/ollama.js +238 -15
  255. package/script/src/providers/openrouter.d.ts +6 -2
  256. package/script/src/providers/openrouter.d.ts.map +1 -1
  257. package/script/src/providers/openrouter.js +260 -23
  258. package/script/src/providers/router.d.ts +19 -0
  259. package/script/src/providers/router.d.ts.map +1 -0
  260. package/script/src/providers/router.js +96 -0
  261. package/script/src/server.d.ts +9 -0
  262. package/script/src/server.d.ts.map +1 -1
  263. package/script/src/server.js +3193 -659
  264. package/script/src/server_feedback_grading_routes.d.ts +32 -0
  265. package/script/src/server_feedback_grading_routes.d.ts.map +1 -0
  266. package/script/src/server_feedback_grading_routes.js +343 -0
  267. package/script/src/server_helpers.d.ts +4 -0
  268. package/script/src/server_helpers.d.ts.map +1 -0
  269. package/script/src/server_helpers.js +84 -0
  270. package/script/src/server_session_store.d.ts +87 -0
  271. package/script/src/server_session_store.d.ts.map +1 -0
  272. package/script/src/server_session_store.js +910 -0
  273. package/script/src/server_types.d.ts +110 -0
  274. package/script/src/server_types.d.ts.map +1 -0
  275. package/script/src/server_types.js +2 -0
  276. package/script/src/server_ui_routes.d.ts +33 -0
  277. package/script/src/server_ui_routes.d.ts.map +1 -0
  278. package/script/src/server_ui_routes.js +172 -0
  279. package/script/src/session_artifacts.d.ts +22 -0
  280. package/script/src/session_artifacts.d.ts.map +1 -0
  281. package/script/src/session_artifacts.js +279 -0
  282. package/script/src/trace.d.ts.map +1 -1
  283. package/script/src/trace.js +6 -3
  284. package/script/src/workspace.d.ts +19 -0
  285. package/script/src/workspace.d.ts.map +1 -0
  286. package/script/src/workspace.js +201 -0
  287. package/script/src/workspace_contract.d.ts +76 -0
  288. package/script/src/workspace_contract.d.ts.map +1 -0
  289. package/script/src/workspace_contract.js +82 -0
@@ -0,0 +1,846 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ // Documentation and interface for walk were adapted from Go
3
+ // https://golang.org/pkg/path/filepath/#Walk
4
+ // Copyright 2009 The Go Authors. All rights reserved. BSD license.
5
+ import * as dntShim from "../../../../../_dnt.shims.js";
6
+ import { join } from "../../path/1.1.4/join.js";
7
+ import { toPathString } from "./_to_path_string.js";
8
+ import { createWalkEntry, createWalkEntrySync, } from "./_create_walk_entry.js";
9
+ function include(path, exts, match, skip) {
10
+ if (exts && !exts.some((ext) => path.endsWith(ext))) {
11
+ return false;
12
+ }
13
+ if (match && !match.some((pattern) => !!path.match(pattern))) {
14
+ return false;
15
+ }
16
+ if (skip && skip.some((pattern) => !!path.match(pattern))) {
17
+ return false;
18
+ }
19
+ return true;
20
+ }
21
+ /**
22
+ * Recursively walks through a directory and yields information about each file
23
+ * and directory encountered.
24
+ *
25
+ * The root path determines whether the file paths are relative or absolute.
26
+ * The root directory is included in the yielded entries.
27
+ *
28
+ * Requires `--allow-read` permission.
29
+ *
30
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
31
+ * for more information on Deno's permissions system.
32
+ *
33
+ * @param root The root directory to start the walk from, as a string or URL.
34
+ * @param options The options for the walk.
35
+ * @throws {Deno.errors.NotFound} If the root directory does not exist.
36
+ *
37
+ * @returns An async iterable iterator that yields the walk entry objects.
38
+ *
39
+ * @example Basic usage
40
+ *
41
+ * File structure:
42
+ * ```
43
+ * folder
44
+ * ├── script.ts
45
+ * └── foo.ts
46
+ * ```
47
+ *
48
+ * ```ts ignore
49
+ * import { walk } from "@std/fs/walk";
50
+ *
51
+ * await Array.fromAsync(walk("."));
52
+ * // [
53
+ * // {
54
+ * // path: ".",
55
+ * // name: ".",
56
+ * // isFile: false,
57
+ * // isDirectory: true,
58
+ * // isSymlink: false
59
+ * // },
60
+ * // {
61
+ * // path: "script.ts",
62
+ * // name: "script.ts",
63
+ * // isFile: true,
64
+ * // isDirectory: false,
65
+ * // isSymlink: false
66
+ * // },
67
+ * // {
68
+ * // path: "foo.ts",
69
+ * // name: "foo.ts",
70
+ * // isFile: true,
71
+ * // isDirectory: false,
72
+ * // isSymlink: false
73
+ * // },
74
+ * // ]
75
+ * ```
76
+ *
77
+ * @example Maximum file depth
78
+ *
79
+ * Setting the `maxDepth` option to `1` will only include the root directory and
80
+ * its immediate children.
81
+ *
82
+ * File structure:
83
+ * ```
84
+ * folder
85
+ * ├── script.ts
86
+ * └── foo
87
+ * └── bar.ts
88
+ * ```
89
+ *
90
+ * ```ts ignore
91
+ * import { walk } from "@std/fs/walk";
92
+ *
93
+ * await Array.fromAsync(walk(".", { maxDepth: 1 }));
94
+ * // [
95
+ * // {
96
+ * // path: ".",
97
+ * // name: ".",
98
+ * // isFile: false,
99
+ * // isDirectory: true,
100
+ * // isSymlink: false
101
+ * // },
102
+ * // {
103
+ * // path: "script.ts",
104
+ * // name: "script.ts",
105
+ * // isFile: true,
106
+ * // isDirectory: false,
107
+ * // isSymlink: false
108
+ * // },
109
+ * // {
110
+ * // path: "foo",
111
+ * // name: "foo",
112
+ * // isFile: false,
113
+ * // isDirectory: true,
114
+ * // isSymlink: false
115
+ * // },
116
+ * // ]
117
+ * ```
118
+ *
119
+ * @example Exclude files
120
+ *
121
+ * Setting the `includeFiles` option to `false` will exclude files.
122
+ *
123
+ * File structure:
124
+ * ```
125
+ * folder
126
+ * ├── script.ts
127
+ * └── foo
128
+ * ```
129
+ *
130
+ * ```ts ignore
131
+ * import { walk } from "@std/fs/walk";
132
+ *
133
+ * await Array.fromAsync(walk(".", { includeFiles: false }));
134
+ * // [
135
+ * // {
136
+ * // path: ".",
137
+ * // name: ".",
138
+ * // isFile: false,
139
+ * // isDirectory: true,
140
+ * // isSymlink: false
141
+ * // },
142
+ * // {
143
+ * // path: "foo",
144
+ * // name: "foo",
145
+ * // isFile: false,
146
+ * // isDirectory: true,
147
+ * // isSymlink: false,
148
+ * // },
149
+ * // ]
150
+ * ```
151
+ *
152
+ * @example Exclude directories
153
+ *
154
+ * Setting the `includeDirs` option to `false` will exclude directories.
155
+ *
156
+ * File structure:
157
+ * ```
158
+ * folder
159
+ * ├── script.ts
160
+ * └── foo
161
+ * ```
162
+ *
163
+ * ```ts ignore
164
+ * import { walk } from "@std/fs/walk";
165
+ *
166
+ * await Array.fromAsync(walk(".", { includeDirs: false }));
167
+ * // [
168
+ * // {
169
+ * // path: "script.ts",
170
+ * // name: "script.ts",
171
+ * // isFile: true,
172
+ * // isDirectory: false,
173
+ * // isSymlink: false
174
+ * // },
175
+ * // ]
176
+ * ```
177
+ *
178
+ * @example Exclude symbolic links
179
+ *
180
+ * Setting the `includeSymlinks` option to `false` will exclude symbolic links.
181
+ *
182
+ * File structure:
183
+ * ```
184
+ * folder
185
+ * ├── script.ts
186
+ * ├── foo
187
+ * └── link -> script.ts (symbolic link)
188
+ * ```
189
+ *
190
+ * ```ts ignore
191
+ * import { walk } from "@std/fs/walk";
192
+ *
193
+ * await Array.fromAsync(walk(".", { includeSymlinks: false }));
194
+ * // [
195
+ * // {
196
+ * // path: ".",
197
+ * // name: ".",
198
+ * // isFile: false,
199
+ * // isDirectory: true,
200
+ * // isSymlink: false
201
+ * // },
202
+ * // {
203
+ * // path: "script.ts",
204
+ * // name: "script.ts",
205
+ * // isFile: true,
206
+ * // isDirectory: false,
207
+ * // isSymlink: false
208
+ * // },
209
+ * // ]
210
+ * ```
211
+ *
212
+ * @example Follow symbolic links
213
+ *
214
+ * Setting the `followSymlinks` option to `true` will follow symbolic links,
215
+ * affecting the `path` property of the walk entry.
216
+ *
217
+ * File structure:
218
+ * ```
219
+ * folder
220
+ * ├── script.ts
221
+ * └── link -> script.ts (symbolic link)
222
+ * ```
223
+ *
224
+ * ```ts ignore
225
+ * import { walk } from "@std/fs/walk";
226
+ *
227
+ * await Array.fromAsync(walk(".", { followSymlinks: true }));
228
+ * // [
229
+ * // {
230
+ * // path: ".",
231
+ * // name: ".",
232
+ * // isFile: false,
233
+ * // isDirectory: true,
234
+ * // isSymlink: false
235
+ * // },
236
+ * // {
237
+ * // path: "script.ts",
238
+ * // name: "script.ts",
239
+ * // isFile: true,
240
+ * // isDirectory: false,
241
+ * // isSymlink: false
242
+ * // },
243
+ * // {
244
+ * // path: "script.ts",
245
+ * // name: "link",
246
+ * // isFile: true,
247
+ * // isDirectory: false,
248
+ * // isSymlink: true
249
+ * // },
250
+ * // ]
251
+ * ```
252
+ *
253
+ * @example Canonicalize symbolic links
254
+ *
255
+ * Setting the `canonicalize` option to `false` will canonicalize the path of
256
+ * the followed symbolic link. Meaning, the `path` property of the walk entry
257
+ * will be the path of the symbolic link itself.
258
+ *
259
+ * File structure:
260
+ * ```
261
+ * folder
262
+ * ├── script.ts
263
+ * └── link -> script.ts (symbolic link)
264
+ * ```
265
+ *
266
+ * ```ts ignore
267
+ * import { walk } from "@std/fs/walk";
268
+ *
269
+ * await Array.fromAsync(walk(".", { followSymlinks: true, canonicalize: true }));
270
+ * // [
271
+ * // {
272
+ * // path: ".",
273
+ * // name: ".",
274
+ * // isFile: false,
275
+ * // isDirectory: true,
276
+ * // isSymlink: false
277
+ * // },
278
+ * // {
279
+ * // path: "script.ts",
280
+ * // name: "script.ts",
281
+ * // isFile: true,
282
+ * // isDirectory: false,
283
+ * // isSymlink: false
284
+ * // },
285
+ * // {
286
+ * // path: "link",
287
+ * // name: "link",
288
+ * // isFile: true,
289
+ * // isDirectory: false,
290
+ * // isSymlink: true
291
+ * // },
292
+ * // ]
293
+ * ```
294
+ *
295
+ * @example Filter by file extensions
296
+ *
297
+ * Setting the `exts` option to `[".ts"]` or `["ts"]` will only include entries
298
+ * with the `.ts` file extension.
299
+ *
300
+ * File structure:
301
+ * ```
302
+ * folder
303
+ * ├── script.ts
304
+ * └── foo.js
305
+ * ```
306
+ *
307
+ * ```ts ignore
308
+ * import { walk } from "@std/fs/walk";
309
+ *
310
+ * await Array.fromAsync(walk(".", { exts: [".ts"] }));
311
+ * // [
312
+ * // {
313
+ * // path: "script.ts",
314
+ * // name: "script.ts",
315
+ * // isFile: true,
316
+ * // isDirectory: false,
317
+ * // isSymlink: false
318
+ * // },
319
+ * // ]
320
+ * ```
321
+ *
322
+ * @example Filter by regular expressions
323
+ *
324
+ * Setting the `match` option to `[/s/]` will only include entries with the
325
+ * letter `s` in their name.
326
+ *
327
+ * File structure:
328
+ * ```
329
+ * folder
330
+ * ├── script.ts
331
+ * └── README.md
332
+ * ```
333
+ *
334
+ * ```ts ignore
335
+ * import { walk } from "@std/fs/walk";
336
+ *
337
+ * await Array.fromAsync(walk(".", { match: [/s/] }));
338
+ * // [
339
+ * // {
340
+ * // path: "script.ts",
341
+ * // name: "script.ts",
342
+ * // isFile: true,
343
+ * // isDirectory: false,
344
+ * // isSymlink: false
345
+ * // },
346
+ * // ]
347
+ * ```
348
+ *
349
+ * @example Exclude by regular expressions
350
+ *
351
+ * Setting the `skip` option to `[/s/]` will exclude entries with the letter
352
+ * `s` in their name.
353
+ *
354
+ * File structure:
355
+ * ```
356
+ * folder
357
+ * ├── script.ts
358
+ * └── README.md
359
+ * ```
360
+ *
361
+ * ```ts ignore
362
+ * import { walk } from "@std/fs/walk";
363
+ *
364
+ * await Array.fromAsync(walk(".", { skip: [/s/] }));
365
+ * // [
366
+ * // {
367
+ * // path: "README.md",
368
+ * // name: "README.md",
369
+ * // isFile: true,
370
+ * // isDirectory: false,
371
+ * // isSymlink: false
372
+ * // },
373
+ * // ]
374
+ * ```
375
+ */
376
+ export async function* walk(root, options) {
377
+ let { maxDepth = Infinity, includeFiles = true, includeDirs = true, includeSymlinks = true, followSymlinks = false, canonicalize = true, exts = undefined, match = undefined, skip = undefined, } = options ?? {};
378
+ if (maxDepth < 0) {
379
+ return;
380
+ }
381
+ root = toPathString(root);
382
+ if (exts) {
383
+ exts = exts.map((ext) => ext.startsWith(".") ? ext : `.${ext}`);
384
+ }
385
+ if (includeDirs && include(root, exts, match, skip)) {
386
+ yield await createWalkEntry(root);
387
+ }
388
+ if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
389
+ return;
390
+ }
391
+ for await (const entry of dntShim.Deno.readDir(root)) {
392
+ let path = join(root, entry.name);
393
+ let { isSymlink, isDirectory } = entry;
394
+ if (isSymlink) {
395
+ if (!followSymlinks) {
396
+ if (includeSymlinks && include(path, exts, match, skip)) {
397
+ yield { path, ...entry };
398
+ }
399
+ continue;
400
+ }
401
+ const realPath = await dntShim.Deno.realPath(path);
402
+ if (canonicalize) {
403
+ path = realPath;
404
+ }
405
+ // Caveat emptor: don't assume |path| is not a symlink. realpath()
406
+ // resolves symlinks but another process can replace the file system
407
+ // entity with a different type of entity before we call lstat().
408
+ ({ isSymlink, isDirectory } = await dntShim.Deno.lstat(realPath));
409
+ }
410
+ if (isSymlink || isDirectory) {
411
+ const opts = {
412
+ maxDepth: maxDepth - 1,
413
+ includeFiles,
414
+ includeDirs,
415
+ includeSymlinks,
416
+ followSymlinks,
417
+ };
418
+ if (exts !== undefined) {
419
+ opts.exts = exts;
420
+ }
421
+ if (match !== undefined) {
422
+ opts.match = match;
423
+ }
424
+ if (skip !== undefined) {
425
+ opts.skip = skip;
426
+ }
427
+ yield* walk(path, opts);
428
+ }
429
+ else if (includeFiles && include(path, exts, match, skip)) {
430
+ yield { path, ...entry };
431
+ }
432
+ }
433
+ }
434
+ /**
435
+ * Recursively walks through a directory and yields information about each file
436
+ * and directory encountered.
437
+ *
438
+ * The root path determines whether the file paths is relative or absolute.
439
+ * The root directory is included in the yielded entries.
440
+ *
441
+ * Requires `--allow-read` permission.
442
+ *
443
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
444
+ * for more information on Deno's permissions system.
445
+ *
446
+ * @param root The root directory to start the walk from, as a string or URL.
447
+ * @param options The options for the walk.
448
+ *
449
+ * @returns A synchronous iterable iterator that yields the walk entry objects.
450
+ *
451
+ * @example Basic usage
452
+ *
453
+ * File structure:
454
+ * ```
455
+ * folder
456
+ * ├── script.ts
457
+ * └── foo.ts
458
+ * ```
459
+ *
460
+ * ```ts ignore
461
+ * import { walkSync } from "@std/fs/walk";
462
+ *
463
+ * Array.from(walkSync("."));
464
+ * // [
465
+ * // {
466
+ * // path: ".",
467
+ * // name: ".",
468
+ * // isFile: false,
469
+ * // isDirectory: true,
470
+ * // isSymlink: false
471
+ * // },
472
+ * // {
473
+ * // path: "script.ts",
474
+ * // name: "script.ts",
475
+ * // isFile: true,
476
+ * // isDirectory: false,
477
+ * // isSymlink: false
478
+ * // },
479
+ * // {
480
+ * // path: "foo.ts",
481
+ * // name: "foo.ts",
482
+ * // isFile: true,
483
+ * // isDirectory: false,
484
+ * // isSymlink: false
485
+ * // },
486
+ * // ]
487
+ * ```
488
+ *
489
+ * @example Maximum file depth
490
+ *
491
+ * Setting the `maxDepth` option to `1` will only include the root directory and
492
+ * its immediate children.
493
+ *
494
+ * File structure:
495
+ * ```
496
+ * folder
497
+ * ├── script.ts
498
+ * └── foo
499
+ * └── bar.ts
500
+ * ```
501
+ *
502
+ * ```ts ignore
503
+ * import { walkSync } from "@std/fs/walk";
504
+ *
505
+ * Array.from(walkSync(".", { maxDepth: 1 }));
506
+ * // [
507
+ * // {
508
+ * // path: ".",
509
+ * // name: ".",
510
+ * // isFile: false,
511
+ * // isDirectory: true,
512
+ * // isSymlink: false
513
+ * // },
514
+ * // {
515
+ * // path: "script.ts",
516
+ * // name: "script.ts",
517
+ * // isFile: true,
518
+ * // isDirectory: false,
519
+ * // isSymlink: false
520
+ * // },
521
+ * // {
522
+ * // path: "foo",
523
+ * // name: "foo",
524
+ * // isFile: false,
525
+ * // isDirectory: true,
526
+ * // isSymlink: false
527
+ * // },
528
+ * // ]
529
+ * ```
530
+ *
531
+ * @example Exclude files
532
+ *
533
+ * Setting the `includeFiles` option to `false` will exclude files.
534
+ *
535
+ * File structure:
536
+ * ```
537
+ * folder
538
+ * ├── script.ts
539
+ * └── foo
540
+ * ```
541
+ *
542
+ * ```ts ignore
543
+ * import { walkSync } from "@std/fs/walk";
544
+ *
545
+ * Array.from(walkSync(".", { includeFiles: false }));
546
+ * // [
547
+ * // {
548
+ * // path: ".",
549
+ * // name: ".",
550
+ * // isFile: false,
551
+ * // isDirectory: true,
552
+ * // isSymlink: false
553
+ * // },
554
+ * // {
555
+ * // path: "foo",
556
+ * // name: "foo",
557
+ * // isFile: false,
558
+ * // isDirectory: true,
559
+ * // isSymlink: false,
560
+ * // },
561
+ * // ]
562
+ * ```
563
+ *
564
+ * @example Exclude directories
565
+ *
566
+ * Setting the `includeDirs` option to `false` will exclude directories.
567
+ *
568
+ * File structure:
569
+ * ```
570
+ * folder
571
+ * ├── script.ts
572
+ * └── foo
573
+ * ```
574
+ *
575
+ * ```ts ignore
576
+ * import { walkSync } from "@std/fs/walk";
577
+ *
578
+ * Array.from(walkSync(".", { includeDirs: false }));
579
+ * // [
580
+ * // {
581
+ * // path: "script.ts",
582
+ * // name: "script.ts",
583
+ * // isFile: true,
584
+ * // isDirectory: false,
585
+ * // isSymlink: false
586
+ * // },
587
+ * // ]
588
+ * ```
589
+ *
590
+ * @example Exclude symbolic links
591
+ *
592
+ * Setting the `includeSymlinks` option to `false` will exclude symbolic links.
593
+ *
594
+ * File structure:
595
+ * ```
596
+ * folder
597
+ * ├── script.ts
598
+ * ├── foo
599
+ * └── link -> script.ts (symbolic link)
600
+ * ```
601
+ *
602
+ * ```ts ignore
603
+ * import { walkSync } from "@std/fs/walk";
604
+ *
605
+ * Array.from(walkSync(".", { includeSymlinks: false }));
606
+ * // [
607
+ * // {
608
+ * // path: ".",
609
+ * // name: ".",
610
+ * // isFile: false,
611
+ * // isDirectory: true,
612
+ * // isSymlink: false
613
+ * // },
614
+ * // {
615
+ * // path: "script.ts",
616
+ * // name: "script.ts",
617
+ * // isFile: true,
618
+ * // isDirectory: false,
619
+ * // isSymlink: false
620
+ * // },
621
+ * // ]
622
+ * ```
623
+ *
624
+ * @example Follow symbolic links
625
+ *
626
+ * Setting the `followSymlinks` option to `true` will follow symbolic links,
627
+ * affecting the `path` property of the walk entry.
628
+ *
629
+ * File structure:
630
+ * ```
631
+ * folder
632
+ * ├── script.ts
633
+ * └── link -> script.ts (symbolic link)
634
+ * ```
635
+ *
636
+ * ```ts ignore
637
+ * import { walkSync } from "@std/fs/walk";
638
+ *
639
+ * Array.from(walkSync(".", { followSymlinks: true }));
640
+ * // [
641
+ * // {
642
+ * // path: ".",
643
+ * // name: ".",
644
+ * // isFile: false,
645
+ * // isDirectory: true,
646
+ * // isSymlink: false
647
+ * // },
648
+ * // {
649
+ * // path: "script.ts",
650
+ * // name: "script.ts",
651
+ * // isFile: true,
652
+ * // isDirectory: false,
653
+ * // isSymlink: false
654
+ * // },
655
+ * // {
656
+ * // path: "script.ts",
657
+ * // name: "link",
658
+ * // isFile: true,
659
+ * // isDirectory: false,
660
+ * // isSymlink: true
661
+ * // },
662
+ * // ]
663
+ * ```
664
+ *
665
+ * @example Canonicalize symbolic links
666
+ *
667
+ * Setting the `canonicalize` option to `false` will canonicalize the path of
668
+ * the followed symbolic link. Meaning, the `path` property of the walk entry
669
+ * will be the path of the symbolic link itself.
670
+ *
671
+ * File structure:
672
+ * ```
673
+ * folder
674
+ * ├── script.ts
675
+ * └── link -> script.ts (symbolic link)
676
+ * ```
677
+ *
678
+ * ```ts ignore
679
+ * import { walkSync } from "@std/fs/walk";
680
+ *
681
+ * Array.from(walkSync(".", { followSymlinks: true, canonicalize: true }));
682
+ * // [
683
+ * // {
684
+ * // path: ".",
685
+ * // name: ".",
686
+ * // isFile: false,
687
+ * // isDirectory: true,
688
+ * // isSymlink: false
689
+ * // },
690
+ * // {
691
+ * // path: "script.ts",
692
+ * // name: "script.ts",
693
+ * // isFile: true,
694
+ * // isDirectory: false,
695
+ * // isSymlink: false
696
+ * // },
697
+ * // {
698
+ * // path: "link",
699
+ * // name: "link",
700
+ * // isFile: true,
701
+ * // isDirectory: false,
702
+ * // isSymlink: true
703
+ * // },
704
+ * // ]
705
+ * ```
706
+ *
707
+ * @example Filter by file extensions
708
+ *
709
+ * Setting the `exts` option to `[".ts"]` or `["ts"]` will only include entries
710
+ * with the `.ts` file extension.
711
+ *
712
+ * File structure:
713
+ * ```
714
+ * folder
715
+ * ├── script.ts
716
+ * └── foo.js
717
+ * ```
718
+ *
719
+ * ```ts ignore
720
+ * import { walkSync } from "@std/fs/walk";
721
+ *
722
+ * Array.from(walkSync(".", { exts: [".ts"] }));
723
+ * // [
724
+ * // {
725
+ * // path: "script.ts",
726
+ * // name: "script.ts",
727
+ * // isFile: true,
728
+ * // isDirectory: false,
729
+ * // isSymlink: false
730
+ * // },
731
+ * // ]
732
+ * ```
733
+ *
734
+ * @example Filter by regular expressions
735
+ *
736
+ * Setting the `match` option to `[/s/]` will only include entries with the
737
+ * letter `s` in their name.
738
+ *
739
+ * File structure:
740
+ * ```
741
+ * folder
742
+ * ├── script.ts
743
+ * └── README.md
744
+ * ```
745
+ *
746
+ * ```ts ignore
747
+ * import { walkSync } from "@std/fs/walk";
748
+ *
749
+ * Array.from(walkSync(".", { match: [/s/] }));
750
+ * // [
751
+ * // {
752
+ * // path: "script.ts",
753
+ * // name: "script.ts",
754
+ * // isFile: true,
755
+ * // isDirectory: false,
756
+ * // isSymlink: false
757
+ * // },
758
+ * // ]
759
+ * ```
760
+ *
761
+ * @example Exclude by regular expressions
762
+ *
763
+ * Setting the `skip` option to `[/s/]` will exclude entries with the letter
764
+ * `s` in their name.
765
+ *
766
+ * File structure:
767
+ * ```
768
+ * folder
769
+ * ├── script.ts
770
+ * └── README.md
771
+ * ```
772
+ *
773
+ * ```ts ignore
774
+ * import { walkSync } from "@std/fs/walk";
775
+ *
776
+ * Array.from(walkSync(".", { skip: [/s/] }));
777
+ * // [
778
+ * // {
779
+ * // path: "README.md",
780
+ * // name: "README.md",
781
+ * // isFile: true,
782
+ * // isDirectory: false,
783
+ * // isSymlink: false
784
+ * // },
785
+ * // ]
786
+ * ```
787
+ */
788
+ export function* walkSync(root, options) {
789
+ let { maxDepth = Infinity, includeFiles = true, includeDirs = true, includeSymlinks = true, followSymlinks = false, canonicalize = true, exts = undefined, match = undefined, skip = undefined, } = options ?? {};
790
+ root = toPathString(root);
791
+ if (exts) {
792
+ exts = exts.map((ext) => ext.startsWith(".") ? ext : `.${ext}`);
793
+ }
794
+ if (maxDepth < 0) {
795
+ return;
796
+ }
797
+ if (includeDirs && include(root, exts, match, skip)) {
798
+ yield createWalkEntrySync(root);
799
+ }
800
+ if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
801
+ return;
802
+ }
803
+ const entries = dntShim.Deno.readDirSync(root);
804
+ for (const entry of entries) {
805
+ let path = join(root, entry.name);
806
+ let { isSymlink, isDirectory } = entry;
807
+ if (isSymlink) {
808
+ if (!followSymlinks) {
809
+ if (includeSymlinks && include(path, exts, match, skip)) {
810
+ yield { path, ...entry };
811
+ }
812
+ continue;
813
+ }
814
+ const realPath = dntShim.Deno.realPathSync(path);
815
+ if (canonicalize) {
816
+ path = realPath;
817
+ }
818
+ // Caveat emptor: don't assume |path| is not a symlink. realpath()
819
+ // resolves symlinks but another process can replace the file system
820
+ // entity with a different type of entity before we call lstat().
821
+ ({ isSymlink, isDirectory } = dntShim.Deno.lstatSync(realPath));
822
+ }
823
+ if (isSymlink || isDirectory) {
824
+ const opts = {
825
+ maxDepth: maxDepth - 1,
826
+ includeFiles,
827
+ includeDirs,
828
+ includeSymlinks,
829
+ followSymlinks,
830
+ };
831
+ if (exts !== undefined) {
832
+ opts.exts = exts;
833
+ }
834
+ if (match !== undefined) {
835
+ opts.match = match;
836
+ }
837
+ if (skip !== undefined) {
838
+ opts.skip = skip;
839
+ }
840
+ yield* walkSync(path, opts);
841
+ }
842
+ else if (includeFiles && include(path, exts, match, skip)) {
843
+ yield { path, ...entry };
844
+ }
845
+ }
846
+ }