@stryke/fs 0.33.70 → 0.33.72

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 (196) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  3. package/dist/buffer.cjs +5 -4
  4. package/dist/buffer.d.cts.map +1 -1
  5. package/dist/buffer.d.mts.map +1 -1
  6. package/dist/buffer.mjs +1 -1
  7. package/dist/chmod-x.cjs +2 -1
  8. package/dist/chmod-x.d.cts.map +1 -1
  9. package/dist/chmod-x.d.mts.map +1 -1
  10. package/dist/chmod-x.mjs.map +1 -1
  11. package/dist/command-exists.cjs +3 -2
  12. package/dist/command-exists.d.cts.map +1 -1
  13. package/dist/command-exists.d.mts.map +1 -1
  14. package/dist/command-exists.mjs +1 -1
  15. package/dist/command-exists.mjs.map +1 -1
  16. package/dist/compress.cjs +7 -7
  17. package/dist/compress.d.cts.map +1 -1
  18. package/dist/compress.d.mts.map +1 -1
  19. package/dist/compress.mjs +5 -6
  20. package/dist/compress.mjs.map +1 -1
  21. package/dist/constants.d.cts.map +1 -1
  22. package/dist/constants.d.mts.map +1 -1
  23. package/dist/copy-file.cjs +16 -15
  24. package/dist/copy-file.d.cts +0 -1
  25. package/dist/copy-file.d.cts.map +1 -1
  26. package/dist/copy-file.d.mts +0 -1
  27. package/dist/copy-file.d.mts.map +1 -1
  28. package/dist/copy-file.mjs +6 -6
  29. package/dist/exists.cjs +2 -1
  30. package/dist/exists.d.cts.map +1 -1
  31. package/dist/exists.d.mts.map +1 -1
  32. package/dist/get-parent-path.cjs +14 -13
  33. package/dist/get-parent-path.d.cts.map +1 -1
  34. package/dist/get-parent-path.d.mts.map +1 -1
  35. package/dist/get-parent-path.mjs +6 -6
  36. package/dist/get-parent-path.mjs.map +1 -1
  37. package/dist/get-workspace-root.cjs +14 -13
  38. package/dist/get-workspace-root.d.cts.map +1 -1
  39. package/dist/get-workspace-root.d.mts.map +1 -1
  40. package/dist/get-workspace-root.mjs +3 -3
  41. package/dist/get-workspace-root.mjs.map +1 -1
  42. package/dist/helpers.cjs +2 -1
  43. package/dist/helpers.d.cts.map +1 -1
  44. package/dist/helpers.d.mts.map +1 -1
  45. package/dist/helpers.mjs.map +1 -1
  46. package/dist/index.cjs +1 -0
  47. package/dist/install.cjs +6 -5
  48. package/dist/install.d.cts +0 -2
  49. package/dist/install.d.cts.map +1 -1
  50. package/dist/install.d.mts +0 -3
  51. package/dist/install.d.mts.map +1 -1
  52. package/dist/install.mjs +1 -1
  53. package/dist/is-file.cjs +7 -6
  54. package/dist/is-file.d.cts.map +1 -1
  55. package/dist/is-file.d.mts.map +1 -1
  56. package/dist/is-file.mjs +1 -1
  57. package/dist/json/src/storm-json.cjs +3 -3
  58. package/dist/json/src/storm-json.mjs +1 -1
  59. package/dist/json/src/storm-json.mjs.map +1 -1
  60. package/dist/json/src/types.d.cts +0 -1
  61. package/dist/json/src/types.d.cts.map +1 -1
  62. package/dist/json/src/types.d.mts +0 -1
  63. package/dist/json/src/types.d.mts.map +1 -1
  64. package/dist/json/src/utils/code-frames.mjs.map +1 -1
  65. package/dist/json/src/utils/parse-error.cjs +1 -1
  66. package/dist/json/src/utils/stringify.mjs.map +1 -1
  67. package/dist/json/src/utils/strip-comments.cjs +4 -5
  68. package/dist/json/src/utils/strip-comments.mjs +4 -6
  69. package/dist/json/src/utils/strip-comments.mjs.map +1 -1
  70. package/dist/json.cjs +6 -4
  71. package/dist/json.d.cts +0 -1
  72. package/dist/json.d.cts.map +1 -1
  73. package/dist/json.d.mts +0 -1
  74. package/dist/json.d.mts.map +1 -1
  75. package/dist/json.mjs +2 -2
  76. package/dist/list-files.cjs +6 -5
  77. package/dist/list-files.d.cts.map +1 -1
  78. package/dist/list-files.d.mts.map +1 -1
  79. package/dist/list-files.mjs +1 -1
  80. package/dist/list-files.mjs.map +1 -1
  81. package/dist/package-fns.cjs +12 -11
  82. package/dist/package-fns.d.cts +0 -1
  83. package/dist/package-fns.d.cts.map +1 -1
  84. package/dist/package-fns.d.mts +0 -1
  85. package/dist/package-fns.d.mts.map +1 -1
  86. package/dist/package-fns.mjs +4 -4
  87. package/dist/read-file.cjs +2 -1
  88. package/dist/read-file.d.cts.map +1 -1
  89. package/dist/read-file.d.mts.map +1 -1
  90. package/dist/registry.cjs +4 -3
  91. package/dist/registry.d.cts.map +1 -1
  92. package/dist/registry.d.mts.map +1 -1
  93. package/dist/registry.mjs.map +1 -1
  94. package/dist/remove-file.cjs +2 -1
  95. package/dist/remove-file.d.cts.map +1 -1
  96. package/dist/remove-file.d.mts.map +1 -1
  97. package/dist/resolve.cjs +38 -37
  98. package/dist/resolve.d.cts.map +1 -1
  99. package/dist/resolve.d.mts.map +1 -1
  100. package/dist/resolve.mjs +18 -18
  101. package/dist/resolve.mjs.map +1 -1
  102. package/dist/semver-fns.cjs +5 -4
  103. package/dist/semver-fns.d.cts.map +1 -1
  104. package/dist/semver-fns.d.mts.map +1 -1
  105. package/dist/semver-fns.mjs +1 -1
  106. package/dist/semver-fns.mjs.map +1 -1
  107. package/dist/toml.cjs +3 -2
  108. package/dist/toml.d.cts +3 -4
  109. package/dist/toml.d.cts.map +1 -1
  110. package/dist/toml.d.mts +3 -4
  111. package/dist/toml.d.mts.map +1 -1
  112. package/dist/tsconfig.cjs +13 -12
  113. package/dist/tsconfig.d.cts +0 -1
  114. package/dist/tsconfig.d.cts.map +1 -1
  115. package/dist/tsconfig.d.mts +0 -1
  116. package/dist/tsconfig.d.mts.map +1 -1
  117. package/dist/tsconfig.mjs +5 -5
  118. package/dist/type-checks/src/index.cjs +3 -3
  119. package/dist/type-checks/src/index.mjs +3 -3
  120. package/dist/type-checks/src/is-buffer.cjs +2 -2
  121. package/dist/type-checks/src/is-buffer.mjs +1 -1
  122. package/dist/type-checks/src/is-buffer.mjs.map +1 -1
  123. package/dist/type-checks/src/is-set-string.cjs +1 -1
  124. package/dist/type-checks/src/is-set-string.mjs +1 -1
  125. package/dist/types/src/file.d.cts +0 -1
  126. package/dist/types/src/file.d.cts.map +1 -1
  127. package/dist/types/src/file.d.mts +0 -1
  128. package/dist/types/src/file.d.mts.map +1 -1
  129. package/dist/types/src/package-json.d.cts.map +1 -1
  130. package/dist/types/src/package-json.d.mts.map +1 -1
  131. package/dist/types/src/package-manager.d.cts.map +1 -1
  132. package/dist/types/src/package-manager.d.mts.map +1 -1
  133. package/dist/types/src/tsconfig.d.cts.map +1 -1
  134. package/dist/types/src/tsconfig.d.mts.map +1 -1
  135. package/dist/write-file.cjs +6 -5
  136. package/dist/write-file.d.cts.map +1 -1
  137. package/dist/write-file.d.mts.map +1 -1
  138. package/dist/write-file.mjs +2 -2
  139. package/dist/yaml.cjs +2 -1
  140. package/dist/yaml.d.cts.map +1 -1
  141. package/dist/yaml.d.mts.map +1 -1
  142. package/package.json +139 -58
  143. package/dist/convert/src/array-buffer-to-string.cjs +0 -19
  144. package/dist/convert/src/array-buffer-to-string.mjs +0 -19
  145. package/dist/convert/src/array-buffer-to-string.mjs.map +0 -1
  146. package/dist/convert/src/to-array.cjs +0 -15
  147. package/dist/convert/src/to-array.mjs +0 -15
  148. package/dist/convert/src/to-array.mjs.map +0 -1
  149. package/dist/convert/src/uint8-array-to-string.cjs +0 -15
  150. package/dist/convert/src/uint8-array-to-string.mjs +0 -16
  151. package/dist/convert/src/uint8-array-to-string.mjs.map +0 -1
  152. package/dist/helpers/src/get-unique.cjs +0 -14
  153. package/dist/helpers/src/get-unique.mjs +0 -14
  154. package/dist/helpers/src/get-unique.mjs.map +0 -1
  155. package/dist/path/src/append.cjs +0 -57
  156. package/dist/path/src/append.mjs +0 -57
  157. package/dist/path/src/append.mjs.map +0 -1
  158. package/dist/path/src/correct-path.cjs +0 -138
  159. package/dist/path/src/correct-path.mjs +0 -135
  160. package/dist/path/src/correct-path.mjs.map +0 -1
  161. package/dist/path/src/cwd.cjs +0 -17
  162. package/dist/path/src/cwd.mjs +0 -17
  163. package/dist/path/src/cwd.mjs.map +0 -1
  164. package/dist/path/src/file-path-fns.cjs +0 -178
  165. package/dist/path/src/file-path-fns.mjs +0 -171
  166. package/dist/path/src/file-path-fns.mjs.map +0 -1
  167. package/dist/path/src/is-parent-path.cjs +0 -32
  168. package/dist/path/src/is-parent-path.mjs +0 -33
  169. package/dist/path/src/is-parent-path.mjs.map +0 -1
  170. package/dist/path/src/is-root-dir.cjs +0 -14
  171. package/dist/path/src/is-root-dir.mjs +0 -14
  172. package/dist/path/src/is-root-dir.mjs.map +0 -1
  173. package/dist/path/src/is-type.cjs +0 -68
  174. package/dist/path/src/is-type.mjs +0 -67
  175. package/dist/path/src/is-type.mjs.map +0 -1
  176. package/dist/path/src/join-paths.cjs +0 -122
  177. package/dist/path/src/join-paths.mjs +0 -123
  178. package/dist/path/src/join-paths.mjs.map +0 -1
  179. package/dist/path/src/regex.cjs +0 -20
  180. package/dist/path/src/regex.mjs +0 -13
  181. package/dist/path/src/regex.mjs.map +0 -1
  182. package/dist/path/src/replace.cjs +0 -24
  183. package/dist/path/src/replace.mjs +0 -25
  184. package/dist/path/src/replace.mjs.map +0 -1
  185. package/dist/path/src/resolve-parent-path.cjs +0 -18
  186. package/dist/path/src/resolve-parent-path.mjs +0 -19
  187. package/dist/path/src/resolve-parent-path.mjs.map +0 -1
  188. package/dist/path/src/slash.cjs +0 -15
  189. package/dist/path/src/slash.mjs +0 -15
  190. package/dist/path/src/slash.mjs.map +0 -1
  191. package/dist/string-format/src/package.cjs +0 -92
  192. package/dist/string-format/src/package.mjs +0 -92
  193. package/dist/string-format/src/package.mjs.map +0 -1
  194. package/dist/types/src/base.cjs +0 -6
  195. package/dist/types/src/base.mjs +0 -6
  196. package/dist/types/src/base.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  # Changelog for Stryke - Fs
