@stryke/fs 0.33.79 → 0.33.81

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 (204) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +14 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  4. package/dist/buffer.cjs +12 -0
  5. package/dist/buffer.mjs +8 -1
  6. package/dist/buffer.mjs.map +1 -1
  7. package/dist/buffer.test.cjs +13 -0
  8. package/dist/buffer.test.d.cts +1 -0
  9. package/dist/buffer.test.d.mts +1 -0
  10. package/dist/buffer.test.mjs +14 -0
  11. package/dist/buffer.test.mjs.map +1 -0
  12. package/dist/chmod-x.cjs +14 -0
  13. package/dist/chmod-x.mjs +10 -1
  14. package/dist/chmod-x.mjs.map +1 -1
  15. package/dist/chmod-x.test.cjs +13 -0
  16. package/dist/chmod-x.test.d.cts +1 -0
  17. package/dist/chmod-x.test.d.mts +1 -0
  18. package/dist/chmod-x.test.mjs +14 -0
  19. package/dist/chmod-x.test.mjs.map +1 -0
  20. package/dist/command-exists.cjs +11 -1
  21. package/dist/command-exists.mjs +6 -1
  22. package/dist/command-exists.mjs.map +1 -1
  23. package/dist/command-exists.test.cjs +13 -0
  24. package/dist/command-exists.test.d.cts +1 -0
  25. package/dist/command-exists.test.d.mts +1 -0
  26. package/dist/command-exists.test.mjs +14 -0
  27. package/dist/command-exists.test.mjs.map +1 -0
  28. package/dist/compress.cjs +8 -1
  29. package/dist/compress.mjs +3 -1
  30. package/dist/compress.mjs.map +1 -1
  31. package/dist/compress.test.cjs +13 -0
  32. package/dist/compress.test.d.cts +1 -0
  33. package/dist/compress.test.d.mts +1 -0
  34. package/dist/compress.test.mjs +14 -0
  35. package/dist/compress.test.mjs.map +1 -0
  36. package/dist/constants.cjs +13 -0
  37. package/dist/constants.mjs +8 -1
  38. package/dist/constants.mjs.map +1 -0
  39. package/dist/constants.test.cjs +13 -0
  40. package/dist/constants.test.d.cts +1 -0
  41. package/dist/constants.test.d.mts +1 -0
  42. package/dist/constants.test.mjs +14 -0
  43. package/dist/constants.test.mjs.map +1 -0
  44. package/dist/copy-file.cjs +13 -1
  45. package/dist/copy-file.mjs +8 -1
  46. package/dist/copy-file.mjs.map +1 -1
  47. package/dist/copy-file.test.cjs +13 -0
  48. package/dist/copy-file.test.d.cts +1 -0
  49. package/dist/copy-file.test.d.mts +1 -0
  50. package/dist/copy-file.test.mjs +14 -0
  51. package/dist/copy-file.test.mjs.map +1 -0
  52. package/dist/exists.cjs +11 -1
  53. package/dist/exists.mjs +6 -1
  54. package/dist/exists.mjs.map +1 -1
  55. package/dist/exists.test.cjs +13 -0
  56. package/dist/exists.test.d.cts +1 -0
  57. package/dist/exists.test.d.mts +1 -0
  58. package/dist/exists.test.mjs +14 -0
  59. package/dist/exists.test.mjs.map +1 -0
  60. package/dist/get-parent-path.cjs +8 -1
  61. package/dist/get-parent-path.mjs +3 -1
  62. package/dist/get-parent-path.mjs.map +1 -1
  63. package/dist/get-parent-path.test.cjs +13 -0
  64. package/dist/get-parent-path.test.d.cts +1 -0
  65. package/dist/get-parent-path.test.d.mts +1 -0
  66. package/dist/get-parent-path.test.mjs +14 -0
  67. package/dist/get-parent-path.test.mjs.map +1 -0
  68. package/dist/get-workspace-root.cjs +16 -0
  69. package/dist/get-workspace-root.mjs +12 -1
  70. package/dist/get-workspace-root.mjs.map +1 -1
  71. package/dist/get-workspace-root.test.cjs +13 -0
  72. package/dist/get-workspace-root.test.d.cts +1 -0
  73. package/dist/get-workspace-root.test.d.mts +1 -0
  74. package/dist/get-workspace-root.test.mjs +14 -0
  75. package/dist/get-workspace-root.test.mjs.map +1 -0
  76. package/dist/helpers.cjs +14 -0
  77. package/dist/helpers.mjs +10 -1
  78. package/dist/helpers.mjs.map +1 -1
  79. package/dist/helpers.test.cjs +13 -0
  80. package/dist/helpers.test.d.cts +1 -0
  81. package/dist/helpers.test.d.mts +1 -0
  82. package/dist/helpers.test.mjs +14 -0
  83. package/dist/helpers.test.mjs.map +1 -0
  84. package/dist/index.cjs +111 -0
  85. package/dist/index.mjs +107 -1
  86. package/dist/index.mjs.map +1 -0
  87. package/dist/index.test.cjs +13 -0
  88. package/dist/index.test.d.cts +1 -0
  89. package/dist/index.test.d.mts +1 -0
  90. package/dist/index.test.mjs +14 -0
  91. package/dist/index.test.mjs.map +1 -0
  92. package/dist/install.cjs +10 -0
  93. package/dist/install.mjs +6 -1
  94. package/dist/install.mjs.map +1 -1
  95. package/dist/install.test.cjs +13 -0
  96. package/dist/install.test.d.cts +1 -0
  97. package/dist/install.test.d.mts +1 -0
  98. package/dist/install.test.mjs +14 -0
  99. package/dist/install.test.mjs.map +1 -0
  100. package/dist/is-file.cjs +13 -1
  101. package/dist/is-file.mjs +8 -1
  102. package/dist/is-file.mjs.map +1 -1
  103. package/dist/is-file.test.cjs +13 -0
  104. package/dist/is-file.test.d.cts +1 -0
  105. package/dist/is-file.test.d.mts +1 -0
  106. package/dist/is-file.test.mjs +14 -0
  107. package/dist/is-file.test.mjs.map +1 -0
  108. package/dist/json.cjs +12 -0
  109. package/dist/json.mjs +8 -1
  110. package/dist/json.mjs.map +1 -1
  111. package/dist/json.test.cjs +13 -0
  112. package/dist/json.test.d.cts +1 -0
  113. package/dist/json.test.d.mts +1 -0
  114. package/dist/json.test.mjs +14 -0
  115. package/dist/json.test.mjs.map +1 -0
  116. package/dist/list-files.cjs +15 -1
  117. package/dist/list-files.mjs +10 -1
  118. package/dist/list-files.mjs.map +1 -1
  119. package/dist/list-files.test.cjs +13 -0
  120. package/dist/list-files.test.d.cts +1 -0
  121. package/dist/list-files.test.d.mts +1 -0
  122. package/dist/list-files.test.mjs +14 -0
  123. package/dist/list-files.test.mjs.map +1 -0
  124. package/dist/package-fns.cjs +16 -1
  125. package/dist/package-fns.mjs +11 -1
  126. package/dist/package-fns.mjs.map +1 -1
  127. package/dist/package-fns.test.cjs +13 -0
  128. package/dist/package-fns.test.d.cts +1 -0
  129. package/dist/package-fns.test.d.mts +1 -0
  130. package/dist/package-fns.test.mjs +14 -0
  131. package/dist/package-fns.test.mjs.map +1 -0
  132. package/dist/read-file.cjs +13 -1
  133. package/dist/read-file.mjs +8 -1
  134. package/dist/read-file.mjs.map +1 -1
  135. package/dist/read-file.test.cjs +13 -0
  136. package/dist/read-file.test.d.cts +1 -0
  137. package/dist/read-file.test.d.mts +1 -0
  138. package/dist/read-file.test.mjs +14 -0
  139. package/dist/read-file.test.mjs.map +1 -0
  140. package/dist/registry.cjs +13 -0
  141. package/dist/registry.mjs +9 -1
  142. package/dist/registry.mjs.map +1 -1
  143. package/dist/registry.test.cjs +13 -0
  144. package/dist/registry.test.d.cts +1 -0
  145. package/dist/registry.test.d.mts +1 -0
  146. package/dist/registry.test.mjs +14 -0
  147. package/dist/registry.test.mjs.map +1 -0
  148. package/dist/remove-file.cjs +11 -1
  149. package/dist/remove-file.mjs +6 -1
  150. package/dist/remove-file.mjs.map +1 -1
  151. package/dist/remove-file.test.cjs +13 -0
  152. package/dist/remove-file.test.d.cts +1 -0
  153. package/dist/remove-file.test.d.mts +1 -0
  154. package/dist/remove-file.test.mjs +14 -0
  155. package/dist/remove-file.test.mjs.map +1 -0
  156. package/dist/resolve.cjs +20 -1
  157. package/dist/resolve.mjs +15 -1
  158. package/dist/resolve.mjs.map +1 -1
  159. package/dist/resolve.test.cjs +13 -0
  160. package/dist/resolve.test.d.cts +1 -0
  161. package/dist/resolve.test.d.mts +1 -0
  162. package/dist/resolve.test.mjs +14 -0
  163. package/dist/resolve.test.mjs.map +1 -0
  164. package/dist/semver-fns.cjs +20 -1
  165. package/dist/semver-fns.mjs +15 -1
  166. package/dist/semver-fns.mjs.map +1 -1
  167. package/dist/semver-fns.test.cjs +13 -0
  168. package/dist/semver-fns.test.d.cts +1 -0
  169. package/dist/semver-fns.test.d.mts +1 -0
  170. package/dist/semver-fns.test.mjs +14 -0
  171. package/dist/semver-fns.test.mjs.map +1 -0
  172. package/dist/toml.cjs +12 -0
  173. package/dist/toml.mjs +8 -1
  174. package/dist/toml.mjs.map +1 -1
  175. package/dist/toml.test.cjs +13 -0
  176. package/dist/toml.test.d.cts +1 -0
  177. package/dist/toml.test.d.mts +1 -0
  178. package/dist/toml.test.mjs +14 -0
  179. package/dist/toml.test.mjs.map +1 -0
  180. package/dist/tsconfig.cjs +8 -1
  181. package/dist/tsconfig.mjs +3 -1
  182. package/dist/tsconfig.mjs.map +1 -1
  183. package/dist/tsconfig.test.cjs +13 -0
  184. package/dist/tsconfig.test.d.cts +1 -0
  185. package/dist/tsconfig.test.d.mts +1 -0
  186. package/dist/tsconfig.test.mjs +14 -0
  187. package/dist/tsconfig.test.mjs.map +1 -0
  188. package/dist/write-file.cjs +11 -1
  189. package/dist/write-file.mjs +6 -1
  190. package/dist/write-file.mjs.map +1 -1
  191. package/dist/write-file.test.cjs +13 -0
  192. package/dist/write-file.test.d.cts +1 -0
  193. package/dist/write-file.test.d.mts +1 -0
  194. package/dist/write-file.test.mjs +14 -0
  195. package/dist/write-file.test.mjs.map +1 -0
  196. package/dist/yaml.cjs +11 -1
  197. package/dist/yaml.mjs +6 -1
  198. package/dist/yaml.mjs.map +1 -1
  199. package/dist/yaml.test.cjs +13 -0
  200. package/dist/yaml.test.d.cts +1 -0
  201. package/dist/yaml.test.d.mts +1 -0
  202. package/dist/yaml.test.mjs +14 -0
  203. package/dist/yaml.test.mjs.map +1 -0
  204. package/package.json +111 -11
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  # Changelog for Stryke - Fs
4
4
 
