track-cli 3.0.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +3 -0
  3. package/esm/_dnt.polyfills.d.ts +6 -0
  4. package/esm/_dnt.polyfills.js +1 -0
  5. package/esm/_dnt.shims.d.ts +19 -0
  6. package/esm/_dnt.shims.js +78 -0
  7. package/esm/deps/deno.land/std@0.170.0/fmt/colors.d.ts +270 -0
  8. package/esm/deps/deno.land/std@0.170.0/fmt/colors.js +473 -0
  9. package/esm/deps/deno.land/std@0.195.0/_util/os.d.ts +4 -0
  10. package/esm/deps/deno.land/std@0.195.0/_util/os.js +18 -0
  11. package/esm/deps/deno.land/std@0.195.0/assert/assert.d.ts +2 -0
  12. package/esm/deps/deno.land/std@0.195.0/assert/assert.js +8 -0
  13. package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.d.ts +4 -0
  14. package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.js +12 -0
  15. package/esm/deps/deno.land/std@0.195.0/datetime/_common.d.ts +50 -0
  16. package/esm/deps/deno.land/std@0.195.0/datetime/_common.js +545 -0
  17. package/esm/deps/deno.land/std@0.195.0/datetime/constants.d.ts +55 -0
  18. package/esm/deps/deno.land/std@0.195.0/datetime/constants.js +57 -0
  19. package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.d.ts +26 -0
  20. package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.js +45 -0
  21. package/esm/deps/deno.land/std@0.195.0/datetime/difference.d.ts +38 -0
  22. package/esm/deps/deno.land/std@0.195.0/datetime/difference.js +93 -0
  23. package/esm/deps/deno.land/std@0.195.0/datetime/format.d.ts +22 -0
  24. package/esm/deps/deno.land/std@0.195.0/datetime/format.js +28 -0
  25. package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.d.ts +49 -0
  26. package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.js +60 -0
  27. package/esm/deps/deno.land/std@0.195.0/datetime/mod.d.ts +43 -0
  28. package/esm/deps/deno.land/std@0.195.0/datetime/mod.js +45 -0
  29. package/esm/deps/deno.land/std@0.195.0/datetime/parse.d.ts +21 -0
  30. package/esm/deps/deno.land/std@0.195.0/datetime/parse.js +29 -0
  31. package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.d.ts +17 -0
  32. package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.js +44 -0
  33. package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.d.ts +13 -0
  34. package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.js +38 -0
  35. package/esm/deps/deno.land/std@0.195.0/fmt/colors.d.ts +270 -0
  36. package/esm/deps/deno.land/std@0.195.0/fmt/colors.js +474 -0
  37. package/esm/deps/deno.land/std@0.195.0/fmt/duration.d.ts +15 -0
  38. package/esm/deps/deno.land/std@0.195.0/fmt/duration.js +96 -0
  39. package/esm/deps/deno.land/std@0.195.0/fs/_util.d.ts +35 -0
  40. package/esm/deps/deno.land/std@0.195.0/fs/_util.js +80 -0
  41. package/esm/deps/deno.land/std@0.195.0/fs/copy.d.ts +51 -0
  42. package/esm/deps/deno.land/std@0.195.0/fs/copy.js +244 -0
  43. package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.d.ts +31 -0
  44. package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.js +74 -0
  45. package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.d.ts +27 -0
  46. package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.js +55 -0
  47. package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.d.ts +33 -0
  48. package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.js +75 -0
  49. package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.d.ts +31 -0
  50. package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.js +43 -0
  51. package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.d.ts +17 -0
  52. package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.js +68 -0
  53. package/esm/deps/deno.land/std@0.195.0/fs/eol.d.ts +40 -0
  54. package/esm/deps/deno.land/std@0.195.0/fs/eol.js +53 -0
  55. package/esm/deps/deno.land/std@0.195.0/fs/exists.d.ts +102 -0
  56. package/esm/deps/deno.land/std@0.195.0/fs/exists.js +163 -0
  57. package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.d.ts +37 -0
  58. package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.js +216 -0
  59. package/esm/deps/deno.land/std@0.195.0/fs/mod.d.ts +16 -0
  60. package/esm/deps/deno.land/std@0.195.0/fs/mod.js +17 -0
  61. package/esm/deps/deno.land/std@0.195.0/fs/move.d.ts +29 -0
  62. package/esm/deps/deno.land/std@0.195.0/fs/move.js +88 -0
  63. package/esm/deps/deno.land/std@0.195.0/fs/walk.d.ts +40 -0
  64. package/esm/deps/deno.land/std@0.195.0/fs/walk.js +158 -0
  65. package/esm/deps/deno.land/std@0.195.0/path/_constants.d.ts +39 -0
  66. package/esm/deps/deno.land/std@0.195.0/path/_constants.js +46 -0
  67. package/esm/deps/deno.land/std@0.195.0/path/_interface.d.ts +26 -0
  68. package/esm/deps/deno.land/std@0.195.0/path/_interface.js +3 -0
  69. package/esm/deps/deno.land/std@0.195.0/path/_util.d.ts +11 -0
  70. package/esm/deps/deno.land/std@0.195.0/path/_util.js +161 -0
  71. package/esm/deps/deno.land/std@0.195.0/path/common.d.ts +13 -0
  72. package/esm/deps/deno.land/std@0.195.0/path/common.js +36 -0
  73. package/esm/deps/deno.land/std@0.195.0/path/glob.d.ts +83 -0
  74. package/esm/deps/deno.land/std@0.195.0/path/glob.js +361 -0
  75. package/esm/deps/deno.land/std@0.195.0/path/mod.d.ts +9 -0
  76. package/esm/deps/deno.land/std@0.195.0/path/mod.js +33 -0
  77. package/esm/deps/deno.land/std@0.195.0/path/posix.d.ts +86 -0
  78. package/esm/deps/deno.land/std@0.195.0/path/posix.js +442 -0
  79. package/esm/deps/deno.land/std@0.195.0/path/separator.d.ts +2 -0
  80. package/esm/deps/deno.land/std@0.195.0/path/separator.js +5 -0
  81. package/esm/deps/deno.land/std@0.195.0/path/win32.d.ts +91 -0
  82. package/esm/deps/deno.land/std@0.195.0/path/win32.js +909 -0
  83. package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.d.ts +1 -0
  84. package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.js +26 -0
  85. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.d.ts +76 -0
  86. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.js +154 -0
  87. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.d.ts +32 -0
  88. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.js +105 -0
  89. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.d.ts +831 -0
  90. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.js +1701 -0
  91. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.d.ts +17 -0
  92. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.js +201 -0
  93. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.d.ts +14 -0
  94. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.js +141 -0
  95. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.d.ts +21 -0
  96. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.js +285 -0
  97. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.d.ts +6 -0
  98. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.js +38 -0
  99. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.d.ts +8 -0
  100. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.js +32 -0
  101. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.d.ts +6 -0
  102. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.js +38 -0
  103. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.d.ts +6 -0
  104. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.js +46 -0
  105. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.d.ts +6 -0
  106. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.js +38 -0
  107. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.d.ts +45 -0
  108. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.js +2 -0
  109. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.d.ts +1 -0
  110. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.js +1 -0
  111. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.d.ts +27 -0
  112. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.js +323 -0
  113. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.d.ts +6 -0
  114. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.js +34 -0
  115. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.d.ts +18 -0
  116. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.js +17 -0
  117. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.d.ts +41 -0
  118. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.js +24 -0
  119. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.d.ts +9 -0
  120. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.js +20 -0
  121. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.d.ts +9 -0
  122. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.js +13 -0
  123. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.d.ts +9 -0
  124. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.js +27 -0
  125. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.d.ts +7 -0
  126. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.js +9 -0
  127. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.d.ts +10 -0
  128. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.js +29 -0
  129. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.d.ts +5 -0
  130. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.js +12 -0
  131. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.d.ts +7 -0
  132. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.js +9 -0
  133. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.d.ts +7 -0
  134. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.js +9 -0
  135. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.d.ts +7 -0
  136. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.js +9 -0
  137. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.d.ts +118 -0
  138. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.js +2 -0
  139. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.d.ts +5 -0
  140. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.js +5 -0
  141. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.d.ts +14 -0
  142. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.js +46 -0
  143. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.d.ts +26 -0
  144. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.js +118 -0
  145. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.d.ts +14 -0
  146. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.js +55 -0
  147. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.d.ts +27 -0
  148. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.js +102 -0
  149. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.d.ts +17 -0
  150. package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.js +75 -0
  151. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.d.ts +60 -0
  152. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.js +117 -0
  153. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.d.ts +18 -0
  154. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.js +106 -0
  155. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.d.ts +10 -0
  156. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.js +157 -0
  157. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.d.ts +24 -0
  158. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.js +9 -0
  159. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.d.ts +33 -0
  160. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.js +402 -0
  161. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.d.ts +3 -0
  162. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.js +11 -0
  163. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.d.ts +3 -0
  164. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.js +9 -0
  165. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.d.ts +3 -0
  166. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.js +9 -0
  167. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.d.ts +3 -0
  168. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.js +4 -0
  169. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.d.ts +59 -0
  170. package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.js +1 -0
  171. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.d.ts +20 -0
  172. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.js +18 -0
  173. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.d.ts +78 -0
  174. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.js +128 -0
  175. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.d.ts +1 -0
  176. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.js +1 -0
  177. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.d.ts +99 -0
  178. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.js +529 -0
  179. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.d.ts +49 -0
  180. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.js +74 -0
  181. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.d.ts +135 -0
  182. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.js +237 -0
  183. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.d.ts +13 -0
  184. package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.js +60 -0
  185. package/esm/package.json +3 -0
  186. package/esm/src/action/add.d.ts +1 -0
  187. package/esm/src/action/add.js +57 -0
  188. package/esm/src/action/clone.d.ts +6 -0
  189. package/esm/src/action/clone.js +108 -0
  190. package/esm/src/action/lang.d.ts +1 -0
  191. package/esm/src/action/lang.js +40 -0
  192. package/esm/src/action/pull.d.ts +1 -0
  193. package/esm/src/action/pull.js +22 -0
  194. package/esm/src/action/remove.d.ts +4 -0
  195. package/esm/src/action/remove.js +67 -0
  196. package/esm/src/action/reset.d.ts +1 -0
  197. package/esm/src/action/reset.js +21 -0
  198. package/esm/src/action/run.d.ts +4 -0
  199. package/esm/src/action/run.js +163 -0
  200. package/esm/src/action/status.d.ts +1 -0
  201. package/esm/src/action/status.js +5 -0
  202. package/esm/src/main.d.ts +2 -0
  203. package/esm/src/main.js +96 -0
  204. package/esm/src/meta.d.ts +3 -0
  205. package/esm/src/meta.js +51 -0
  206. package/esm/src/orca/client.d.ts +20 -0
  207. package/esm/src/orca/client.js +152 -0
  208. package/esm/src/orca/types.d.ts +54 -0
  209. package/esm/src/orca/types.js +12 -0
  210. package/esm/src/shared/config.d.ts +24 -0
  211. package/esm/src/shared/config.js +24 -0
  212. package/esm/src/shared/errors.d.ts +82 -0
  213. package/esm/src/shared/errors.js +228 -0
  214. package/esm/src/shared/file.d.ts +30 -0
  215. package/esm/src/shared/file.js +110 -0
  216. package/esm/src/shared/mod.d.ts +40 -0
  217. package/esm/src/shared/mod.js +383 -0
  218. package/esm/src/shared/types.d.ts +12 -0
  219. package/esm/src/shared/types.js +1 -0
  220. package/esm/src/track/client.d.ts +60 -0
  221. package/esm/src/track/client.js +268 -0
  222. package/esm/src/track/types.d.ts +210 -0
  223. package/esm/src/track/types.js +40 -0
  224. package/package.json +35 -0