4
4
 
5
+ ## [0.33.72](https://github.com/storm-software/stryke/releases/tag/fs%400.33.72) (05/06/2026)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **string-format** to **v0.17.15**
10
+ - Updated **path** to **v0.29.0**
11
+
12
+ ## [0.33.71](https://github.com/storm-software/stryke/releases/tag/fs%400.33.71) (05/06/2026)
13
+
14
+ ### Miscellaneous
15
+
16
+ - **fs:** Resolve `sherif` linting failures ([9ef6665d](https://github.com/storm-software/stryke/commit/9ef6665d))
17
+ - **monorepo:** Resolve issues with workspace packages' build configuration ([f4a3941f](https://github.com/storm-software/stryke/commit/f4a3941f))
18
+
19
+ ### Updated Dependencies
20
+
21
+ - Updated **string-format** to **v0.17.14**
22
+ - Updated **type-checks** to **v0.6.6**
23
+ - Updated **convert** to **v0.7.4**
24
+ - Updated **helpers** to **v0.10.13**
25
+ - Updated **types** to **v0.12.1**
26
+ - Updated **json** to **v0.14.17**
27
+ - Updated **path** to **v0.28.3**
28
+
5
29
  ## [0.33.70](https://github.com/storm-software/stryke/releases/tag/fs%400.33.70) (05/01/2026)
6
30
 
7
31
  ### Updated Dependencies
@@ -1,4 +1,4 @@
1
- //#region rolldown:runtime
1
+ //#region \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/dist/buffer.cjs CHANGED
@@ -1,6 +1,7 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_file_path_fns = require('./path/src/file-path-fns.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_helpers = require('./helpers.cjs');
4
+ let _stryke_path = require("@stryke/path");
4
5
  let node_buffer = require("node:buffer");
5
6
  let node_fs = require("node:fs");
6
7
  let node_fs_promises = require("node:fs/promises");
@@ -38,7 +39,7 @@ function readFileBufferSync(filePath) {
38
39
  */
39
40
  async function writeFileBuffer(filePath, data) {
40
41
  if (!filePath) throw new Error("No file path provided to write data");
41
- if (!(0, node_fs.existsSync)(require_file_path_fns.findFilePath(filePath))) await require_helpers.createDirectory(require_file_path_fns.findFilePath(filePath));
42
+ if (!(0, node_fs.existsSync)((0, _stryke_path.findFilePath)(filePath))) await require_helpers.createDirectory((0, _stryke_path.findFilePath)(filePath));
42
43
  await (0, node_fs_promises.writeFile)(filePath, node_buffer.Buffer.from(data));
43
44
  }
44
45
  /**
@@ -49,7 +50,7 @@ async function writeFileBuffer(filePath, data) {
49
50
  */
50
51
  function writeFileBufferSync(filePath, data) {
51
52
  if (!filePath) throw new Error("No file path provided to write data");
52
- if (!(0, node_fs.existsSync)(require_file_path_fns.findFilePath(filePath))) require_helpers.createDirectorySync(require_file_path_fns.findFilePath(filePath));
53
+ if (!(0, node_fs.existsSync)((0, _stryke_path.findFilePath)(filePath))) require_helpers.createDirectorySync((0, _stryke_path.findFilePath)(filePath));
53
54
  (0, node_fs.writeFileSync)(filePath, node_buffer.Buffer.from(data));
54
55
  }
55
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.cts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAmBA;AAmBA;AAiBA;;iBAvDsB,cAAA,oBAAkC,QAAQ;;;;;;;iBAmBhD,kBAAA,oBAAsC;;;;;;;iBAmBhC,eAAA,yBAAwC,cAAW;;;;;;;iBAiBzD,mBAAA,yBAA4C"}
1
+ {"version":3,"file":"buffer.d.cts","names":[],"sources":["../src/buffer.ts"],"mappings":";;AA8BA;;;;;iBAAsB,cAAA,CAAe,QAAA,WAAmB,OAAA,CAAQ,WAAA;;;;AAmBhE;;;iBAAgB,kBAAA,CAAmB,QAAA,WAAmB,WAAA;;AAmBtD;;;;;iBAAsB,eAAA,CAAgB,QAAA,UAAkB,IAAA,EAAM,WAAA,GAAW,OAAA;;;;;AAiBzE;;iBAAgB,mBAAA,CAAoB,QAAA,UAAkB,IAAA,EAAM,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.mts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAmBA;AAmBA;AAiBA;;iBAvDsB,cAAA,oBAAkC,QAAQ;;;;;;;iBAmBhD,kBAAA,oBAAsC;;;;;;;iBAmBhC,eAAA,yBAAwC,cAAW;;;;;;;iBAiBzD,mBAAA,yBAA4C"}
1
+ {"version":3,"file":"buffer.d.mts","names":[],"sources":["../src/buffer.ts"],"mappings":";;AA8BA;;;;;iBAAsB,cAAA,CAAe,QAAA,WAAmB,OAAA,CAAQ,WAAA;;;;AAmBhE;;;iBAAgB,kBAAA,CAAmB,QAAA,WAAmB,WAAA;;AAmBtD;;;;;iBAAsB,eAAA,CAAgB,QAAA,UAAkB,IAAA,EAAM,WAAA,GAAW,OAAA;;;;;AAiBzE;;iBAAgB,mBAAA,CAAoB,QAAA,UAAkB,IAAA,EAAM,WAAA"}
package/dist/buffer.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { findFilePath } from "./path/src/file-path-fns.mjs";
2
1
  import { createDirectory, createDirectorySync } from "./helpers.mjs";
2
+ import { findFilePath } from "@stryke/path";
3
3
  import { Buffer } from "node:buffer";
4
4
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { readFile, writeFile } from "node:fs/promises";
package/dist/chmod-x.cjs CHANGED
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  let node_fs = require("node:fs");
3
4
  let node_fs_promises = require("node:fs/promises");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"chmod-x.d.cts","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAuBA;AAwBA;AAeA;AAesB,iBA7EN,UAAA,CA6EsC,IAAO,EAAA,MAAA,CAAA,EAAA,IAAA;AAe7D;;;;;iBArEsB,MAAA,gBAAmB;;;;;;;iBAwBnB,UAAA,oBAA8B;;;;;;;iBAepC,cAAA;;;;;;;iBAeM,YAAA,oBAAgC;;;;;;;iBAetC,gBAAA"}
1
+ {"version":3,"file":"chmod-x.d.cts","names":[],"sources":["../src/chmod-x.ts"],"mappings":";;AA0BA;;;;iBAAgB,UAAA,CAAW,IAAA;AAuB3B;;;;;AAAA,iBAAsB,MAAA,CAAO,IAAA,WAAY,OAAA;;;;;AAuCzC;;iBAfsB,UAAA,CAAW,QAAA,WAAmB,OAAA;;;AA8BpD;;;;iBAfgB,cAAA,CAAe,QAAA;AA8B/B;;;;;;AAAA,iBAfsB,YAAA,CAAa,QAAA,WAAmB,OAAA;;;;;;;iBAetC,gBAAA,CAAiB,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"chmod-x.d.mts","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAuBA;AAwBA;AAeA;AAesB,iBA7EN,UAAA,CA6EsC,IAAO,EAAA,MAAA,CAAA,EAAA,IAAA;AAe7D;;;;;iBArEsB,MAAA,gBAAmB;;;;;;;iBAwBnB,UAAA,oBAA8B;;;;;;;iBAepC,cAAA;;;;;;;iBAeM,YAAA,oBAAgC;;;;;;;iBAetC,gBAAA"}
1
+ {"version":3,"file":"chmod-x.d.mts","names":[],"sources":["../src/chmod-x.ts"],"mappings":";;AA0BA;;;;iBAAgB,UAAA,CAAW,IAAA;AAuB3B;;;;;AAAA,iBAAsB,MAAA,CAAO,IAAA,WAAY,OAAA;;;;;AAuCzC;;iBAfsB,UAAA,CAAW,QAAA,WAAmB,OAAA;;;AA8BpD;;;;iBAfgB,cAAA,CAAe,QAAA;AA8B/B;;;;;;AAAA,iBAfsB,YAAA,CAAa,QAAA,WAAmB,OAAA;;;;;;;iBAetC,gBAAA,CAAiB,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"chmod-x.mjs","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { accessSync, chmodSync, constants, statSync } from \"node:fs\";\nimport { access, chmod } from \"node:fs/promises\";\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport function chmodXSync(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n chmodSync(file, base8);\n}\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport async function chmodX(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n return chmod(file, base8);\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is writable, false otherwise\n */\nexport async function isWritable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is writable, false otherwise\n */\nexport function isWritableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is executable, false otherwise\n */\nexport async function isExecutable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is executable, false otherwise\n */\nexport function isExecutableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,WAAW,MAAc;AAGvC,KAAI,QAAQ,aAAa,QACvB;CAGF,MAAM,IAAI,SAAS,KAAK;CACxB,MAAM,UAAU,EAAE,OAAO;AAEzB,KAAI,EAAE,SAAS,QACb;AAIF,WAAU,MAFI,QAAQ,SAAS,EAAE,CAAC,MAAM,GAAG,CAErB;;;;;;;AAQxB,eAAsB,OAAO,MAAc;AAGzC,KAAI,QAAQ,aAAa,QACvB;CAGF,MAAM,IAAI,SAAS,KAAK;CACxB,MAAM,UAAU,EAAE,OAAO;AAEzB,KAAI,EAAE,SAAS,QACb;AAIF,QAAO,MAAM,MAFC,QAAQ,SAAS,EAAE,CAAC,MAAM,GAAG,CAElB;;;;;;;;AAS3B,eAAsB,WAAW,UAAoC;AACnE,KAAI;AACF,QAAM,OAAO,UAAU,UAAU,KAAK;AACtC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,SAAgB,eAAe,UAA2B;AACxD,KAAI;AACF,aAAW,UAAU,UAAU,KAAK;AACpC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,eAAsB,aAAa,UAAoC;AACrE,KAAI;AACF,QAAM,OAAO,UAAU,UAAU,KAAK;AACtC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,SAAgB,iBAAiB,UAA2B;AAC1D,KAAI;AACF,aAAW,UAAU,UAAU,KAAK;AACpC,SAAO;SACD;AACN,SAAO"}
1
+ {"version":3,"file":"chmod-x.mjs","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { accessSync, chmodSync, constants, statSync } from \"node:fs\";\nimport { access, chmod } from \"node:fs/promises\";\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport function chmodXSync(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n chmodSync(file, base8);\n}\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport async function chmodX(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n return chmod(file, base8);\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is writable, false otherwise\n */\nexport async function isWritable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is writable, false otherwise\n */\nexport function isWritableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is executable, false otherwise\n */\nexport async function isExecutable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is executable, false otherwise\n */\nexport function isExecutableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,WAAW,MAAc;AAGvC,KAAI,QAAQ,aAAa,QACvB;CAGF,MAAM,IAAI,SAAS,KAAK;CACxB,MAAM,UAAU,EAAE,OAAO;AAEzB,KAAI,EAAE,SAAS,QACb;AAIF,WAAU,MAFI,QAAQ,SAAS,EAAE,CAAC,MAAM,GAEnB,CAAC;;;;;;;AAQxB,eAAsB,OAAO,MAAc;AAGzC,KAAI,QAAQ,aAAa,QACvB;CAGF,MAAM,IAAI,SAAS,KAAK;CACxB,MAAM,UAAU,EAAE,OAAO;AAEzB,KAAI,EAAE,SAAS,QACb;AAIF,QAAO,MAAM,MAFC,QAAQ,SAAS,EAAE,CAAC,MAAM,GAEhB,CAAC;;;;;;;;AAS3B,eAAsB,WAAW,UAAoC;AACnE,KAAI;AACF,QAAM,OAAO,UAAU,UAAU,KAAK;AACtC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,SAAgB,eAAe,UAA2B;AACxD,KAAI;AACF,aAAW,UAAU,UAAU,KAAK;AACpC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,eAAsB,aAAa,UAAoC;AACrE,KAAI;AACF,QAAM,OAAO,UAAU,UAAU,KAAK;AACtC,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,SAAgB,iBAAiB,UAA2B;AAC1D,KAAI;AACF,aAAW,UAAU,UAAU,KAAK;AACpC,SAAO;SACD;AACN,SAAO"}
@@ -1,8 +1,9 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- let node_path = require("node:path");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let node_fs = require("node:fs");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  let node_child_process = require("node:child_process");
6
+ let node_path = require("node:path");
6
7
 
7
8
  //#region src/command-exists.ts
8
9
  const isUsingWindows = process.platform == "win32";
@@ -1 +1 @@
1
- {"version":3,"file":"command-exists.d.cts","names":[],"sources":["../src/command-exists.ts"],"sourcesContent":[],"mappings":";;AAuJA;AAqBA;;;;;;iBArBsB,aAAA,uBAAiC;;;;;;;;;iBAqBvC,iBAAA"}
1
+ {"version":3,"file":"command-exists.d.cts","names":[],"sources":["../src/command-exists.ts"],"mappings":";;AAuJA;;;;;AAqBA;;iBArBsB,aAAA,CAAc,WAAA,WAAmB,OAAA;;;;;;;;;iBAqBvC,iBAAA,CAAkB,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-exists.d.mts","names":[],"sources":["../src/command-exists.ts"],"sourcesContent":[],"mappings":";;AAuJA;AAqBA;;;;;;iBArBsB,aAAA,uBAAiC;;;;;;;;;iBAqBvC,iBAAA"}
1
+ {"version":3,"file":"command-exists.d.mts","names":[],"sources":["../src/command-exists.ts"],"mappings":";;AAuJA;;;;;AAqBA;;iBArBsB,aAAA,CAAc,WAAA,WAAmB,OAAA;;;;;;;;;iBAqBvC,iBAAA,CAAkB,WAAA"}
@@ -1,7 +1,7 @@
1
- import { basename, dirname } from "node:path";
2
1
  import { accessSync } from "node:fs";
3
2
  import { access, constants as constants$1 } from "node:fs/promises";
4
3
  import { exec, execSync } from "node:child_process";
4
+ import { basename, dirname } from "node:path";
5
5
 
6
6
  //#region src/command-exists.ts
7
7
  const isUsingWindows = process.platform == "win32";
@@ -1 +1 @@
1
- {"version":3,"file":"command-exists.mjs","names":["constants"],"sources":["../src/command-exists.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exec, execSync } from \"node:child_process\";\nimport { accessSync } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\nimport { basename, dirname } from \"node:path\";\n\nconst isUsingWindows = process.platform == \"win32\";\n\nasync function fileNotExists(commandName: string) {\n try {\n await access(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nfunction fileNotExistsSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nasync function localExecutable(commandName: string) {\n return access(commandName, constants.F_OK | constants.X_OK);\n}\n\nfunction localExecutableSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK | constants.X_OK);\n return true;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nasync function commandExistsUnix(\n commandName: string,\n cleanedCommandName: string\n) {\n const isFile = await fileNotExists(commandName);\n\n if (!isFile) {\n exec(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n await localExecutable(commandName);\n }\n}\n\nasync function commandExistsWindows(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return;\n }\n\n exec(`where ${cleanedCommandName}`);\n}\n\nfunction commandExistsUnixSync(\n commandName: string,\n cleanedCommandName: string\n): boolean {\n if (fileNotExistsSync(commandName)) {\n try {\n const stdout = execSync(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n }\n return localExecutableSync(commandName);\n}\n\nfunction commandExistsWindowsSync(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return false;\n }\n try {\n const stdout = execSync(`where ${cleanedCommandName}`, { stdio: [] });\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nfunction cleanInput(s: string) {\n if (/[^\\w/:=-]/.test(s)) {\n s = `'${s.replace(/'/g, \"'\\\\''\")}'`;\n s = s\n .replace(/^(?:'')+/g, \"\") // un-duplicate single-quote at the beginning\n .replace(/\\\\'''/g, \"\\\\'\"); // remove non-escaped single-quote if there are enclosed between 2 escaped\n }\n return s;\n}\n\nconst cleanWindowsInput = (s: string) => {\n const isPathName = /\\\\/.test(s);\n if (isPathName) {\n return `\"${dirname(s)}:${basename(s)}\"`;\n }\n return `\"${s}\"`;\n};\n\n/**\n * Asynchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns A promise that resolves to `true` if the command exists and is executable, `false` otherwise\n */\nexport async function commandExists(commandName: string) {\n const cleanedCommandName = cleanInput(commandName);\n\n if (typeof Promise !== \"undefined\") {\n return commandExists(commandName);\n }\n if (isUsingWindows) {\n return commandExistsWindows(commandName, cleanedCommandName);\n } else {\n return commandExistsUnix(commandName, cleanedCommandName);\n }\n}\n\n/**\n * Synchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns `true` if the command exists and is executable, `false` otherwise\n */\nexport function commandExistsSync(commandName: string): boolean {\n if (isUsingWindows) {\n return commandExistsWindowsSync(\n commandName,\n cleanWindowsInput(commandName)\n );\n } else {\n return commandExistsUnixSync(commandName, cleanInput(commandName));\n }\n}\n"],"mappings":";;;;;;AAuBA,MAAM,iBAAiB,QAAQ,YAAY;AAE3C,eAAe,cAAc,aAAqB;AAChD,KAAI;AACF,QAAM,OAAO,aAAaA,YAAU,KAAK;AACzC,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,SAAS,kBAAkB,aAAqB;AAC9C,KAAI;AACF,aAAW,aAAaA,YAAU,KAAK;AACvC,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,eAAe,gBAAgB,aAAqB;AAClD,QAAO,OAAO,aAAaA,YAAU,OAAOA,YAAU,KAAK;;AAG7D,SAAS,oBAAoB,aAAqB;AAChD,KAAI;AACF,aAAW,aAAaA,YAAU,OAAOA,YAAU,KAAK;AACxD,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,eAAe,kBACb,aACA,oBACA;AAGA,KAAI,CAFW,MAAM,cAAc,YAAY,EAElC;AACX,OACE,cAAc,mBAAmB,6BACb,mBAAmB,aACxC;AAED,QAAM,gBAAgB,YAAY;;;AAItC,eAAe,qBACb,aACA,oBACA;AAEA,KAAI,CAAC,qDAAqD,KAAK,YAAY,CACzE;AAGF,MAAK,SAAS,qBAAqB;;AAGrC,SAAS,sBACP,aACA,oBACS;AACT,KAAI,kBAAkB,YAAY,CAChC,KAAI;AAMF,SAAO,CAAC,CALO,SACb,cAAc,mBAAmB,6BACb,mBAAmB,aACxC;UAIM,GAAG;AACV,SAAO;;AAGX,QAAO,oBAAoB,YAAY;;AAGzC,SAAS,yBACP,aACA,oBACA;AAEA,KAAI,CAAC,qDAAqD,KAAK,YAAY,CACzE,QAAO;AAET,KAAI;AAGF,SAAO,CAAC,CAFO,SAAS,SAAS,sBAAsB,EAAE,OAAO,EAAE,EAAE,CAAC;UAI9D,GAAG;AACV,SAAO;;;AAIX,SAAS,WAAW,GAAW;AAC7B,KAAI,YAAY,KAAK,EAAE,EAAE;AACvB,MAAI,IAAI,EAAE,QAAQ,MAAM,QAAQ,CAAC;AACjC,MAAI,EACD,QAAQ,aAAa,GAAG,CACxB,QAAQ,UAAU,MAAM;;AAE7B,QAAO;;AAGT,MAAM,qBAAqB,MAAc;AAEvC,KADmB,KAAK,KAAK,EAAE,CAE7B,QAAO,IAAI,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC;AAEvC,QAAO,IAAI,EAAE;;;;;;;;;;AAWf,eAAsB,cAAc,aAAqB;CACvD,MAAM,qBAAqB,WAAW,YAAY;AAElD,KAAI,OAAO,YAAY,YACrB,QAAO,cAAc,YAAY;AAEnC,KAAI,eACF,QAAO,qBAAqB,aAAa,mBAAmB;KAE5D,QAAO,kBAAkB,aAAa,mBAAmB;;;;;;;;;;AAY7D,SAAgB,kBAAkB,aAA8B;AAC9D,KAAI,eACF,QAAO,yBACL,aACA,kBAAkB,YAAY,CAC/B;KAED,QAAO,sBAAsB,aAAa,WAAW,YAAY,CAAC"}
1
+ {"version":3,"file":"command-exists.mjs","names":["constants"],"sources":["../src/command-exists.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exec, execSync } from \"node:child_process\";\nimport { accessSync } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\nimport { basename, dirname } from \"node:path\";\n\nconst isUsingWindows = process.platform == \"win32\";\n\nasync function fileNotExists(commandName: string) {\n try {\n await access(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nfunction fileNotExistsSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nasync function localExecutable(commandName: string) {\n return access(commandName, constants.F_OK | constants.X_OK);\n}\n\nfunction localExecutableSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK | constants.X_OK);\n return true;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nasync function commandExistsUnix(\n commandName: string,\n cleanedCommandName: string\n) {\n const isFile = await fileNotExists(commandName);\n\n if (!isFile) {\n exec(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n await localExecutable(commandName);\n }\n}\n\nasync function commandExistsWindows(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return;\n }\n\n exec(`where ${cleanedCommandName}`);\n}\n\nfunction commandExistsUnixSync(\n commandName: string,\n cleanedCommandName: string\n): boolean {\n if (fileNotExistsSync(commandName)) {\n try {\n const stdout = execSync(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n }\n return localExecutableSync(commandName);\n}\n\nfunction commandExistsWindowsSync(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return false;\n }\n try {\n const stdout = execSync(`where ${cleanedCommandName}`, { stdio: [] });\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nfunction cleanInput(s: string) {\n if (/[^\\w/:=-]/.test(s)) {\n s = `'${s.replace(/'/g, \"'\\\\''\")}'`;\n s = s\n .replace(/^(?:'')+/g, \"\") // un-duplicate single-quote at the beginning\n .replace(/\\\\'''/g, \"\\\\'\"); // remove non-escaped single-quote if there are enclosed between 2 escaped\n }\n return s;\n}\n\nconst cleanWindowsInput = (s: string) => {\n const isPathName = /\\\\/.test(s);\n if (isPathName) {\n return `\"${dirname(s)}:${basename(s)}\"`;\n }\n return `\"${s}\"`;\n};\n\n/**\n * Asynchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns A promise that resolves to `true` if the command exists and is executable, `false` otherwise\n */\nexport async function commandExists(commandName: string) {\n const cleanedCommandName = cleanInput(commandName);\n\n if (typeof Promise !== \"undefined\") {\n return commandExists(commandName);\n }\n if (isUsingWindows) {\n return commandExistsWindows(commandName, cleanedCommandName);\n } else {\n return commandExistsUnix(commandName, cleanedCommandName);\n }\n}\n\n/**\n * Synchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns `true` if the command exists and is executable, `false` otherwise\n */\nexport function commandExistsSync(commandName: string): boolean {\n if (isUsingWindows) {\n return commandExistsWindowsSync(\n commandName,\n cleanWindowsInput(commandName)\n );\n } else {\n return commandExistsUnixSync(commandName, cleanInput(commandName));\n }\n}\n"],"mappings":";;;;;;AAuBA,MAAM,iBAAiB,QAAQ,YAAY;AAE3C,eAAe,cAAc,aAAqB;AAChD,KAAI;AACF,QAAM,OAAO,aAAaA,YAAU,KAAK;AACzC,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,SAAS,kBAAkB,aAAqB;AAC9C,KAAI;AACF,aAAW,aAAaA,YAAU,KAAK;AACvC,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,eAAe,gBAAgB,aAAqB;AAClD,QAAO,OAAO,aAAaA,YAAU,OAAOA,YAAU,KAAK;;AAG7D,SAAS,oBAAoB,aAAqB;AAChD,KAAI;AACF,aAAW,aAAaA,YAAU,OAAOA,YAAU,KAAK;AACxD,SAAO;UAEA,GAAG;AACV,SAAO;;;AAIX,eAAe,kBACb,aACA,oBACA;AAGA,KAAI,CAAC,MAFgB,cAAc,YAAY,EAElC;AACX,OACE,cAAc,mBAAmB,6BACb,mBAAmB,aACxC;AAED,QAAM,gBAAgB,YAAY;;;AAItC,eAAe,qBACb,aACA,oBACA;AAEA,KAAI,CAAC,qDAAqD,KAAK,YAAY,CACzE;AAGF,MAAK,SAAS,qBAAqB;;AAGrC,SAAS,sBACP,aACA,oBACS;AACT,KAAI,kBAAkB,YAAY,CAChC,KAAI;AAMF,SAAO,CAAC,CALO,SACb,cAAc,mBAAmB,6BACb,mBAAmB,aAG1B;UAER,GAAG;AACV,SAAO;;AAGX,QAAO,oBAAoB,YAAY;;AAGzC,SAAS,yBACP,aACA,oBACA;AAEA,KAAI,CAAC,qDAAqD,KAAK,YAAY,CACzE,QAAO;AAET,KAAI;AAGF,SAAO,CAAC,CAFO,SAAS,SAAS,sBAAsB,EAAE,OAAO,EAAE,EAAE,CAErD;UAER,GAAG;AACV,SAAO;;;AAIX,SAAS,WAAW,GAAW;AAC7B,KAAI,YAAY,KAAK,EAAE,EAAE;AACvB,MAAI,IAAI,EAAE,QAAQ,MAAM,QAAQ,CAAC;AACjC,MAAI,EACD,QAAQ,aAAa,GAAG,CACxB,QAAQ,UAAU,MAAM;;AAE7B,QAAO;;AAGT,MAAM,qBAAqB,MAAc;AAEvC,KADmB,KAAK,KAAK,EACf,CACZ,QAAO,IAAI,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC;AAEvC,QAAO,IAAI,EAAE;;;;;;;;;;AAWf,eAAsB,cAAc,aAAqB;CACvD,MAAM,qBAAqB,WAAW,YAAY;AAElD,KAAI,OAAO,YAAY,YACrB,QAAO,cAAc,YAAY;AAEnC,KAAI,eACF,QAAO,qBAAqB,aAAa,mBAAmB;KAE5D,QAAO,kBAAkB,aAAa,mBAAmB;;;;;;;;;;AAY7D,SAAgB,kBAAkB,aAA8B;AAC9D,KAAI,eACF,QAAO,yBACL,aACA,kBAAkB,YAAY,CAC/B;KAED,QAAO,sBAAsB,aAAa,WAAW,YAAY,CAAC"}
package/dist/compress.cjs CHANGED
@@ -1,13 +1,13 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_join_paths = require('./path/src/join-paths.cjs');
3
- const require_file_path_fns = require('./path/src/file-path-fns.cjs');
4
- const require_resolve_parent_path = require('./path/src/resolve-parent-path.cjs');
5
- const require_uint8_array_to_string = require('./convert/src/uint8-array-to-string.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
6
3
  const require_is_file = require('./is-file.cjs');
7
4
  const require_list_files = require('./list-files.cjs');
8
5
  const require_read_file = require('./read-file.cjs');
9
6
  const require_write_file = require('./write-file.cjs');
7
+ let _stryke_path = require("@stryke/path");
10
8
  let nanotar = require("nanotar");
9
+ let _stryke_convert_uint8_array_to_string = require("@stryke/convert/uint8-array-to-string");
10
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
11
11
 
12
12
  //#region src/compress.ts
13
13
  /**
@@ -17,12 +17,12 @@ let nanotar = require("nanotar");
17
17
  * @param options - Options for the compression.
18
18
  */
19
19
  async function compressDirectory(directory, options) {
20
- const files = await require_list_files.listFiles(require_is_file.isDirectory(directory) ? require_join_paths.joinPaths(directory, "**/*") : directory, options);
20
+ const files = await require_list_files.listFiles(require_is_file.isDirectory(directory) ? (0, _stryke_path_join_paths.joinPaths)(directory, "**/*") : directory, options);
21
21
  const data = await (0, nanotar.createTarGzip)(await Promise.all(files.map(async (file) => ({
22
22
  name: file,
23
23
  data: await require_read_file.readFileIfExisting(file)
24
24
  }))), { attrs: { group: "storm-software" } });
25
- return require_write_file.writeFile(options?.destination ? require_is_file.isDirectory(options.destination) ? require_join_paths.joinPaths(options.destination, `${(/* @__PURE__ */ new Date()).getTime()}.tar.gz`) : options.destination : require_is_file.isDirectory(directory) ? `${require_join_paths.joinPaths(require_resolve_parent_path.resolveParentPath(directory), require_file_path_fns.findFolderName(directory))}.tar.gz` : directory, require_uint8_array_to_string.uint8ArrayToString(data));
25
+ return require_write_file.writeFile(options?.destination ? require_is_file.isDirectory(options.destination) ? (0, _stryke_path_join_paths.joinPaths)(options.destination, `${(/* @__PURE__ */ new Date()).getTime()}.tar.gz`) : options.destination : require_is_file.isDirectory(directory) ? `${(0, _stryke_path_join_paths.joinPaths)((0, _stryke_path.resolveParentPath)(directory), (0, _stryke_path.findFolderName)(directory))}.tar.gz` : directory, (0, _stryke_convert_uint8_array_to_string.uint8ArrayToString)(data));
26
26
  }
27
27
 
28
28
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"compress.d.cts","names":[],"sources":["../src/compress.ts"],"sourcesContent":[],"mappings":";;;UA4BiB,wBAAA,SAAiC;;AAAlD;AAUA;;;;;;iBAAsB,iBAAA,8BAEV,2BACT"}
1
+ {"version":3,"file":"compress.d.cts","names":[],"sources":["../src/compress.ts"],"mappings":";;;UA4BiB,wBAAA,SAAiC,WAAA;EAChD,WAAA;AAAA;;;;;AASF;;iBAAsB,iBAAA,CACpB,SAAA,UACA,OAAA,GAAU,wBAAA,GACT,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"compress.d.mts","names":[],"sources":["../src/compress.ts"],"sourcesContent":[],"mappings":";;;UA4BiB,wBAAA,SAAiC;;AAAlD;AAUA;;;;;;iBAAsB,iBAAA,8BAEV,2BACT"}
1
+ {"version":3,"file":"compress.d.mts","names":[],"sources":["../src/compress.ts"],"mappings":";;;UA4BiB,wBAAA,SAAiC,WAAA;EAChD,WAAA;AAAA;;;;;AASF;;iBAAsB,iBAAA,CACpB,SAAA,UACA,OAAA,GAAU,wBAAA,GACT,OAAA"}
package/dist/compress.mjs CHANGED
@@ -1,12 +1,11 @@
1
- import { joinPaths } from "./path/src/join-paths.mjs";
2
- import { findFolderName } from "./path/src/file-path-fns.mjs";
3
- import { resolveParentPath } from "./path/src/resolve-parent-path.mjs";
4
- import { uint8ArrayToString } from "./convert/src/uint8-array-to-string.mjs";
5
1
  import { isDirectory } from "./is-file.mjs";
6
2
  import { listFiles } from "./list-files.mjs";
7
3
  import { readFileIfExisting } from "./read-file.mjs";
8
4
  import { writeFile } from "./write-file.mjs";
5
+ import { findFolderName, resolveParentPath } from "@stryke/path";
9
6
  import { createTarGzip } from "nanotar";
7
+ import { uint8ArrayToString } from "@stryke/convert/uint8-array-to-string";
8
+ import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
10
9
 
11
10
  //#region src/compress.ts
12
11
  /**
@@ -16,12 +15,12 @@ import { createTarGzip } from "nanotar";
16
15
  * @param options - Options for the compression.
17
16
  */
18
17
  async function compressDirectory(directory, options) {
19
- const files = await listFiles(isDirectory(directory) ? joinPaths(directory, "**/*") : directory, options);
18
+ const files = await listFiles(isDirectory(directory) ? joinPaths$1(directory, "**/*") : directory, options);
20
19
  const data = await createTarGzip(await Promise.all(files.map(async (file) => ({
21
20
  name: file,
22
21
  data: await readFileIfExisting(file)
23
22
  }))), { attrs: { group: "storm-software" } });
24
- return writeFile(options?.destination ? isDirectory(options.destination) ? joinPaths(options.destination, `${(/* @__PURE__ */ new Date()).getTime()}.tar.gz`) : options.destination : isDirectory(directory) ? `${joinPaths(resolveParentPath(directory), findFolderName(directory))}.tar.gz` : directory, uint8ArrayToString(data));
23
+ return writeFile(options?.destination ? isDirectory(options.destination) ? joinPaths$1(options.destination, `${(/* @__PURE__ */ new Date()).getTime()}.tar.gz`) : options.destination : isDirectory(directory) ? `${joinPaths$1(resolveParentPath(directory), findFolderName(directory))}.tar.gz` : directory, uint8ArrayToString(data));
25
24
  }
26
25
 
27
26
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"compress.mjs","names":[],"sources":["../src/compress.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { uint8ArrayToString } from \"@stryke/convert/uint8-array-to-string\";\nimport { findFolderName, resolveParentPath } from \"@stryke/path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { GlobOptions } from \"glob\";\nimport { createTarGzip } from \"nanotar\";\nimport { isDirectory } from \"./is-file\";\nimport { listFiles } from \"./list-files\";\nimport { readFileIfExisting } from \"./read-file\";\nimport { writeFile } from \"./write-file\";\n\nexport interface CompressDirectoryOptions extends GlobOptions {\n destination?: string;\n}\n\n/**\n * Compress a directory or file into a tar.gz archive.\n *\n * @param directory - The source directory or file/glob to compress.\n * @param options - Options for the compression.\n */\nexport async function compressDirectory(\n directory: string,\n options?: CompressDirectoryOptions\n): Promise<void> {\n const files = await listFiles(\n isDirectory(directory) ? joinPaths(directory, \"**/*\") : directory,\n options\n );\n const data = await createTarGzip(\n await Promise.all(\n files.map(async file => ({\n name: file,\n data: await readFileIfExisting(file)\n }))\n ),\n {\n attrs: { group: \"storm-software\" }\n }\n );\n\n return writeFile(\n options?.destination\n ? isDirectory(options.destination)\n ? joinPaths(options.destination, `${new Date().getTime()}.tar.gz`)\n : options.destination\n : isDirectory(directory)\n ? `${joinPaths(resolveParentPath(directory), findFolderName(directory))}.tar.gz`\n : directory,\n uint8ArrayToString(data)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,eAAsB,kBACpB,WACA,SACe;CACf,MAAM,QAAQ,MAAM,UAClB,YAAY,UAAU,GAAG,UAAU,WAAW,OAAO,GAAG,WACxD,QACD;CACD,MAAM,OAAO,MAAM,cACjB,MAAM,QAAQ,IACZ,MAAM,IAAI,OAAM,UAAS;EACvB,MAAM;EACN,MAAM,MAAM,mBAAmB,KAAK;EACrC,EAAE,CACJ,EACD,EACE,OAAO,EAAE,OAAO,kBAAkB,EACnC,CACF;AAED,QAAO,UACL,SAAS,cACL,YAAY,QAAQ,YAAY,GAC9B,UAAU,QAAQ,aAAa,oBAAG,IAAI,MAAM,EAAC,SAAS,CAAC,SAAS,GAChE,QAAQ,cACV,YAAY,UAAU,GACpB,GAAG,UAAU,kBAAkB,UAAU,EAAE,eAAe,UAAU,CAAC,CAAC,WACtE,WACN,mBAAmB,KAAK,CACzB"}
1
+ {"version":3,"file":"compress.mjs","names":["joinPaths"],"sources":["../src/compress.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { uint8ArrayToString } from \"@stryke/convert/uint8-array-to-string\";\nimport { findFolderName, resolveParentPath } from \"@stryke/path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { GlobOptions } from \"glob\";\nimport { createTarGzip } from \"nanotar\";\nimport { isDirectory } from \"./is-file\";\nimport { listFiles } from \"./list-files\";\nimport { readFileIfExisting } from \"./read-file\";\nimport { writeFile } from \"./write-file\";\n\nexport interface CompressDirectoryOptions extends GlobOptions {\n destination?: string;\n}\n\n/**\n * Compress a directory or file into a tar.gz archive.\n *\n * @param directory - The source directory or file/glob to compress.\n * @param options - Options for the compression.\n */\nexport async function compressDirectory(\n directory: string,\n options?: CompressDirectoryOptions\n): Promise<void> {\n const files = await listFiles(\n isDirectory(directory) ? joinPaths(directory, \"**/*\") : directory,\n options\n );\n const data = await createTarGzip(\n await Promise.all(\n files.map(async file => ({\n name: file,\n data: await readFileIfExisting(file)\n }))\n ),\n {\n attrs: { group: \"storm-software\" }\n }\n );\n\n return writeFile(\n options?.destination\n ? isDirectory(options.destination)\n ? joinPaths(options.destination, `${new Date().getTime()}.tar.gz`)\n : options.destination\n : isDirectory(directory)\n ? `${joinPaths(resolveParentPath(directory), findFolderName(directory))}.tar.gz`\n : directory,\n uint8ArrayToString(data)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,eAAsB,kBACpB,WACA,SACe;CACf,MAAM,QAAQ,MAAM,UAClB,YAAY,UAAU,GAAGA,YAAU,WAAW,OAAO,GAAG,WACxD,QACD;CACD,MAAM,OAAO,MAAM,cACjB,MAAM,QAAQ,IACZ,MAAM,IAAI,OAAM,UAAS;EACvB,MAAM;EACN,MAAM,MAAM,mBAAmB,KAAK;EACrC,EAAE,CACJ,EACD,EACE,OAAO,EAAE,OAAO,kBAAkB,EACnC,CACF;AAED,QAAO,UACL,SAAS,cACL,YAAY,QAAQ,YAAY,GAC9BA,YAAU,QAAQ,aAAa,oBAAG,IAAI,MAAM,EAAC,SAAS,CAAC,SAAS,GAChE,QAAQ,cACV,YAAY,UAAU,GACpB,GAAGA,YAAU,kBAAkB,UAAU,EAAE,eAAe,UAAU,CAAC,CAAC,WACtE,WACN,mBAAmB,KAAK,CACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";KAkBY,QAAA"}
1
+ {"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"mappings":";KAkBY,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";KAkBY,QAAA"}
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"mappings":";KAkBY,QAAA"}
@@ -1,17 +1,18 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_join_paths = require('./path/src/join-paths.cjs');
3
- const require_is_string = require('./type-checks/src/is-string.cjs');
4
- const require_correct_path = require('./path/src/correct-path.cjs');
5
- const require_file_path_fns = require('./path/src/file-path-fns.cjs');
6
- const require_replace = require('./path/src/replace.cjs');
7
- const require_resolve_parent_path = require('./path/src/resolve-parent-path.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
8
3
  const require_exists = require('./exists.cjs');
9
4
  const require_helpers = require('./helpers.cjs');
10
5
  const require_is_file = require('./is-file.cjs');
6
+ const require_is_string = require('./type-checks/src/is-string.cjs');
11
7
  require('./type-checks/src/index.cjs');
12
8
  const require_list_files = require('./list-files.cjs');
13
9
  let node_fs = require("node:fs");
14
10
  let node_fs_promises = require("node:fs/promises");
11
+ let _stryke_path_correct_path = require("@stryke/path/correct-path");
12
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
13
+ let _stryke_path_join = require("@stryke/path/join");
14
+ let _stryke_path_replace = require("@stryke/path/replace");
15
+ let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
15
16
  let mlly = require("mlly");
16
17
 
17
18
  //#region src/copy-file.ts
@@ -25,9 +26,9 @@ let mlly = require("mlly");
25
26
  async function copyFile(source, destination) {
26
27
  const src = source instanceof URL ? (0, mlly.fileURLToPath)(source) : source;
27
28
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
28
- if (!require_file_path_fns.hasFileExtension(dest)) {
29
- if (!require_exists.existsSync(require_resolve_parent_path.resolveParentPath(dest))) await require_helpers.createDirectory(require_resolve_parent_path.resolveParentPath(dest));
30
- } else if (!require_exists.existsSync(require_file_path_fns.findFilePath(dest))) await require_helpers.createDirectory(require_file_path_fns.findFilePath(dest));
29
+ if (!(0, _stryke_path_file_path_fns.hasFileExtension)(dest)) {
30
+ if (!require_exists.existsSync((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest))) await require_helpers.createDirectory((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest));
31
+ } else if (!require_exists.existsSync((0, _stryke_path_file_path_fns.findFilePath)(dest))) await require_helpers.createDirectory((0, _stryke_path_file_path_fns.findFilePath)(dest));
31
32
  if (require_is_string.isString(src) && require_exists.existsSync(src)) return (0, node_fs_promises.copyFile)(src, dest);
32
33
  }
33
34
  /**
@@ -40,9 +41,9 @@ async function copyFile(source, destination) {
40
41
  function copyFileSync(source, destination) {
41
42
  const src = source instanceof URL ? (0, mlly.fileURLToPath)(source) : source;
42
43
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
43
- if (!require_file_path_fns.hasFileExtension(dest)) {
44
- if (!require_exists.existsSync(require_resolve_parent_path.resolveParentPath(dest))) require_helpers.createDirectorySync(require_resolve_parent_path.resolveParentPath(dest));
45
- } else if (!require_exists.existsSync(require_file_path_fns.findFilePath(dest))) require_helpers.createDirectorySync(require_file_path_fns.findFilePath(dest));
44
+ if (!(0, _stryke_path_file_path_fns.hasFileExtension)(dest)) {
45
+ if (!require_exists.existsSync((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest))) require_helpers.createDirectorySync((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest));
46
+ } else if (!require_exists.existsSync((0, _stryke_path_file_path_fns.findFilePath)(dest))) require_helpers.createDirectorySync((0, _stryke_path_file_path_fns.findFilePath)(dest));
46
47
  if (require_is_string.isString(src) && require_exists.existsSync(src)) return (0, node_fs.copyFileSync)(src, dest);
47
48
  }
48
49
  /**
@@ -57,7 +58,7 @@ async function copyFiles(source, destination) {
57
58
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
58
59
  if (require_is_string.isString(src) && require_is_file.isFile(src)) return copyFile(src, dest);
59
60
  return Promise.all((await require_list_files.listFiles(src)).map(async (entryPath) => {
60
- const destFile = require_join_paths.joinPaths(dest, require_replace.replacePath(entryPath, require_is_string.isString(src) ? require_correct_path.stripStars(src) : src.input));
61
+ const destFile = (0, _stryke_path_join.joinPaths)(dest, (0, _stryke_path_replace.replacePath)(entryPath, require_is_string.isString(src) ? (0, _stryke_path_correct_path.stripStars)(src) : src.input));
61
62
  if (require_is_file.isDirectory(entryPath)) await copyFiles(entryPath, destFile);
62
63
  else await copyFile(entryPath, destFile);
63
64
  }));
@@ -74,7 +75,7 @@ function copyFilesSync(source, destination) {
74
75
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
75
76
  if (require_is_string.isString(src) && require_is_file.isFile(src)) return copyFileSync(src, dest);
76
77
  return require_list_files.listFilesSync(src).map((entryPath) => {
77
- const destFile = require_join_paths.joinPaths(dest, require_replace.replacePath(entryPath, require_is_string.isString(src) ? require_correct_path.stripStars(src) : src.input));
78
+ const destFile = (0, _stryke_path_join.joinPaths)(dest, (0, _stryke_path_replace.replacePath)(entryPath, require_is_string.isString(src) ? (0, _stryke_path_correct_path.stripStars)(src) : src.input));
78
79
  if (require_is_file.isDirectory(entryPath)) copyFilesSync(entryPath, destFile);
79
80
  else copyFileSync(entryPath, destFile);
80
81
  });
@@ -1,7 +1,6 @@
1
1
  import { AssetGlob } from "./types/src/file.cjs";
2
2
 
3
3
  //#region src/copy-file.d.ts
4
-
5
4
  /**
6
5
  * Copy a file from one location to another
7
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"copy-file.d.cts","names":[],"sources":["../src/copy-file.ts"],"sourcesContent":[],"mappings":";;;;;;AAwCA;;;;;AA4BgB,iBA5BM,QAAA,CA4BwB,MAA2B,EAAG,MAAA,GA3BzD,GA2ByD,EAAA,WAAA,EAAA,MAAA,GA1BpD,GA0BoD,CAAA,EA1BjD,OA0BiD,CAAA,IAAA,CAAA;AAyB5E;;;;;;;AAmCgB,iBA5DA,YAAA,CA4Da,MAAA,EAAA,MAAA,GA5DiB,GA4DjB,EAAA,WAAA,EAAA,MAAA,GA5D4C,GA4D5C,CAAA,EAAA,IAAA;;;;;;;;iBAnCP,SAAA,kBACH,MAAM,KAAK,4CACN,MAAG;;;;;;;;iBAiCX,aAAA,kBACG,MAAM,KAAK,4CACN"}
1
+ {"version":3,"file":"copy-file.d.cts","names":[],"sources":["../src/copy-file.ts"],"mappings":";;;;;AAwCA;;;;;iBAAsB,QAAA,CACpB,MAAA,WAAiB,GAAA,EACjB,WAAA,WAAsB,GAAA,GAAG,OAAA;;;;;;;;iBA0BX,YAAA,CAAa,MAAA,WAAiB,GAAA,EAAK,WAAA,WAAsB,GAAA;;AAAzE;;;;;;iBAyBsB,SAAA,CACpB,MAAA,WAAiB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC5B,WAAA,WAAsB,GAAA,GAAG,OAAA;;;;AAF3B;;;;iBAmCgB,aAAA,CACd,MAAA,WAAiB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC5B,WAAA,WAAsB,GAAA"}
@@ -1,7 +1,6 @@
1
1
  import { AssetGlob } from "./types/src/file.mjs";
2
2
 
3
3
  //#region src/copy-file.d.ts
4
-
5
4
  /**
6
5
  * Copy a file from one location to another
7
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"copy-file.d.mts","names":[],"sources":["../src/copy-file.ts"],"sourcesContent":[],"mappings":";;;;;;AAwCA;;;;;AA4BgB,iBA5BM,QAAA,CA4BwB,MAA2B,EAAG,MAAA,GA3BzD,GA2ByD,EAAA,WAAA,EAAA,MAAA,GA1BpD,GA0BoD,CAAA,EA1BjD,OA0BiD,CAAA,IAAA,CAAA;AAyB5E;;;;;;;AAmCgB,iBA5DA,YAAA,CA4Da,MAAA,EAAA,MAAA,GA5DiB,GA4DjB,EAAA,WAAA,EAAA,MAAA,GA5D4C,GA4D5C,CAAA,EAAA,IAAA;;;;;;;;iBAnCP,SAAA,kBACH,MAAM,KAAK,4CACN,MAAG;;;;;;;;iBAiCX,aAAA,kBACG,MAAM,KAAK,4CACN"}
1
+ {"version":3,"file":"copy-file.d.mts","names":[],"sources":["../src/copy-file.ts"],"mappings":";;;;;AAwCA;;;;;iBAAsB,QAAA,CACpB,MAAA,WAAiB,GAAA,EACjB,WAAA,WAAsB,GAAA,GAAG,OAAA;;;;;;;;iBA0BX,YAAA,CAAa,MAAA,WAAiB,GAAA,EAAK,WAAA,WAAsB,GAAA;;AAAzE;;;;;;iBAyBsB,SAAA,CACpB,MAAA,WAAiB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC5B,WAAA,WAAsB,GAAA,GAAG,OAAA;;;;AAF3B;;;;iBAmCgB,aAAA,CACd,MAAA,WAAiB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC5B,WAAA,WAAsB,GAAA"}
@@ -1,16 +1,16 @@
1
- import { joinPaths } from "./path/src/join-paths.mjs";
2
- import { isString } from "./type-checks/src/is-string.mjs";
3
- import { stripStars } from "./path/src/correct-path.mjs";
4
- import { findFilePath, hasFileExtension } from "./path/src/file-path-fns.mjs";
5
- import { replacePath } from "./path/src/replace.mjs";
6
- import { resolveParentPath } from "./path/src/resolve-parent-path.mjs";
7
1
  import { existsSync as existsSync$1 } from "./exists.mjs";
8
2
  import { createDirectory, createDirectorySync } from "./helpers.mjs";
9
3
  import { isDirectory, isFile } from "./is-file.mjs";
4
+ import { isString } from "./type-checks/src/is-string.mjs";
10
5
  import "./type-checks/src/index.mjs";
11
6
  import { listFiles, listFilesSync } from "./list-files.mjs";
12
7
  import { copyFileSync as copyFileSync$1 } from "node:fs";
13
8
  import { copyFile as copyFile$1 } from "node:fs/promises";
9
+ import { stripStars } from "@stryke/path/correct-path";
10
+ import { findFilePath, hasFileExtension } from "@stryke/path/file-path-fns";
11
+ import { joinPaths } from "@stryke/path/join";
12
+ import { replacePath } from "@stryke/path/replace";
13
+ import { resolveParentPath } from "@stryke/path/resolve-parent-path";
14
14
  import { fileURLToPath } from "mlly";
15
15
 
16
16
  //#region src/copy-file.ts
package/dist/exists.cjs CHANGED
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  let node_fs = require("node:fs");
3
4
  let node_fs_promises = require("node:fs/promises");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"exists.d.cts","names":[],"sources":["../src/exists.ts"],"sourcesContent":[],"mappings":";;AA2BA;AAUA;;;;iBAVgB,UAAA;;;;;;;iBAUM,MAAA,oBAA0B"}
1
+ {"version":3,"file":"exists.d.cts","names":[],"sources":["../src/exists.ts"],"mappings":";;AA2BA;;;;;iBAAgB,UAAA,CAAW,QAAA;;;;;;;iBAUL,MAAA,CAAO,QAAA,WAAmB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"exists.d.mts","names":[],"sources":["../src/exists.ts"],"sourcesContent":[],"mappings":";;AA2BA;AAUA;;;;iBAVgB,UAAA;;;;;;;iBAUM,MAAA,oBAA0B"}
1
+ {"version":3,"file":"exists.d.mts","names":[],"sources":["../src/exists.ts"],"mappings":";;AA2BA;;;;;iBAAgB,UAAA,CAAW,QAAA;;;;;;;iBAUL,MAAA,CAAO,QAAA,WAAmB,OAAA"}
@@ -1,10 +1,11 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_cwd = require('./path/src/cwd.cjs');
3
- const require_join_paths = require('./path/src/join-paths.cjs');
4
- const require_resolve_parent_path = require('./path/src/resolve-parent-path.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
5
3
  const require_is_file = require('./is-file.cjs');
6
- const require_to_array = require('./convert/src/to-array.cjs');
7
4
  let node_fs = require("node:fs");
5
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
6
+ let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
7
+ let _stryke_convert_to_array = require("@stryke/convert/to-array");
8
+ let _stryke_path_cwd = require("@stryke/path/cwd");
8
9
 
9
10
  //#region src/get-parent-path.ts
10
11
  /**
@@ -14,18 +15,18 @@ let node_fs = require("node:fs");
14
15
  * @param cwd - The current working directory.
15
16
  * @returns The first parent path that exists.
16
17
  */
17
- const getParentPath = (name, cwd$1 = require_cwd.cwd(), options = {}) => {
18
+ const getParentPath = (name, cwd = (0, _stryke_path_cwd.cwd)(), options = {}) => {
18
19
  const ignoreCase = options?.ignoreCase ?? true;
19
20
  const skipCwd = options?.skipCwd ?? false;
20
21
  const includeNameInResults = options?.includeNameInResults ?? false;
21
- let dir = cwd$1;
22
- if (skipCwd) dir = require_resolve_parent_path.resolveParentPath(cwd$1);
23
- let names = require_to_array.toArray(name);
24
- if (ignoreCase) names = names.map((name$1) => name$1.toLowerCase());
22
+ let dir = cwd;
23
+ if (skipCwd) dir = (0, _stryke_path_resolve_parent_path.resolveParentPath)(cwd);
24
+ let names = (0, _stryke_convert_to_array.toArray)(name);
25
+ if (ignoreCase) names = names.map((name) => name.toLowerCase());
25
26
  while (true) {
26
- const target = names.find((name$1) => (0, node_fs.existsSync)(require_join_paths.joinPaths(dir, name$1)));
27
- if (target) return includeNameInResults || require_is_file.isDirectory(require_join_paths.joinPaths(dir, target)) ? require_join_paths.joinPaths(dir, target) : dir;
28
- const parentDir = require_resolve_parent_path.resolveParentPath(dir);
27
+ const target = names.find((name) => (0, node_fs.existsSync)((0, _stryke_path_join_paths.joinPaths)(dir, name)));
28
+ if (target) return includeNameInResults || require_is_file.isDirectory((0, _stryke_path_join_paths.joinPaths)(dir, target)) ? (0, _stryke_path_join_paths.joinPaths)(dir, target) : dir;
29
+ const parentDir = (0, _stryke_path_resolve_parent_path.resolveParentPath)(dir);
29
30
  if (parentDir === dir) return;
30
31
  dir = parentDir;
31
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-parent-path.d.cts","names":[],"sources":["../src/get-parent-path.ts"],"sourcesContent":[],"mappings":";UAyBiB,oBAAA;EAAA;AA8BjB;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,iEAGF,QAAQ"}
1
+ {"version":3,"file":"get-parent-path.d.cts","names":[],"sources":["../src/get-parent-path.ts"],"mappings":";UAyBiB,oBAAA;EAAA;;;;;EAMf,UAAA;EAcA;;;AAUF;;EAjBE,OAAA;EAoBgB;;;;;EAbhB,oBAAA;AAAA;;;;;;;;cAUW,aAAA,GACX,IAAA,qBACA,GAAA,WACA,OAAA,GAAS,OAAA,CAAQ,oBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-parent-path.d.mts","names":[],"sources":["../src/get-parent-path.ts"],"sourcesContent":[],"mappings":";UAyBiB,oBAAA;EAAA;AA8BjB;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,iEAGF,QAAQ"}
1
+ {"version":3,"file":"get-parent-path.d.mts","names":[],"sources":["../src/get-parent-path.ts"],"mappings":";UAyBiB,oBAAA;EAAA;;;;;EAMf,UAAA;EAcA;;;AAUF;;EAjBE,OAAA;EAoBgB;;;;;EAbhB,oBAAA;AAAA;;;;;;;;cAUW,aAAA,GACX,IAAA,qBACA,GAAA,WACA,OAAA,GAAS,OAAA,CAAQ,oBAAA"}
@@ -1,9 +1,9 @@
1
- import { cwd } from "./path/src/cwd.mjs";
2
- import { joinPaths } from "./path/src/join-paths.mjs";
3
- import { resolveParentPath } from "./path/src/resolve-parent-path.mjs";
4
1
  import { isDirectory } from "./is-file.mjs";
5
- import { toArray } from "./convert/src/to-array.mjs";
6
2
  import { existsSync } from "node:fs";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import { resolveParentPath } from "@stryke/path/resolve-parent-path";
5
+ import { toArray } from "@stryke/convert/to-array";
6
+ import { cwd } from "@stryke/path/cwd";
7
7
 
8
8
  //#region src/get-parent-path.ts
9
9
  /**
@@ -20,9 +20,9 @@ const getParentPath = (name, cwd$1 = cwd(), options = {}) => {
20
20
  let dir = cwd$1;
21
21
  if (skipCwd) dir = resolveParentPath(cwd$1);
22
22
  let names = toArray(name);
23
- if (ignoreCase) names = names.map((name$1) => name$1.toLowerCase());
23
+ if (ignoreCase) names = names.map((name) => name.toLowerCase());
24
24
  while (true) {
25
- const target = names.find((name$1) => existsSync(joinPaths(dir, name$1)));
25
+ const target = names.find((name) => existsSync(joinPaths(dir, name)));
26
26
  if (target) return includeNameInResults || isDirectory(joinPaths(dir, target)) ? joinPaths(dir, target) : dir;
27
27
  const parentDir = resolveParentPath(dir);
28
28
  if (parentDir === dir) return;
@@ -1 +1 @@
1
- {"version":3,"file":"get-parent-path.mjs","names":["currentDir","cwd","name"],"sources":["../src/get-parent-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { cwd as currentDir } from \"@stryke/path/cwd\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { existsSync } from \"node:fs\";\nimport { isDirectory } from \"./is-file\";\n\nexport interface GetParentPathOptions {\n /**\n * Whether to ignore the case of the file names when checking for existence.\n *\n * @defaultValue true\n */\n ignoreCase: boolean;\n\n /**\n * Whether to skip the current working directory when checking for the file.\n *\n * @defaultValue false\n */\n skipCwd: boolean;\n\n /**\n * Should we include the found file/directory name in the results.\n *\n * @defaultValue false\n */\n includeNameInResults?: boolean;\n}\n\n/**\n * Get the first parent path that has a file or directory with the provided name.\n *\n * @param name - The name (or names) of the file to look for in the parent paths.\n * @param cwd - The current working directory.\n * @returns The first parent path that exists.\n */\nexport const getParentPath = (\n name: string | string[],\n cwd = currentDir(),\n options: Partial<GetParentPathOptions> = {}\n): string | undefined => {\n const ignoreCase = options?.ignoreCase ?? true;\n const skipCwd = options?.skipCwd ?? false;\n const includeNameInResults = options?.includeNameInResults ?? false;\n\n let dir = cwd;\n if (skipCwd) {\n dir = resolveParentPath(cwd);\n }\n\n let names = toArray(name);\n if (ignoreCase) {\n names = names.map(name => name.toLowerCase());\n }\n\n while (true) {\n const target = names.find(name => existsSync(joinPaths(dir, name)));\n if (target) {\n return includeNameInResults || isDirectory(joinPaths(dir, target))\n ? joinPaths(dir, target)\n : dir;\n }\n\n const parentDir = resolveParentPath(dir);\n if (parentDir === dir) {\n // It'll fail anyway\n return undefined;\n }\n\n dir = parentDir;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,MAAa,iBACX,MACA,QAAMA,KAAY,EAClB,UAAyC,EAAE,KACpB;CACvB,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,UAAU,SAAS,WAAW;CACpC,MAAM,uBAAuB,SAAS,wBAAwB;CAE9D,IAAI,MAAMC;AACV,KAAI,QACF,OAAM,kBAAkBA,MAAI;CAG9B,IAAI,QAAQ,QAAQ,KAAK;AACzB,KAAI,WACF,SAAQ,MAAM,KAAI,WAAQC,OAAK,aAAa,CAAC;AAG/C,QAAO,MAAM;EACX,MAAM,SAAS,MAAM,MAAK,WAAQ,WAAW,UAAU,KAAKA,OAAK,CAAC,CAAC;AACnE,MAAI,OACF,QAAO,wBAAwB,YAAY,UAAU,KAAK,OAAO,CAAC,GAC9D,UAAU,KAAK,OAAO,GACtB;EAGN,MAAM,YAAY,kBAAkB,IAAI;AACxC,MAAI,cAAc,IAEhB;AAGF,QAAM"}
1
+ {"version":3,"file":"get-parent-path.mjs","names":["currentDir","cwd"],"sources":["../src/get-parent-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { cwd as currentDir } from \"@stryke/path/cwd\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { existsSync } from \"node:fs\";\nimport { isDirectory } from \"./is-file\";\n\nexport interface GetParentPathOptions {\n /**\n * Whether to ignore the case of the file names when checking for existence.\n *\n * @defaultValue true\n */\n ignoreCase: boolean;\n\n /**\n * Whether to skip the current working directory when checking for the file.\n *\n * @defaultValue false\n */\n skipCwd: boolean;\n\n /**\n * Should we include the found file/directory name in the results.\n *\n * @defaultValue false\n */\n includeNameInResults?: boolean;\n}\n\n/**\n * Get the first parent path that has a file or directory with the provided name.\n *\n * @param name - The name (or names) of the file to look for in the parent paths.\n * @param cwd - The current working directory.\n * @returns The first parent path that exists.\n */\nexport const getParentPath = (\n name: string | string[],\n cwd = currentDir(),\n options: Partial<GetParentPathOptions> = {}\n): string | undefined => {\n const ignoreCase = options?.ignoreCase ?? true;\n const skipCwd = options?.skipCwd ?? false;\n const includeNameInResults = options?.includeNameInResults ?? false;\n\n let dir = cwd;\n if (skipCwd) {\n dir = resolveParentPath(cwd);\n }\n\n let names = toArray(name);\n if (ignoreCase) {\n names = names.map(name => name.toLowerCase());\n }\n\n while (true) {\n const target = names.find(name => existsSync(joinPaths(dir, name)));\n if (target) {\n return includeNameInResults || isDirectory(joinPaths(dir, target))\n ? joinPaths(dir, target)\n : dir;\n }\n\n const parentDir = resolveParentPath(dir);\n if (parentDir === dir) {\n // It'll fail anyway\n return undefined;\n }\n\n dir = parentDir;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,MAAa,iBACX,MACA,QAAMA,KAAY,EAClB,UAAyC,EAAE,KACpB;CACvB,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,UAAU,SAAS,WAAW;CACpC,MAAM,uBAAuB,SAAS,wBAAwB;CAE9D,IAAI,MAAMC;AACV,KAAI,QACF,OAAM,kBAAkBA,MAAI;CAG9B,IAAI,QAAQ,QAAQ,KAAK;AACzB,KAAI,WACF,SAAQ,MAAM,KAAI,SAAQ,KAAK,aAAa,CAAC;AAG/C,QAAO,MAAM;EACX,MAAM,SAAS,MAAM,MAAK,SAAQ,WAAW,UAAU,KAAK,KAAK,CAAC,CAAC;AACnE,MAAI,OACF,QAAO,wBAAwB,YAAY,UAAU,KAAK,OAAO,CAAC,GAC9D,UAAU,KAAK,OAAO,GACtB;EAGN,MAAM,YAAY,kBAAkB,IAAI;AACxC,MAAI,cAAc,IAEhB;AAGF,QAAM"}