5
+ ## [0.33.80](https://github.com/storm-software/stryke/releases/tag/fs%400.33.80) (05/30/2026)
6
+
7
+ ### Miscellaneous
8
+
9
+ - **monorepo:** Update config file specified in `tsconfig.json` exludes ([359c616a](https://github.com/storm-software/stryke/commit/359c616a))
10
+
11
+ ### Updated Dependencies
12
+
13
+ - Updated **convert** to **v0.7.11**
14
+ - Updated **helpers** to **v0.10.20**
15
+ - Updated **json** to **v0.15.4**
16
+ - Updated **path** to **v0.29.7**
17
+ - Updated **string-format** to **v0.17.22**
18
+ - Updated **type-checks** to **v0.6.13**
19
+ - Updated **types** to **v0.12.8**
20
+
21
+ ## [0.33.79](https://github.com/storm-software/stryke/releases/tag/fs%400.33.79) (05/27/2026)
22
+
23
+ ### Updated Dependencies
24
+
25
+ - Updated **convert** to **v0.7.10**
26
+ - Updated **helpers** to **v0.10.19**
27
+ - Updated **json** to **v0.15.3**
28
+ - Updated **path** to **v0.29.6**
29
+ - Updated **string-format** to **v0.17.21**
30
+ - Updated **type-checks** to **v0.6.12**
31
+ - Updated **types** to **v0.12.7**
32
+
5
33
  ## [0.33.78](https://github.com/storm-software/stryke/releases/tag/fs%400.33.78) (05/27/2026)
6
34
 
7
35
  ### Updated Dependencies
@@ -5,6 +5,19 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
8
21
  var __copyProps = (to, from, except, desc) => {
9
22
  if (from && typeof from === "object" || typeof from === "function") {
10
23
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -26,4 +39,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
39
 
27
40
  //#endregion
28
41
 
42
+ exports.__exportAll = __exportAll;
29
43
  exports.__toESM = __toESM;
@@ -0,0 +1,18 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!no_symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll };
package/dist/buffer.cjs CHANGED
@@ -7,6 +7,12 @@ let node_fs = require("node:fs");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
 
9
9
  //#region src/buffer.ts
10
+ var buffer_exports = /* @__PURE__ */ require_runtime.__exportAll({
11
+ readFileBuffer: () => readFileBuffer,
12
+ readFileBufferSync: () => readFileBufferSync,
13
+ writeFileBuffer: () => writeFileBuffer,
14
+ writeFileBufferSync: () => writeFileBufferSync
15
+ });
10
16
  /**
11
17
  * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
12
18
  *
@@ -55,6 +61,12 @@ function writeFileBufferSync(filePath, data) {
55
61
  }
56
62
 
57
63
  //#endregion
64
+ Object.defineProperty(exports, 'buffer_exports', {
65
+ enumerable: true,
66
+ get: function () {
67
+ return buffer_exports;
68
+ }
69
+ });
58
70
  exports.readFileBuffer = readFileBuffer;
59
71
  exports.readFileBufferSync = readFileBufferSync;
60
72
  exports.writeFileBuffer = writeFileBuffer;
package/dist/buffer.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { createDirectory, createDirectorySync } from "./helpers.mjs";
2
3
  import { findFilePath } from "@stryke/path";
3
4
  import { Buffer } from "node:buffer";
@@ -5,6 +6,12 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
6
  import { readFile, writeFile } from "node:fs/promises";
6
7
 
7
8
  //#region src/buffer.ts
9
+ var buffer_exports = /* @__PURE__ */ __exportAll({
10
+ readFileBuffer: () => readFileBuffer,
11
+ readFileBufferSync: () => readFileBufferSync,
12
+ writeFileBuffer: () => writeFileBuffer,
13
+ writeFileBufferSync: () => writeFileBufferSync
14
+ });
8
15
  /**
9
16
  * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
10
17
  *
@@ -53,5 +60,5 @@ function writeFileBufferSync(filePath, data) {
53
60
  }
54
61
 
55
62
  //#endregion
56
- export { readFileBuffer, readFileBufferSync, writeFileBuffer, writeFileBufferSync };
63
+ export { buffer_exports, readFileBuffer, readFileBufferSync, writeFileBuffer, writeFileBufferSync };
57
64
  //# sourceMappingURL=buffer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.mjs","names":[],"sources":["../src/buffer.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 { findFilePath } from \"@stryke/path\";\nimport { Buffer } from \"node:buffer\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport async function readFileBuffer(filePath: string): Promise<ArrayBuffer> {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = await readFile(filePath);\n\n return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n}\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport function readFileBufferSync(filePath: string): ArrayBuffer {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = readFileSync(filePath);\n\n return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport async function writeFileBuffer(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n await createDirectory(findFilePath(filePath));\n }\n\n await writeFile(filePath, Buffer.from(data));\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport function writeFileBufferSync(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n createDirectorySync(findFilePath(filePath));\n }\n\n writeFileSync(filePath, Buffer.from(data));\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,eAAsB,eAAe,UAAwC;AAC3E,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAEvD,KAAI,CAAC,WAAW,SAAS,CACvB,OAAM,IAAI,MAAM,gCAAgC,WAAW;CAG7D,MAAM,IAAI,MAAM,SAAS,SAAS;AAElC,QAAO,EAAE,OAAO,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW;;;;;;;;AASlE,SAAgB,mBAAmB,UAA+B;AAChE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAEvD,KAAI,CAAC,WAAW,SAAS,CACvB,OAAM,IAAI,MAAM,gCAAgC,WAAW;CAG7D,MAAM,IAAI,aAAa,SAAS;AAEhC,QAAO,EAAE,OAAO,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW;;;;;;;;AASlE,eAAsB,gBAAgB,UAAkB,MAAmB;AACzE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,sCAAsC;AAExD,KAAI,CAAC,WAAW,aAAa,SAAS,CAAC,CACrC,OAAM,gBAAgB,aAAa,SAAS,CAAC;AAG/C,OAAM,UAAU,UAAU,OAAO,KAAK,KAAK,CAAC;;;;;;;;AAS9C,SAAgB,oBAAoB,UAAkB,MAAmB;AACvE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,sCAAsC;AAExD,KAAI,CAAC,WAAW,aAAa,SAAS,CAAC,CACrC,qBAAoB,aAAa,SAAS,CAAC;AAG7C,eAAc,UAAU,OAAO,KAAK,KAAK,CAAC"}
1
+ {"version":3,"file":"buffer.mjs","names":[],"sources":["../src/buffer.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 { findFilePath } from \"@stryke/path\";\nimport { Buffer } from \"node:buffer\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport async function readFileBuffer(filePath: string): Promise<ArrayBuffer> {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = await readFile(filePath);\n\n return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n}\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport function readFileBufferSync(filePath: string): ArrayBuffer {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = readFileSync(filePath);\n\n return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport async function writeFileBuffer(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n await createDirectory(findFilePath(filePath));\n }\n\n await writeFile(filePath, Buffer.from(data));\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport function writeFileBufferSync(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n createDirectorySync(findFilePath(filePath));\n }\n\n writeFileSync(filePath, Buffer.from(data));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,eAAsB,eAAe,UAAwC;AAC3E,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAEvD,KAAI,CAAC,WAAW,SAAS,CACvB,OAAM,IAAI,MAAM,gCAAgC,WAAW;CAG7D,MAAM,IAAI,MAAM,SAAS,SAAS;AAElC,QAAO,EAAE,OAAO,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW;;;;;;;;AASlE,SAAgB,mBAAmB,UAA+B;AAChE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAEvD,KAAI,CAAC,WAAW,SAAS,CACvB,OAAM,IAAI,MAAM,gCAAgC,WAAW;CAG7D,MAAM,IAAI,aAAa,SAAS;AAEhC,QAAO,EAAE,OAAO,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW;;;;;;;;AASlE,eAAsB,gBAAgB,UAAkB,MAAmB;AACzE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,sCAAsC;AAExD,KAAI,CAAC,WAAW,aAAa,SAAS,CAAC,CACrC,OAAM,gBAAgB,aAAa,SAAS,CAAC;AAG/C,OAAM,UAAU,UAAU,OAAO,KAAK,KAAK,CAAC;;;;;;;;AAS9C,SAAgB,oBAAoB,UAAkB,MAAmB;AACvE,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,sCAAsC;AAExD,KAAI,CAAC,WAAW,aAAa,SAAS,CAAC,CACrC,qBAAoB,aAAa,SAAS,CAAC;AAG7C,eAAc,UAAU,OAAO,KAAK,KAAK,CAAC"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_buffer = require('./buffer.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/buffer.test.ts
6
+ (0, vitest.describe)("buffer.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_buffer.buffer_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_buffer.buffer_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { buffer_exports } from "./buffer.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/buffer.test.ts
5
+ describe("buffer.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(buffer_exports).toBeDefined();
8
+ expect(typeof buffer_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=buffer.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer.test.mjs","names":["moduleExports"],"sources":["../src/buffer.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./buffer.ts\";\n\ndescribe(\"buffer.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,2BAA2B;AAClC,IAAG,8BAA8B;AAC/B,SAAOA,eAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,eAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
package/dist/chmod-x.cjs CHANGED
@@ -4,6 +4,14 @@ let node_fs = require("node:fs");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
 
6
6
  //#region src/chmod-x.ts
7
+ var chmod_x_exports = /* @__PURE__ */ require_runtime.__exportAll({
8
+ chmodX: () => chmodX,
9
+ chmodXSync: () => chmodXSync,
10
+ isExecutable: () => isExecutable,
11
+ isExecutableSync: () => isExecutableSync,
12
+ isWritable: () => isWritable,
13
+ isWritableSync: () => isWritableSync
14
+ });
7
15
  /**
8
16
  * Adds execute permissions to a file
9
17
  *
@@ -88,6 +96,12 @@ function isExecutableSync(filename) {
88
96
  //#endregion
89
97
  exports.chmodX = chmodX;
90
98
  exports.chmodXSync = chmodXSync;
99
+ Object.defineProperty(exports, 'chmod_x_exports', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return chmod_x_exports;
103
+ }
104
+ });
91
105
  exports.isExecutable = isExecutable;
92
106
  exports.isExecutableSync = isExecutableSync;
93
107
  exports.isWritable = isWritable;
package/dist/chmod-x.mjs CHANGED
@@ -1,7 +1,16 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { accessSync, chmodSync, constants, statSync } from "node:fs";
2
3
  import { access, chmod } from "node:fs/promises";
3
4
 
4
5
  //#region src/chmod-x.ts
6
+ var chmod_x_exports = /* @__PURE__ */ __exportAll({
7
+ chmodX: () => chmodX,
8
+ chmodXSync: () => chmodXSync,
9
+ isExecutable: () => isExecutable,
10
+ isExecutableSync: () => isExecutableSync,
11
+ isWritable: () => isWritable,
12
+ isWritableSync: () => isWritableSync
13
+ });
5
14
  /**
6
15
  * Adds execute permissions to a file
7
16
  *
@@ -84,5 +93,5 @@ function isExecutableSync(filename) {
84
93
  }
85
94
 
86
95
  //#endregion
87
- export { chmodX, chmodXSync, isExecutable, isExecutableSync, isWritable, isWritableSync };
96
+ export { chmodX, chmodXSync, chmod_x_exports, isExecutable, isExecutableSync, isWritable, isWritableSync };
88
97
  //# sourceMappingURL=chmod-x.mjs.map
@@ -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,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
+ {"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"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_chmod_x = require('./chmod-x.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/chmod-x.test.ts
6
+ (0, vitest.describe)("chmod-x.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_chmod_x.chmod_x_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_chmod_x.chmod_x_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { chmod_x_exports } from "./chmod-x.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/chmod-x.test.ts
5
+ describe("chmod-x.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(chmod_x_exports).toBeDefined();
8
+ expect(typeof chmod_x_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=chmod-x.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chmod-x.test.mjs","names":["moduleExports"],"sources":["../src/chmod-x.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./chmod-x.ts\";\n\ndescribe(\"chmod-x.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,4BAA4B;AACnC,IAAG,8BAA8B;AAC/B,SAAOA,gBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,gBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
@@ -6,6 +6,10 @@ let node_child_process = require("node:child_process");
6
6
  let node_path = require("node:path");
7
7
 
8
8
  //#region src/command-exists.ts
9
+ var command_exists_exports = /* @__PURE__ */ require_runtime.__exportAll({
10
+ commandExists: () => commandExists,
11
+ commandExistsSync: () => commandExistsSync
12
+ });
9
13
  const isUsingWindows = process.platform == "win32";
10
14
  async function fileNotExists(commandName) {
11
15
  try {
@@ -100,4 +104,10 @@ function commandExistsSync(commandName) {
100
104
 
101
105
  //#endregion
102
106
  exports.commandExists = commandExists;
103
- exports.commandExistsSync = commandExistsSync;
107
+ exports.commandExistsSync = commandExistsSync;
108
+ Object.defineProperty(exports, 'command_exists_exports', {
109
+ enumerable: true,
110
+ get: function () {
111
+ return command_exists_exports;
112
+ }
113
+ });
@@ -1,9 +1,14 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { accessSync } from "node:fs";
2
3
  import { access, constants as constants$1 } from "node:fs/promises";
3
4
  import { exec, execSync } from "node:child_process";
4
5
  import { basename, dirname } from "node:path";
5
6
 
6
7
  //#region src/command-exists.ts
8
+ var command_exists_exports = /* @__PURE__ */ __exportAll({
9
+ commandExists: () => commandExists,
10
+ commandExistsSync: () => commandExistsSync
11
+ });
7
12
  const isUsingWindows = process.platform == "win32";
8
13
  async function fileNotExists(commandName) {
9
14
  try {
@@ -97,5 +102,5 @@ function commandExistsSync(commandName) {
97
102
  }
98
103
 
99
104
  //#endregion
100
- export { commandExists, commandExistsSync };
105
+ export { commandExists, commandExistsSync, command_exists_exports };
101
106
  //# sourceMappingURL=command-exists.mjs.map
@@ -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,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"}
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"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_command_exists = require('./command-exists.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/command-exists.test.ts
6
+ (0, vitest.describe)("command-exists.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_command_exists.command_exists_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_command_exists.command_exists_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { command_exists_exports } from "./command-exists.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/command-exists.test.ts
5
+ describe("command-exists.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(command_exists_exports).toBeDefined();
8
+ expect(typeof command_exists_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=command-exists.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-exists.test.mjs","names":["moduleExports"],"sources":["../src/command-exists.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./command-exists.ts\";\n\ndescribe(\"command-exists.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,mCAAmC;AAC1C,IAAG,8BAA8B;AAC/B,SAAOA,uBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,uBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
package/dist/compress.cjs CHANGED
@@ -10,6 +10,7 @@ let _stryke_convert_uint8_array_to_string = require("@stryke/convert/uint8-array
10
10
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
11
11
 
12
12
  //#region src/compress.ts
13
+ var compress_exports = /* @__PURE__ */ require_runtime.__exportAll({ compressDirectory: () => compressDirectory });
13
14
  /**
14
15
  * Compress a directory or file into a tar.gz archive.
15
16
  *
@@ -26,4 +27,10 @@ async function compressDirectory(directory, options) {
26
27
  }
27
28
 
28
29
  //#endregion
29
- exports.compressDirectory = compressDirectory;
30
+ exports.compressDirectory = compressDirectory;
31
+ Object.defineProperty(exports, 'compress_exports', {
32
+ enumerable: true,
33
+ get: function () {
34
+ return compress_exports;
35
+ }
36
+ });
package/dist/compress.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { isDirectory } from "./is-file.mjs";
2
3
  import { listFiles } from "./list-files.mjs";
3
4
  import { readFileIfExisting } from "./read-file.mjs";
@@ -8,6 +9,7 @@ import { uint8ArrayToString } from "@stryke/convert/uint8-array-to-string";
8
9
  import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
9
10
 
10
11
  //#region src/compress.ts
12
+ var compress_exports = /* @__PURE__ */ __exportAll({ compressDirectory: () => compressDirectory });
11
13
  /**
12
14
  * Compress a directory or file into a tar.gz archive.
13
15
  *
@@ -24,5 +26,5 @@ async function compressDirectory(directory, options) {
24
26
  }
25
27
 
26
28
  //#endregion
27
- export { compressDirectory };
29
+ export { compressDirectory, compress_exports };
28
30
  //# sourceMappingURL=compress.mjs.map
@@ -1 +1 @@
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
+ {"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"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_compress = require('./compress.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/compress.test.ts
6
+ (0, vitest.describe)("compress.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_compress.compress_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_compress.compress_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { compress_exports } from "./compress.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/compress.test.ts
5
+ describe("compress.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(compress_exports).toBeDefined();
8
+ expect(typeof compress_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=compress.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compress.test.mjs","names":["moduleExports"],"sources":["../src/compress.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./compress.ts\";\n\ndescribe(\"compress.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,6BAA6B;AACpC,IAAG,8BAA8B;AAC/B,SAAOA,iBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,iBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+
4
+ //#region src/constants.ts
5
+ var constants_exports = /* @__PURE__ */ require_runtime.__exportAll({});
6
+
7
+ //#endregion
8
+ Object.defineProperty(exports, 'constants_exports', {
9
+ enumerable: true,
10
+ get: function () {
11
+ return constants_exports;
12
+ }
13
+ });
@@ -1 +1,8 @@
1
- export { };
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
+
3
+ //#region src/constants.ts
4
+ var constants_exports = /* @__PURE__ */ __exportAll({});
5
+
6
+ //#endregion
7
+ export { constants_exports };
8
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.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\nexport type Encoding =\n | \"ascii\"\n | \"utf8\"\n | \"utf-8\"\n | \"utf16le\"\n | \"utf-16le\"\n | \"ucs2\"\n | \"ucs-2\"\n | \"base64\"\n | \"base64url\"\n | \"latin1\"\n | \"binary\"\n | \"hex\";\n"],"mappings":""}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_constants = require('./constants.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/constants.test.ts
6
+ (0, vitest.describe)("constants.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_constants.constants_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_constants.constants_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { constants_exports } from "./constants.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/constants.test.ts
5
+ describe("constants.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(constants_exports).toBeDefined();
8
+ expect(typeof constants_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=constants.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.test.mjs","names":["moduleExports"],"sources":["../src/constants.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./constants.ts\";\n\ndescribe(\"constants.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,8BAA8B;AACrC,IAAG,8BAA8B;AAC/B,SAAOA,kBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,kBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}