@@ -0,0 +1,51 @@
1
+ /// <reference types="node" />
2
+ export interface CopyOptions {
3
+ /**
4
+ * overwrite existing file or directory.
5
+ * @default {false}
6
+ */
7
+ overwrite?: boolean;
8
+ /**
9
+ * When `true`, will set last modification and access times to the ones of the
10
+ * original source files.
11
+ * When `false`, timestamp behavior is OS-dependent.
12
+ *
13
+ * @default {false}
14
+ */
15
+ preserveTimestamps?: boolean;
16
+ }
17
+ /**
18
+ * Copy a file or directory. The directory can have contents. Like `cp -r`.
19
+ * Requires the `--allow-read` and `--allow-write` flag.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { copy } from "https://deno.land/std@$STD_VERSION/fs/copy.ts";
24
+ * copy("./foo", "./bar"); // returns a promise
25
+ * ```
26
+ *
27
+ * @param src the file/directory path.
28
+ * Note that if `src` is a directory it will copy everything inside
29
+ * of this directory, not the entire directory itself
30
+ * @param dest the destination path. Note that if `src` is a file, `dest` cannot
31
+ * be a directory
32
+ * @param options
33
+ */
34
+ export declare function copy(src: string | URL, dest: string | URL, options?: CopyOptions): Promise<void>;
35
+ /**
36
+ * Copy a file or directory. The directory can have contents. Like `cp -r`.
37
+ * Requires the `--allow-read` and `--allow-write` flag.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { copySync } from "https://deno.land/std@$STD_VERSION/fs/copy.ts";
42
+ * copySync("./foo", "./bar"); // void
43
+ * ```
44
+ * @param src the file/directory path.
45
+ * Note that if `src` is a directory it will copy everything inside
46
+ * of this directory, not the entire directory itself
47
+ * @param dest the destination path. Note that if `src` is a file, `dest` cannot
48
+ * be a directory
49
+ * @param options
50
+ */
51
+ export declare function copySync(src: string | URL, dest: string | URL, options?: CopyOptions): void;
@@ -0,0 +1,244 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ // @ts-nocheck Bypass static errors for missing --unstable.
4
+ import * as path from "../path/mod.js";
5
+ import { ensureDir, ensureDirSync } from "./ensure_dir.js";
6
+ import { getFileInfoType, isSubdir, toPathString } from "./_util.js";
7
+ import { assert } from "../assert/assert.js";
8
+ import { isWindows } from "../_util/os.js";
9
+ async function ensureValidCopy(src, dest, options) {
10
+ let destStat;
11
+ try {
12
+ destStat = await dntShim.Deno.lstat(dest);
13
+ }
14
+ catch (err) {
15
+ if (err instanceof dntShim.Deno.errors.NotFound) {
16
+ return;
17
+ }
18
+ throw err;
19
+ }
20
+ if (options.isFolder && !destStat.isDirectory) {
21
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
22
+ }
23
+ if (!options.overwrite) {
24
+ throw new dntShim.Deno.errors.AlreadyExists(`'${dest}' already exists.`);
25
+ }
26
+ return destStat;
27
+ }
28
+ function ensureValidCopySync(src, dest, options) {
29
+ let destStat;
30
+ try {
31
+ destStat = dntShim.Deno.lstatSync(dest);
32
+ }
33
+ catch (err) {
34
+ if (err instanceof dntShim.Deno.errors.NotFound) {
35
+ return;
36
+ }
37
+ throw err;
38
+ }
39
+ if (options.isFolder && !destStat.isDirectory) {
40
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
41
+ }
42
+ if (!options.overwrite) {
43
+ throw new dntShim.Deno.errors.AlreadyExists(`'${dest}' already exists.`);
44
+ }
45
+ return destStat;
46
+ }
47
+ /* copy file to dest */
48
+ async function copyFile(src, dest, options) {
49
+ await ensureValidCopy(src, dest, options);
50
+ await dntShim.Deno.copyFile(src, dest);
51
+ if (options.preserveTimestamps) {
52
+ const statInfo = await dntShim.Deno.stat(src);
53
+ assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
54
+ assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
55
+ await dntShim.Deno.utime(dest, statInfo.atime, statInfo.mtime);
56
+ }
57
+ }
58
+ /* copy file to dest synchronously */
59
+ function copyFileSync(src, dest, options) {
60
+ ensureValidCopySync(src, dest, options);
61
+ dntShim.Deno.copyFileSync(src, dest);
62
+ if (options.preserveTimestamps) {
63
+ const statInfo = dntShim.Deno.statSync(src);
64
+ assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
65
+ assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
66
+ dntShim.Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
67
+ }
68
+ }
69
+ /* copy symlink to dest */
70
+ async function copySymLink(src, dest, options) {
71
+ await ensureValidCopy(src, dest, options);
72
+ const originSrcFilePath = await dntShim.Deno.readLink(src);
73
+ const type = getFileInfoType(await dntShim.Deno.lstat(src));
74
+ if (isWindows) {
75
+ await dntShim.Deno.symlink(originSrcFilePath, dest, {
76
+ type: type === "dir" ? "dir" : "file",
77
+ });
78
+ }
79
+ else {
80
+ await dntShim.Deno.symlink(originSrcFilePath, dest);
81
+ }
82
+ if (options.preserveTimestamps) {
83
+ const statInfo = await dntShim.Deno.lstat(src);
84
+ assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
85
+ assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
86
+ await dntShim.Deno.utime(dest, statInfo.atime, statInfo.mtime);
87
+ }
88
+ }
89
+ /* copy symlink to dest synchronously */
90
+ function copySymlinkSync(src, dest, options) {
91
+ ensureValidCopySync(src, dest, options);
92
+ const originSrcFilePath = dntShim.Deno.readLinkSync(src);
93
+ const type = getFileInfoType(dntShim.Deno.lstatSync(src));
94
+ if (isWindows) {
95
+ dntShim.Deno.symlinkSync(originSrcFilePath, dest, {
96
+ type: type === "dir" ? "dir" : "file",
97
+ });
98
+ }
99
+ else {
100
+ dntShim.Deno.symlinkSync(originSrcFilePath, dest);
101
+ }
102
+ if (options.preserveTimestamps) {
103
+ const statInfo = dntShim.Deno.lstatSync(src);
104
+ assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
105
+ assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
106
+ dntShim.Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
107
+ }
108
+ }
109
+ /* copy folder from src to dest. */
110
+ async function copyDir(src, dest, options) {
111
+ const destStat = await ensureValidCopy(src, dest, {
112
+ ...options,
113
+ isFolder: true,
114
+ });
115
+ if (!destStat) {
116
+ await ensureDir(dest);
117
+ }
118
+ if (options.preserveTimestamps) {
119
+ const srcStatInfo = await dntShim.Deno.stat(src);
120
+ assert(srcStatInfo.atime instanceof Date, `statInfo.atime is unavailable`);
121
+ assert(srcStatInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
122
+ await dntShim.Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
123
+ }
124
+ src = toPathString(src);
125
+ dest = toPathString(dest);
126
+ for await (const entry of dntShim.Deno.readDir(src)) {
127
+ const srcPath = path.join(src, entry.name);
128
+ const destPath = path.join(dest, path.basename(srcPath));
129
+ if (entry.isSymlink) {
130
+ await copySymLink(srcPath, destPath, options);
131
+ }
132
+ else if (entry.isDirectory) {
133
+ await copyDir(srcPath, destPath, options);
134
+ }
135
+ else if (entry.isFile) {
136
+ await copyFile(srcPath, destPath, options);
137
+ }
138
+ }
139
+ }
140
+ /* copy folder from src to dest synchronously */
141
+ function copyDirSync(src, dest, options) {
142
+ const destStat = ensureValidCopySync(src, dest, {
143
+ ...options,
144
+ isFolder: true,
145
+ });
146
+ if (!destStat) {
147
+ ensureDirSync(dest);
148
+ }
149
+ if (options.preserveTimestamps) {
150
+ const srcStatInfo = dntShim.Deno.statSync(src);
151
+ assert(srcStatInfo.atime instanceof Date, `statInfo.atime is unavailable`);
152
+ assert(srcStatInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
153
+ dntShim.Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
154
+ }
155
+ src = toPathString(src);
156
+ dest = toPathString(dest);
157
+ for (const entry of dntShim.Deno.readDirSync(src)) {
158
+ assert(entry.name != null, "file.name must be set");
159
+ const srcPath = path.join(src, entry.name);
160
+ const destPath = path.join(dest, path.basename(srcPath));
161
+ if (entry.isSymlink) {
162
+ copySymlinkSync(srcPath, destPath, options);
163
+ }
164
+ else if (entry.isDirectory) {
165
+ copyDirSync(srcPath, destPath, options);
166
+ }
167
+ else if (entry.isFile) {
168
+ copyFileSync(srcPath, destPath, options);
169
+ }
170
+ }
171
+ }
172
+ /**
173
+ * Copy a file or directory. The directory can have contents. Like `cp -r`.
174
+ * Requires the `--allow-read` and `--allow-write` flag.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * import { copy } from "https://deno.land/std@$STD_VERSION/fs/copy.ts";
179
+ * copy("./foo", "./bar"); // returns a promise
180
+ * ```
181
+ *
182
+ * @param src the file/directory path.
183
+ * Note that if `src` is a directory it will copy everything inside
184
+ * of this directory, not the entire directory itself
185
+ * @param dest the destination path. Note that if `src` is a file, `dest` cannot
186
+ * be a directory
187
+ * @param options
188
+ */
189
+ export async function copy(src, dest, options = {}) {
190
+ src = path.resolve(toPathString(src));
191
+ dest = path.resolve(toPathString(dest));
192
+ if (src === dest) {
193
+ throw new Error("Source and destination cannot be the same.");
194
+ }
195
+ const srcStat = await dntShim.Deno.lstat(src);
196
+ if (srcStat.isDirectory && isSubdir(src, dest)) {
197
+ throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`);
198
+ }
199
+ if (srcStat.isSymlink) {
200
+ await copySymLink(src, dest, options);
201
+ }
202
+ else if (srcStat.isDirectory) {
203
+ await copyDir(src, dest, options);
204
+ }
205
+ else if (srcStat.isFile) {
206
+ await copyFile(src, dest, options);
207
+ }
208
+ }
209
+ /**
210
+ * Copy a file or directory. The directory can have contents. Like `cp -r`.
211
+ * Requires the `--allow-read` and `--allow-write` flag.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import { copySync } from "https://deno.land/std@$STD_VERSION/fs/copy.ts";
216
+ * copySync("./foo", "./bar"); // void
217
+ * ```
218
+ * @param src the file/directory path.
219
+ * Note that if `src` is a directory it will copy everything inside
220
+ * of this directory, not the entire directory itself
221
+ * @param dest the destination path. Note that if `src` is a file, `dest` cannot
222
+ * be a directory
223
+ * @param options
224
+ */
225
+ export function copySync(src, dest, options = {}) {
226
+ src = path.resolve(toPathString(src));
227
+ dest = path.resolve(toPathString(dest));
228
+ if (src === dest) {
229
+ throw new Error("Source and destination cannot be the same.");
230
+ }
231
+ const srcStat = dntShim.Deno.lstatSync(src);
232
+ if (srcStat.isDirectory && isSubdir(src, dest)) {
233
+ throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`);
234
+ }
235
+ if (srcStat.isSymlink) {
236
+ copySymlinkSync(src, dest, options);
237
+ }
238
+ else if (srcStat.isDirectory) {
239
+ copyDirSync(src, dest, options);
240
+ }
241
+ else if (srcStat.isFile) {
242
+ copyFileSync(src, dest, options);
243
+ }
244
+ }
@@ -0,0 +1,31 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures that a directory is empty.
4
+ * Deletes directory contents if the directory is not empty.
5
+ * If the directory does not exist, it is created.
6
+ * The directory itself is not deleted.
7
+ * Requires the `--allow-read` and `--allow-write` flag.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { emptyDir } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
12
+ *
13
+ * emptyDir("./foo"); // returns a promise
14
+ * ```
15
+ */
16
+ export declare function emptyDir(dir: string | URL): Promise<void>;
17
+ /**
18
+ * Ensures that a directory is empty.
19
+ * Deletes directory contents if the directory is not empty.
20
+ * If the directory does not exist, it is created.
21
+ * The directory itself is not deleted.
22
+ * Requires the `--allow-read` and `--allow-write` flag.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { emptyDirSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
27
+ *
28
+ * emptyDirSync("./foo"); // void
29
+ * ```
30
+ */
31
+ export declare function emptyDirSync(dir: string | URL): void;
@@ -0,0 +1,74 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import { join } from "../path/mod.js";
4
+ import { toPathString } from "./_util.js";
5
+ /**
6
+ * Ensures that a directory is empty.
7
+ * Deletes directory contents if the directory is not empty.
8
+ * If the directory does not exist, it is created.
9
+ * The directory itself is not deleted.
10
+ * Requires the `--allow-read` and `--allow-write` flag.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { emptyDir } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
15
+ *
16
+ * emptyDir("./foo"); // returns a promise
17
+ * ```
18
+ */
19
+ export async function emptyDir(dir) {
20
+ try {
21
+ const items = [];
22
+ for await (const dirEntry of dntShim.Deno.readDir(dir)) {
23
+ items.push(dirEntry);
24
+ }
25
+ while (items.length) {
26
+ const item = items.shift();
27
+ if (item && item.name) {
28
+ const filepath = join(toPathString(dir), item.name);
29
+ await dntShim.Deno.remove(filepath, { recursive: true });
30
+ }
31
+ }
32
+ }
33
+ catch (err) {
34
+ if (!(err instanceof dntShim.Deno.errors.NotFound)) {
35
+ throw err;
36
+ }
37
+ // if not exist. then create it
38
+ await dntShim.Deno.mkdir(dir, { recursive: true });
39
+ }
40
+ }
41
+ /**
42
+ * Ensures that a directory is empty.
43
+ * Deletes directory contents if the directory is not empty.
44
+ * If the directory does not exist, it is created.
45
+ * The directory itself is not deleted.
46
+ * Requires the `--allow-read` and `--allow-write` flag.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import { emptyDirSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
51
+ *
52
+ * emptyDirSync("./foo"); // void
53
+ * ```
54
+ */
55
+ export function emptyDirSync(dir) {
56
+ try {
57
+ const items = [...dntShim.Deno.readDirSync(dir)];
58
+ // If the directory exists, remove all entries inside it.
59
+ while (items.length) {
60
+ const item = items.shift();
61
+ if (item && item.name) {
62
+ const filepath = join(toPathString(dir), item.name);
63
+ dntShim.Deno.removeSync(filepath, { recursive: true });
64
+ }
65
+ }
66
+ }
67
+ catch (err) {
68
+ if (!(err instanceof dntShim.Deno.errors.NotFound)) {
69
+ throw err;
70
+ }
71
+ // if not exist. then create it
72
+ dntShim.Deno.mkdirSync(dir, { recursive: true });
73
+ }
74
+ }
@@ -0,0 +1,27 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures that the directory exists.
4
+ * If the directory structure does not exist, it is created. Like mkdir -p.
5
+ * Requires the `--allow-read` and `--allow-write` flag.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { ensureDir } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
10
+ *
11
+ * ensureDir("./bar"); // returns a promise
12
+ * ```
13
+ */
14
+ export declare function ensureDir(dir: string | URL): Promise<void>;
15
+ /**
16
+ * Ensures that the directory exists.
17
+ * If the directory structure does not exist, it is created. Like mkdir -p.
18
+ * Requires the `--allow-read` and `--allow-write` flag.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { ensureDirSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
23
+ *
24
+ * ensureDirSync("./ensureDirSync"); // void
25
+ * ```
26
+ */
27
+ export declare function ensureDirSync(dir: string | URL): void;
@@ -0,0 +1,55 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import { getFileInfoType } from "./_util.js";
4
+ /**
5
+ * Ensures that the directory exists.
6
+ * If the directory structure does not exist, it is created. Like mkdir -p.
7
+ * Requires the `--allow-read` and `--allow-write` flag.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { ensureDir } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
12
+ *
13
+ * ensureDir("./bar"); // returns a promise
14
+ * ```
15
+ */
16
+ export async function ensureDir(dir) {
17
+ try {
18
+ await dntShim.Deno.mkdir(dir, { recursive: true });
19
+ }
20
+ catch (err) {
21
+ if (!(err instanceof dntShim.Deno.errors.AlreadyExists)) {
22
+ throw err;
23
+ }
24
+ const fileInfo = await dntShim.Deno.lstat(dir);
25
+ if (!fileInfo.isDirectory) {
26
+ throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);
27
+ }
28
+ }
29
+ }
30
+ /**
31
+ * Ensures that the directory exists.
32
+ * If the directory structure does not exist, it is created. Like mkdir -p.
33
+ * Requires the `--allow-read` and `--allow-write` flag.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { ensureDirSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
38
+ *
39
+ * ensureDirSync("./ensureDirSync"); // void
40
+ * ```
41
+ */
42
+ export function ensureDirSync(dir) {
43
+ try {
44
+ dntShim.Deno.mkdirSync(dir, { recursive: true });
45
+ }
46
+ catch (err) {
47
+ if (!(err instanceof dntShim.Deno.errors.AlreadyExists)) {
48
+ throw err;
49
+ }
50
+ const fileInfo = dntShim.Deno.lstatSync(dir);
51
+ if (!fileInfo.isDirectory) {
52
+ throw new Error(`Ensure path exists, expected 'dir', got '${getFileInfoType(fileInfo)}'`);
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,33 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures that the file exists.
4
+ * If the file that is requested to be created is in directories that do not
5
+ * exist.
6
+ * these directories are created. If the file already exists,
7
+ * it is NOTMODIFIED.
8
+ * Requires the `--allow-read` and `--allow-write` flag.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { ensureFile } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
13
+ *
14
+ * ensureFile("./folder/targetFile.dat"); // returns promise
15
+ * ```
16
+ */
17
+ export declare function ensureFile(filePath: string | URL): Promise<void>;
18
+ /**
19
+ * Ensures that the file exists.
20
+ * If the file that is requested to be created is in directories that do not
21
+ * exist,
22
+ * these directories are created. If the file already exists,
23
+ * it is NOT MODIFIED.
24
+ * Requires the `--allow-read` and `--allow-write` flag.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { ensureFileSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
29
+ *
30
+ * ensureFileSync("./folder/targetFile.dat"); // void
31
+ * ```
32
+ */
33
+ export declare function ensureFileSync(filePath: string | URL): void;
@@ -0,0 +1,75 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import * as path from "../path/mod.js";
4
+ import { ensureDir, ensureDirSync } from "./ensure_dir.js";
5
+ import { getFileInfoType, toPathString } from "./_util.js";
6
+ /**
7
+ * Ensures that the file exists.
8
+ * If the file that is requested to be created is in directories that do not
9
+ * exist.
10
+ * these directories are created. If the file already exists,
11
+ * it is NOTMODIFIED.
12
+ * Requires the `--allow-read` and `--allow-write` flag.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { ensureFile } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
17
+ *
18
+ * ensureFile("./folder/targetFile.dat"); // returns promise
19
+ * ```
20
+ */
21
+ export async function ensureFile(filePath) {
22
+ try {
23
+ // if file exists
24
+ const stat = await dntShim.Deno.lstat(filePath);
25
+ if (!stat.isFile) {
26
+ throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);
27
+ }
28
+ }
29
+ catch (err) {
30
+ // if file not exists
31
+ if (err instanceof dntShim.Deno.errors.NotFound) {
32
+ // ensure dir exists
33
+ await ensureDir(path.dirname(toPathString(filePath)));
34
+ // create file
35
+ await dntShim.Deno.writeFile(filePath, new Uint8Array());
36
+ return;
37
+ }
38
+ throw err;
39
+ }
40
+ }
41
+ /**
42
+ * Ensures that the file exists.
43
+ * If the file that is requested to be created is in directories that do not
44
+ * exist,
45
+ * these directories are created. If the file already exists,
46
+ * it is NOT MODIFIED.
47
+ * Requires the `--allow-read` and `--allow-write` flag.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { ensureFileSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
52
+ *
53
+ * ensureFileSync("./folder/targetFile.dat"); // void
54
+ * ```
55
+ */
56
+ export function ensureFileSync(filePath) {
57
+ try {
58
+ // if file exists
59
+ const stat = dntShim.Deno.lstatSync(filePath);
60
+ if (!stat.isFile) {
61
+ throw new Error(`Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`);
62
+ }
63
+ }
64
+ catch (err) {
65
+ // if file not exists
66
+ if (err instanceof dntShim.Deno.errors.NotFound) {
67
+ // ensure dir exists
68
+ ensureDirSync(path.dirname(toPathString(filePath)));
69
+ // create file
70
+ dntShim.Deno.writeFileSync(filePath, new Uint8Array());
71
+ return;
72
+ }
73
+ throw err;
74
+ }
75
+ }
@@ -0,0 +1,31 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures that the hard link exists.
4
+ * If the directory structure does not exist, it is created.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { ensureSymlink } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
9
+ *
10
+ * ensureSymlink("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // returns promise
11
+ * ```
12
+ *
13
+ * @param src the source file path. Directory hard links are not allowed.
14
+ * @param dest the destination link path
15
+ */
16
+ export declare function ensureLink(src: string | URL, dest: string | URL): Promise<void>;
17
+ /**
18
+ * Ensures that the hard link exists.
19
+ * If the directory structure does not exist, it is created.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { ensureSymlinkSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
24
+ *
25
+ * ensureSymlinkSync("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // void
26
+ * ```
27
+ *
28
+ * @param src the source file path. Directory hard links are not allowed.
29
+ * @param dest the destination link path
30
+ */
31
+ export declare function ensureLinkSync(src: string | URL, dest: string | URL): void;
@@ -0,0 +1,43 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import * as dntShim from "../../../../_dnt.shims.js";
3
+ import * as path from "../path/mod.js";
4
+ import { ensureDir, ensureDirSync } from "./ensure_dir.js";
5
+ import { toPathString } from "./_util.js";
6
+ /**
7
+ * Ensures that the hard link exists.
8
+ * If the directory structure does not exist, it is created.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { ensureSymlink } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
13
+ *
14
+ * ensureSymlink("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // returns promise
15
+ * ```
16
+ *
17
+ * @param src the source file path. Directory hard links are not allowed.
18
+ * @param dest the destination link path
19
+ */
20
+ export async function ensureLink(src, dest) {
21
+ dest = toPathString(dest);
22
+ await ensureDir(path.dirname(dest));
23
+ await dntShim.Deno.link(toPathString(src), dest);
24
+ }
25
+ /**
26
+ * Ensures that the hard link exists.
27
+ * If the directory structure does not exist, it is created.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { ensureSymlinkSync } from "https://deno.land/std@$STD_VERSION/fs/mod.ts";
32
+ *
33
+ * ensureSymlinkSync("./folder/targetFile.dat", "./folder/targetFile.link.dat"); // void
34
+ * ```
35
+ *
36
+ * @param src the source file path. Directory hard links are not allowed.
37
+ * @param dest the destination link path
38
+ */
39
+ export function ensureLinkSync(src, dest) {
40
+ dest = toPathString(dest);
41
+ ensureDirSync(path.dirname(dest));
42
+ dntShim.Deno.linkSync(toPathString(src), dest);
43
+ }
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures that the link exists, and points to a valid file.
4
+ * If the directory structure does not exist, it is created.
5
+ *
6
+ * @param target the source file path
7
+ * @param linkName the destination link path
8
+ */
9
+ export declare function ensureSymlink(target: string | URL, linkName: string | URL): Promise<void>;
10
+ /**
11
+ * Ensures that the link exists, and points to a valid file.
12
+ * If the directory structure does not exist, it is created.
13
+ *
14
+ * @param target the source file path
15
+ * @param linkName the destination link path
16
+ */
17
+ export declare function ensureSymlinkSync(target: string | URL, linkName: string | URL): void;