@stryke/fs 0.33.72 → 0.33.73

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 (117) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/copy-file.cjs +7 -8
  3. package/dist/copy-file.d.cts +1 -1
  4. package/dist/copy-file.d.mts +1 -1
  5. package/dist/copy-file.mjs +1 -2
  6. package/dist/copy-file.mjs.map +1 -1
  7. package/dist/get-parent-path.d.cts +1 -1
  8. package/dist/get-parent-path.d.cts.map +1 -1
  9. package/dist/get-parent-path.d.mts +1 -1
  10. package/dist/get-parent-path.d.mts.map +1 -1
  11. package/dist/get-workspace-root.d.cts +4 -4
  12. package/dist/get-workspace-root.d.mts +4 -4
  13. package/dist/json.cjs +9 -10
  14. package/dist/json.d.cts +1 -1
  15. package/dist/json.d.mts +1 -1
  16. package/dist/json.mjs +3 -4
  17. package/dist/json.mjs.map +1 -1
  18. package/dist/list-files.cjs +3 -4
  19. package/dist/list-files.d.cts +1 -1
  20. package/dist/list-files.d.mts +1 -1
  21. package/dist/list-files.mjs +1 -2
  22. package/dist/list-files.mjs.map +1 -1
  23. package/dist/package-fns.cjs +3 -3
  24. package/dist/package-fns.d.cts +4 -4
  25. package/dist/package-fns.d.cts.map +1 -1
  26. package/dist/package-fns.d.mts +4 -4
  27. package/dist/package-fns.d.mts.map +1 -1
  28. package/dist/package-fns.mjs +1 -1
  29. package/dist/semver-fns.cjs +6 -6
  30. package/dist/semver-fns.mjs +2 -2
  31. package/dist/tsconfig.cjs +1 -1
  32. package/dist/tsconfig.d.cts +1 -1
  33. package/dist/tsconfig.d.mts +1 -1
  34. package/dist/tsconfig.mjs +1 -1
  35. package/dist/tsconfig.mjs.map +1 -1
  36. package/package.json +10 -91
  37. package/dist/json/src/storm-json.cjs +0 -106
  38. package/dist/json/src/storm-json.mjs +0 -105
  39. package/dist/json/src/storm-json.mjs.map +0 -1
  40. package/dist/json/src/types.d.cts +0 -32
  41. package/dist/json/src/types.d.cts.map +0 -1
  42. package/dist/json/src/types.d.mts +0 -32
  43. package/dist/json/src/types.d.mts.map +0 -1
  44. package/dist/json/src/utils/code-frames.cjs +0 -77
  45. package/dist/json/src/utils/code-frames.mjs +0 -77
  46. package/dist/json/src/utils/code-frames.mjs.map +0 -1
  47. package/dist/json/src/utils/parse-error.cjs +0 -34
  48. package/dist/json/src/utils/parse-error.mjs +0 -34
  49. package/dist/json/src/utils/parse-error.mjs.map +0 -1
  50. package/dist/json/src/utils/parse.cjs +0 -45
  51. package/dist/json/src/utils/parse.mjs +0 -46
  52. package/dist/json/src/utils/parse.mjs.map +0 -1
  53. package/dist/json/src/utils/stringify.cjs +0 -33
  54. package/dist/json/src/utils/stringify.mjs +0 -34
  55. package/dist/json/src/utils/stringify.mjs.map +0 -1
  56. package/dist/json/src/utils/strip-comments.cjs +0 -85
  57. package/dist/json/src/utils/strip-comments.mjs +0 -85
  58. package/dist/json/src/utils/strip-comments.mjs.map +0 -1
  59. package/dist/type-checks/src/get-object-tag.cjs +0 -15
  60. package/dist/type-checks/src/get-object-tag.mjs +0 -15
  61. package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
  62. package/dist/type-checks/src/index.cjs +0 -14
  63. package/dist/type-checks/src/index.mjs +0 -16
  64. package/dist/type-checks/src/is-buffer.cjs +0 -14
  65. package/dist/type-checks/src/is-buffer.mjs +0 -14
  66. package/dist/type-checks/src/is-buffer.mjs.map +0 -1
  67. package/dist/type-checks/src/is-collection.cjs +0 -1
  68. package/dist/type-checks/src/is-collection.mjs +0 -3
  69. package/dist/type-checks/src/is-empty.cjs +0 -20
  70. package/dist/type-checks/src/is-empty.mjs +0 -21
  71. package/dist/type-checks/src/is-empty.mjs.map +0 -1
  72. package/dist/type-checks/src/is-error.cjs +0 -29
  73. package/dist/type-checks/src/is-error.mjs +0 -30
  74. package/dist/type-checks/src/is-error.mjs.map +0 -1
  75. package/dist/type-checks/src/is-null.cjs +0 -12
  76. package/dist/type-checks/src/is-null.mjs +0 -12
  77. package/dist/type-checks/src/is-null.mjs.map +0 -1
  78. package/dist/type-checks/src/is-number.cjs +0 -18
  79. package/dist/type-checks/src/is-number.mjs +0 -18
  80. package/dist/type-checks/src/is-number.mjs.map +0 -1
  81. package/dist/type-checks/src/is-object.cjs +0 -19
  82. package/dist/type-checks/src/is-object.mjs +0 -20
  83. package/dist/type-checks/src/is-object.mjs.map +0 -1
  84. package/dist/type-checks/src/is-plain-object.cjs +0 -64
  85. package/dist/type-checks/src/is-plain-object.mjs +0 -64
  86. package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
  87. package/dist/type-checks/src/is-set-string.cjs +0 -20
  88. package/dist/type-checks/src/is-set-string.mjs +0 -21
  89. package/dist/type-checks/src/is-set-string.mjs.map +0 -1
  90. package/dist/type-checks/src/is-set.cjs +0 -19
  91. package/dist/type-checks/src/is-set.mjs +0 -20
  92. package/dist/type-checks/src/is-set.mjs.map +0 -1
  93. package/dist/type-checks/src/is-string.cjs +0 -12
  94. package/dist/type-checks/src/is-string.mjs +0 -12
  95. package/dist/type-checks/src/is-string.mjs.map +0 -1
  96. package/dist/type-checks/src/is-undefined.cjs +0 -8
  97. package/dist/type-checks/src/is-undefined.mjs +0 -8
  98. package/dist/type-checks/src/is-undefined.mjs.map +0 -1
  99. package/dist/type-checks/src/type-detect.cjs +0 -15
  100. package/dist/type-checks/src/type-detect.mjs +0 -17
  101. package/dist/type-checks/src/type-detect.mjs.map +0 -1
  102. package/dist/types/src/file.d.cts +0 -31
  103. package/dist/types/src/file.d.cts.map +0 -1
  104. package/dist/types/src/file.d.mts +0 -31
  105. package/dist/types/src/file.d.mts.map +0 -1
  106. package/dist/types/src/package-json.d.cts +0 -261
  107. package/dist/types/src/package-json.d.cts.map +0 -1
  108. package/dist/types/src/package-json.d.mts +0 -261
  109. package/dist/types/src/package-json.d.mts.map +0 -1
  110. package/dist/types/src/package-manager.d.cts +0 -5
  111. package/dist/types/src/package-manager.d.cts.map +0 -1
  112. package/dist/types/src/package-manager.d.mts +0 -5
  113. package/dist/types/src/package-manager.d.mts.map +0 -1
  114. package/dist/types/src/tsconfig.d.cts +0 -803
  115. package/dist/types/src/tsconfig.d.cts.map +0 -1
  116. package/dist/types/src/tsconfig.d.mts +0 -803
  117. package/dist/types/src/tsconfig.d.mts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  # Changelog for Stryke - Fs
4
4
 
5
+ ## [0.33.73](https://github.com/storm-software/stryke/releases/tag/fs%400.33.73) (05/07/2026)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **monorepo:** Resolve inter-package dependency issues ([e83c91bc](https://github.com/storm-software/stryke/commit/e83c91bc))
10
+
11
+ ### Updated Dependencies
12
+
13
+ - Updated **string-format** to **v0.17.16**
14
+ - Updated **type-checks** to **v0.6.7**
15
+ - Updated **convert** to **v0.7.5**
16
+ - Updated **helpers** to **v0.10.14**
17
+ - Updated **types** to **v0.12.2**
18
+ - Updated **json** to **v0.14.18**
19
+ - Updated **path** to **v0.29.1**
20
+
5
21
  ## [0.33.72](https://github.com/storm-software/stryke/releases/tag/fs%400.33.72) (05/06/2026)
6
22
 
7
23
  ### Updated Dependencies
@@ -3,11 +3,10 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_exists = require('./exists.cjs');
4
4
  const require_helpers = require('./helpers.cjs');
5
5
  const require_is_file = require('./is-file.cjs');
6
- const require_is_string = require('./type-checks/src/is-string.cjs');
7
- require('./type-checks/src/index.cjs');
8
6
  const require_list_files = require('./list-files.cjs');
9
7
  let node_fs = require("node:fs");
10
8
  let node_fs_promises = require("node:fs/promises");
9
+ let _stryke_type_checks = require("@stryke/type-checks");
11
10
  let _stryke_path_correct_path = require("@stryke/path/correct-path");
12
11
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
13
12
  let _stryke_path_join = require("@stryke/path/join");
@@ -29,7 +28,7 @@ async function copyFile(source, destination) {
29
28
  if (!(0, _stryke_path_file_path_fns.hasFileExtension)(dest)) {
30
29
  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
30
  } 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));
32
- if (require_is_string.isString(src) && require_exists.existsSync(src)) return (0, node_fs_promises.copyFile)(src, dest);
31
+ if ((0, _stryke_type_checks.isString)(src) && require_exists.existsSync(src)) return (0, node_fs_promises.copyFile)(src, dest);
33
32
  }
34
33
  /**
35
34
  * Synchronously copy a file from one location to another
@@ -44,7 +43,7 @@ function copyFileSync(source, destination) {
44
43
  if (!(0, _stryke_path_file_path_fns.hasFileExtension)(dest)) {
45
44
  if (!require_exists.existsSync((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest))) require_helpers.createDirectorySync((0, _stryke_path_resolve_parent_path.resolveParentPath)(dest));
46
45
  } else if (!require_exists.existsSync((0, _stryke_path_file_path_fns.findFilePath)(dest))) require_helpers.createDirectorySync((0, _stryke_path_file_path_fns.findFilePath)(dest));
47
- if (require_is_string.isString(src) && require_exists.existsSync(src)) return (0, node_fs.copyFileSync)(src, dest);
46
+ if ((0, _stryke_type_checks.isString)(src) && require_exists.existsSync(src)) return (0, node_fs.copyFileSync)(src, dest);
48
47
  }
49
48
  /**
50
49
  * Copy files from one location to another
@@ -56,9 +55,9 @@ function copyFileSync(source, destination) {
56
55
  async function copyFiles(source, destination) {
57
56
  const src = source instanceof URL ? (0, mlly.fileURLToPath)(source) : source;
58
57
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
59
- if (require_is_string.isString(src) && require_is_file.isFile(src)) return copyFile(src, dest);
58
+ if ((0, _stryke_type_checks.isString)(src) && require_is_file.isFile(src)) return copyFile(src, dest);
60
59
  return Promise.all((await require_list_files.listFiles(src)).map(async (entryPath) => {
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));
60
+ const destFile = (0, _stryke_path_join.joinPaths)(dest, (0, _stryke_path_replace.replacePath)(entryPath, (0, _stryke_type_checks.isString)(src) ? (0, _stryke_path_correct_path.stripStars)(src) : src.input));
62
61
  if (require_is_file.isDirectory(entryPath)) await copyFiles(entryPath, destFile);
63
62
  else await copyFile(entryPath, destFile);
64
63
  }));
@@ -73,9 +72,9 @@ async function copyFiles(source, destination) {
73
72
  function copyFilesSync(source, destination) {
74
73
  const src = source instanceof URL ? (0, mlly.fileURLToPath)(source) : source;
75
74
  const dest = destination instanceof URL ? (0, mlly.fileURLToPath)(destination) : destination;
76
- if (require_is_string.isString(src) && require_is_file.isFile(src)) return copyFileSync(src, dest);
75
+ if ((0, _stryke_type_checks.isString)(src) && require_is_file.isFile(src)) return copyFileSync(src, dest);
77
76
  return require_list_files.listFilesSync(src).map((entryPath) => {
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));
77
+ const destFile = (0, _stryke_path_join.joinPaths)(dest, (0, _stryke_path_replace.replacePath)(entryPath, (0, _stryke_type_checks.isString)(src) ? (0, _stryke_path_correct_path.stripStars)(src) : src.input));
79
78
  if (require_is_file.isDirectory(entryPath)) copyFilesSync(entryPath, destFile);
80
79
  else copyFileSync(entryPath, destFile);
81
80
  });
@@ -1,4 +1,4 @@
1
- import { AssetGlob } from "./types/src/file.cjs";
1
+ import { AssetGlob } from "@stryke/types/file";
2
2
 
3
3
  //#region src/copy-file.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { AssetGlob } from "./types/src/file.mjs";
1
+ import { AssetGlob } from "@stryke/types/file";
2
2
 
3
3
  //#region src/copy-file.d.ts
4
4
  /**
@@ -1,11 +1,10 @@
1
1
  import { existsSync as existsSync$1 } from "./exists.mjs";
2
2
  import { createDirectory, createDirectorySync } from "./helpers.mjs";
3
3
  import { isDirectory, isFile } from "./is-file.mjs";
4
- import { isString } from "./type-checks/src/is-string.mjs";
5
- import "./type-checks/src/index.mjs";
6
4
  import { listFiles, listFilesSync } from "./list-files.mjs";
7
5
  import { copyFileSync as copyFileSync$1 } from "node:fs";
8
6
  import { copyFile as copyFile$1 } from "node:fs/promises";
7
+ import { isString } from "@stryke/type-checks";
9
8
  import { stripStars } from "@stryke/path/correct-path";
10
9
  import { findFilePath, hasFileExtension } from "@stryke/path/file-path-fns";
11
10
  import { joinPaths } from "@stryke/path/join";
@@ -1 +1 @@
1
- {"version":3,"file":"copy-file.mjs","names":["existsSync","cpf","cpfSync"],"sources":["../src/copy-file.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 { stripStars } from \"@stryke/path/correct-path\";\nimport { findFilePath, hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport { fileURLToPath } from \"mlly\";\nimport { copyFileSync as cpfSync } from \"node:fs\";\nimport { copyFile as cpf } from \"node:fs/promises\";\nimport { existsSync } from \"./exists\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\nimport { isDirectory, isFile } from \"./is-file\";\nimport { listFiles, listFilesSync } from \"./list-files\";\n\n/**\n * Copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFile(\n source: string | URL,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n await createDirectory(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n await createDirectory(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpf(src, dest);\n }\n}\n\n/**\n * Synchronously copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFileSync(source: string | URL, destination: string | URL) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n createDirectorySync(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n createDirectorySync(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpfSync(src, dest);\n }\n}\n\n/**\n * Copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFiles(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFile(src, dest);\n }\n\n return Promise.all(\n (await listFiles(src)).map(async entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n await copyFiles(entryPath, destFile);\n } else {\n await copyFile(entryPath, destFile);\n }\n })\n );\n}\n\n/**\n * Synchronously copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFilesSync(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFileSync(src, dest);\n }\n\n return listFilesSync(src).map(entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n copyFilesSync(entryPath, destFile);\n } else {\n copyFileSync(entryPath, destFile);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,eAAsB,SACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACA,aAAW,kBAAkB,KAAK,CAAC,CACtC,OAAM,gBAAgB,kBAAkB,KAAK,CAAC;YAEvC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,OAAM,gBAAgB,aAAa,KAAK,CAAC;AAG3C,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOC,WAAI,KAAK,KAAK;;;;;;;;;AAWzB,SAAgB,aAAa,QAAsB,aAA2B;CAC5E,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACD,aAAW,kBAAkB,KAAK,CAAC,CACtC,qBAAoB,kBAAkB,KAAK,CAAC;YAErC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,qBAAoB,aAAa,KAAK,CAAC;AAGzC,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOE,eAAQ,KAAK,KAAK;;;;;;;;;AAW7B,eAAsB,UACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,SAAS,KAAK,KAAK;AAG5B,QAAO,QAAQ,KACZ,MAAM,UAAU,IAAI,EAAE,IAAI,OAAM,cAAa;EAC5C,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,OAAM,UAAU,WAAW,SAAS;MAEpC,OAAM,SAAS,WAAW,SAAS;GAErC,CACH;;;;;;;;;AAUH,SAAgB,cACd,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,aAAa,KAAK,KAAK;AAGhC,QAAO,cAAc,IAAI,CAAC,KAAI,cAAa;EACzC,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,eAAc,WAAW,SAAS;MAElC,cAAa,WAAW,SAAS;GAEnC"}
1
+ {"version":3,"file":"copy-file.mjs","names":["existsSync","cpf","cpfSync"],"sources":["../src/copy-file.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 { stripStars } from \"@stryke/path/correct-path\";\nimport { findFilePath, hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport { fileURLToPath } from \"mlly\";\nimport { copyFileSync as cpfSync } from \"node:fs\";\nimport { copyFile as cpf } from \"node:fs/promises\";\nimport { existsSync } from \"./exists\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\nimport { isDirectory, isFile } from \"./is-file\";\nimport { listFiles, listFilesSync } from \"./list-files\";\n\n/**\n * Copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFile(\n source: string | URL,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n await createDirectory(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n await createDirectory(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpf(src, dest);\n }\n}\n\n/**\n * Synchronously copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFileSync(source: string | URL, destination: string | URL) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n createDirectorySync(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n createDirectorySync(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpfSync(src, dest);\n }\n}\n\n/**\n * Copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFiles(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFile(src, dest);\n }\n\n return Promise.all(\n (await listFiles(src)).map(async entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n await copyFiles(entryPath, destFile);\n } else {\n await copyFile(entryPath, destFile);\n }\n })\n );\n}\n\n/**\n * Synchronously copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFilesSync(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFileSync(src, dest);\n }\n\n return listFilesSync(src).map(entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n copyFilesSync(entryPath, destFile);\n } else {\n copyFileSync(entryPath, destFile);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,eAAsB,SACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACA,aAAW,kBAAkB,KAAK,CAAC,CACtC,OAAM,gBAAgB,kBAAkB,KAAK,CAAC;YAEvC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,OAAM,gBAAgB,aAAa,KAAK,CAAC;AAG3C,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOC,WAAI,KAAK,KAAK;;;;;;;;;AAWzB,SAAgB,aAAa,QAAsB,aAA2B;CAC5E,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACD,aAAW,kBAAkB,KAAK,CAAC,CACtC,qBAAoB,kBAAkB,KAAK,CAAC;YAErC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,qBAAoB,aAAa,KAAK,CAAC;AAGzC,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOE,eAAQ,KAAK,KAAK;;;;;;;;;AAW7B,eAAsB,UACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,SAAS,KAAK,KAAK;AAG5B,QAAO,QAAQ,KACZ,MAAM,UAAU,IAAI,EAAE,IAAI,OAAM,cAAa;EAC5C,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,OAAM,UAAU,WAAW,SAAS;MAEpC,OAAM,SAAS,WAAW,SAAS;GAErC,CACH;;;;;;;;;AAUH,SAAgB,cACd,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,aAAa,KAAK,KAAK;AAGhC,QAAO,cAAc,IAAI,CAAC,KAAI,cAAa;EACzC,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,eAAc,WAAW,SAAS;MAElC,cAAa,WAAW,SAAS;GAEnC"}
@@ -26,7 +26,7 @@ interface GetParentPathOptions {
26
26
  * @param cwd - The current working directory.
27
27
  * @returns The first parent path that exists.
28
28
  */
29
- declare const getParentPath: (name: string | string[], cwd?: string, options?: Partial<GetParentPathOptions>) => string | undefined;
29
+ declare const getParentPath: (name: string | string[], cwd?: any, options?: Partial<GetParentPathOptions>) => string | undefined;
30
30
  //#endregion
31
31
  export { GetParentPathOptions, getParentPath };
32
32
  //# sourceMappingURL=get-parent-path.d.cts.map
@@ -1 +1 @@
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
+ {"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,QACA,OAAA,GAAS,OAAA,CAAQ,oBAAA"}
@@ -26,7 +26,7 @@ interface GetParentPathOptions {
26
26
  * @param cwd - The current working directory.
27
27
  * @returns The first parent path that exists.
28
28
  */
29
- declare const getParentPath: (name: string | string[], cwd?: string, options?: Partial<GetParentPathOptions>) => string | undefined;
29
+ declare const getParentPath: (name: string | string[], cwd?: any, options?: Partial<GetParentPathOptions>) => string | undefined;
30
30
  //#endregion
31
31
  export { GetParentPathOptions, getParentPath };
32
32
  //# sourceMappingURL=get-parent-path.d.mts.map
@@ -1 +1 @@
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
+ {"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,QACA,OAAA,GAAS,OAAA,CAAQ,oBAAA"}
@@ -7,28 +7,28 @@ declare const PROJECT_ROOT_CONTENT: string[];
7
7
  * @param dir - A directory to start the search from
8
8
  * @returns The workspace root path
9
9
  */
10
- declare function getWorkspaceRoot(dir?: string): string;
10
+ declare function getWorkspaceRoot(dir?: any): any;
11
11
  /**
12
12
  * Check if the given directory is the workspace root
13
13
  *
14
14
  * @param dir - A directory to check
15
15
  * @returns True if the directory is the workspace root, false otherwise
16
16
  */
17
- declare function isWorkspaceRoot(dir?: string): boolean;
17
+ declare function isWorkspaceRoot(dir?: any): boolean;
18
18
  /**
19
19
  * Get the project root path
20
20
  *
21
21
  * @param dir - A directory to start the search from
22
22
  * @returns The project root path
23
23
  */
24
- declare function getProjectRoot(dir?: string): string;
24
+ declare function getProjectRoot(dir?: any): any;
25
25
  /**
26
26
  * Check if the given directory is the project root
27
27
  *
28
28
  * @param dir - A directory to check
29
29
  * @returns True if the directory is the project root, false otherwise
30
30
  */
31
- declare function isProjectRoot(dir?: string): boolean;
31
+ declare function isProjectRoot(dir?: any): boolean;
32
32
  /**
33
33
  * Find the file path relative to the workspace root path.
34
34
  *
@@ -7,28 +7,28 @@ declare const PROJECT_ROOT_CONTENT: string[];
7
7
  * @param dir - A directory to start the search from
8
8
  * @returns The workspace root path
9
9
  */
10
- declare function getWorkspaceRoot(dir?: string): string;
10
+ declare function getWorkspaceRoot(dir?: any): any;
11
11
  /**
12
12
  * Check if the given directory is the workspace root
13
13
  *
14
14
  * @param dir - A directory to check
15
15
  * @returns True if the directory is the workspace root, false otherwise
16
16
  */
17
- declare function isWorkspaceRoot(dir?: string): boolean;
17
+ declare function isWorkspaceRoot(dir?: any): boolean;
18
18
  /**
19
19
  * Get the project root path
20
20
  *
21
21
  * @param dir - A directory to start the search from
22
22
  * @returns The project root path
23
23
  */
24
- declare function getProjectRoot(dir?: string): string;
24
+ declare function getProjectRoot(dir?: any): any;
25
25
  /**
26
26
  * Check if the given directory is the project root
27
27
  *
28
28
  * @param dir - A directory to check
29
29
  * @returns True if the directory is the project root, false otherwise
30
30
  */
31
- declare function isProjectRoot(dir?: string): boolean;
31
+ declare function isProjectRoot(dir?: any): boolean;
32
32
  /**
33
33
  * Find the file path relative to the workspace root path.
34
34
  *
package/dist/json.cjs CHANGED
@@ -1,12 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_is_error = require('./type-checks/src/is-error.cjs');
4
- const require_is_set_string = require('./type-checks/src/is-set-string.cjs');
5
- require('./type-checks/src/index.cjs');
6
3
  const require_read_file = require('./read-file.cjs');
7
4
  const require_write_file = require('./write-file.cjs');
8
- const require_storm_json = require('./json/src/storm-json.cjs');
9
5
  let _stryke_path = require("@stryke/path");
6
+ let _stryke_type_checks = require("@stryke/type-checks");
7
+ let _stryke_json_storm_json = require("@stryke/json/storm-json");
8
+ let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
10
9
 
11
10
  //#region src/json.ts
12
11
  /**
@@ -19,12 +18,12 @@ let _stryke_path = require("@stryke/path");
19
18
  function readJsonFileSync(path, options) {
20
19
  const content = require_read_file.readFileSync(path);
21
20
  try {
22
- return require_storm_json.StormJSON.parse(require_is_set_string.isSetString(content) ? content.trim() : "{}", {
21
+ return _stryke_json_storm_json.StormJSON.parse((0, _stryke_type_checks.isSetString)(content) ? content.trim() : "{}", {
23
22
  expectComments: (0, _stryke_path.findFileExtension)(path) === "jsonc",
24
23
  ...options
25
24
  });
26
25
  } catch (error) {
27
- if (require_is_error.isError(error)) {
26
+ if ((0, _stryke_type_checks_is_error.isError)(error)) {
28
27
  error.message = error.message.replace("JSON", path);
29
28
  throw error;
30
29
  }
@@ -41,12 +40,12 @@ function readJsonFileSync(path, options) {
41
40
  async function readJsonFile(path, options = {}) {
42
41
  const content = await require_read_file.readFile(path);
43
42
  try {
44
- return require_storm_json.StormJSON.parse(require_is_set_string.isSetString(content) ? content.trim() : "{}", {
43
+ return _stryke_json_storm_json.StormJSON.parse((0, _stryke_type_checks.isSetString)(content) ? content.trim() : "{}", {
45
44
  expectComments: (0, _stryke_path.findFileExtension)(path) === "jsonc",
46
45
  ...options
47
46
  });
48
47
  } catch (error) {
49
- if (require_is_error.isError(error)) {
48
+ if ((0, _stryke_type_checks_is_error.isError)(error)) {
50
49
  error.message = error.message.replace("JSON", path);
51
50
  throw error;
52
51
  }
@@ -61,7 +60,7 @@ async function readJsonFile(path, options = {}) {
61
60
  * @param options - JSON serialize options
62
61
  */
63
62
  function writeJsonFileSync(path, data, options = {}) {
64
- const serializedJson = require_storm_json.StormJSON.stringify(data, {
63
+ const serializedJson = _stryke_json_storm_json.StormJSON.stringify(data, {
65
64
  spaces: 2,
66
65
  ...options
67
66
  });
@@ -75,7 +74,7 @@ function writeJsonFileSync(path, data, options = {}) {
75
74
  * @param options - JSON serialize options
76
75
  */
77
76
  async function writeJsonFile(path, data, options = {}) {
78
- const serializedJson = require_storm_json.StormJSON.stringify(data, {
77
+ const serializedJson = _stryke_json_storm_json.StormJSON.stringify(data, {
79
78
  spaces: 2,
80
79
  ...options
81
80
  });
package/dist/json.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { JsonParseOptions, JsonSerializeOptions } from "./json/src/types.cjs";
1
+ import { JsonParseOptions, JsonSerializeOptions } from "@stryke/json/types";
2
2
 
3
3
  //#region src/json.d.ts
4
4
  /**
package/dist/json.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { JsonParseOptions, JsonSerializeOptions } from "./json/src/types.mjs";
1
+ import { JsonParseOptions, JsonSerializeOptions } from "@stryke/json/types";
2
2
 
3
3
  //#region src/json.d.ts
4
4
  /**
package/dist/json.mjs CHANGED
@@ -1,10 +1,9 @@
1
- import { isError } from "./type-checks/src/is-error.mjs";
2
- import { isSetString } from "./type-checks/src/is-set-string.mjs";
3
- import "./type-checks/src/index.mjs";
4
1
  import { readFile, readFileSync } from "./read-file.mjs";
5
2
  import { writeFile, writeFileSync } from "./write-file.mjs";
6
- import { StormJSON } from "./json/src/storm-json.mjs";
7
3
  import { findFileExtension } from "@stryke/path";
4
+ import { isSetString } from "@stryke/type-checks";
5
+ import { StormJSON } from "@stryke/json/storm-json";
6
+ import { isError } from "@stryke/type-checks/is-error";
8
7
 
9
8
  //#region src/json.ts
10
9
  /**
package/dist/json.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.mjs","names":[],"sources":["../src/json.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 { StormJSON } from \"@stryke/json/storm-json\";\nimport type {\n JsonParseOptions,\n JsonSerializeOptions\n} from \"@stryke/json/types\";\nimport { findFileExtension } from \"@stryke/path\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport function readJsonFileSync<T extends object = any>(\n path: string,\n options?: JsonParseOptions\n): T {\n const content = readFileSync(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport async function readJsonFile<T extends object = any>(\n path: string,\n options: JsonParseOptions = {}\n): Promise<T> {\n const content = await readFile(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\nexport interface JsonWriteOptions extends JsonSerializeOptions {\n /**\n * whether to append new line at the end of JSON file\n *\n * @defaultValue false\n */\n appendNewLine?: boolean;\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport function writeJsonFileSync<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): void {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFileSync(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file asynchronously.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport async function writeJsonFile<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): Promise<void> {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFile(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,SAAgB,iBACd,MACA,SACG;CACH,MAAM,UAAU,aAAa,KAAK;AAElC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAWpD,eAAsB,aACpB,MACA,UAA4B,EAAE,EAClB;CACZ,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAoBpD,SAAgB,kBACd,MACA,MACA,UAA4B,EAAE,EACxB;CACN,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,cACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD;;;;;;;;;AAUH,eAAsB,cACpB,MACA,MACA,UAA4B,EAAE,EACf;CACf,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,UACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD"}
1
+ {"version":3,"file":"json.mjs","names":[],"sources":["../src/json.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 { StormJSON } from \"@stryke/json/storm-json\";\nimport type {\n JsonParseOptions,\n JsonSerializeOptions\n} from \"@stryke/json/types\";\nimport { findFileExtension } from \"@stryke/path\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport function readJsonFileSync<T extends object = any>(\n path: string,\n options?: JsonParseOptions\n): T {\n const content = readFileSync(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport async function readJsonFile<T extends object = any>(\n path: string,\n options: JsonParseOptions = {}\n): Promise<T> {\n const content = await readFile(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\nexport interface JsonWriteOptions extends JsonSerializeOptions {\n /**\n * whether to append new line at the end of JSON file\n *\n * @defaultValue false\n */\n appendNewLine?: boolean;\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport function writeJsonFileSync<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): void {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFileSync(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file asynchronously.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport async function writeJsonFile<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): Promise<void> {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFile(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgB,iBACd,MACA,SACG;CACH,MAAM,UAAU,aAAa,KAAK;AAElC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAWpD,eAAsB,aACpB,MACA,UAA4B,EAAE,EAClB;CACZ,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAoBpD,SAAgB,kBACd,MACA,MACA,UAA4B,EAAE,EACxB;CACN,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,cACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD;;;;;;;;;AAUH,eAAsB,cACpB,MACA,MACA,UAA4B,EAAE,EACf;CACf,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,UACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD"}
@@ -1,8 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_is_string = require('./type-checks/src/is-string.cjs');
4
- require('./type-checks/src/index.cjs');
5
3
  let _stryke_path = require("@stryke/path");
4
+ let _stryke_type_checks = require("@stryke/type-checks");
6
5
  let defu = require("defu");
7
6
  defu = require_runtime.__toESM(defu, 1);
8
7
  let glob = require("glob");
@@ -16,7 +15,7 @@ const DEFAULT_OPTIONS = { dot: true };
16
15
  * @returns A list of file paths
17
16
  */
18
17
  async function list(filesGlob, options) {
19
- return (0, glob.glob)(require_is_string.isString(filesGlob) ? filesGlob.includes("*") ? filesGlob : (0, _stryke_path.joinPaths)(filesGlob, "**/*") : filesGlob.input ? (0, _stryke_path.joinPaths)(filesGlob.input, filesGlob.glob) : filesGlob.glob, (0, defu.default)(require_is_string.isString(filesGlob) ? {} : {
18
+ return (0, glob.glob)((0, _stryke_type_checks.isString)(filesGlob) ? filesGlob.includes("*") ? filesGlob : (0, _stryke_path.joinPaths)(filesGlob, "**/*") : filesGlob.input ? (0, _stryke_path.joinPaths)(filesGlob.input, filesGlob.glob) : filesGlob.glob, (0, defu.default)((0, _stryke_type_checks.isString)(filesGlob) ? {} : {
20
19
  dot: filesGlob.dot,
21
20
  ignore: filesGlob.ignore
22
21
  }, options ?? {}, DEFAULT_OPTIONS));
@@ -28,7 +27,7 @@ async function list(filesGlob, options) {
28
27
  * @returns A list of file paths
29
28
  */
30
29
  function listSync(filesGlob, options) {
31
- return glob.glob.sync(require_is_string.isString(filesGlob) ? filesGlob.includes("*") ? filesGlob : (0, _stryke_path.joinPaths)(filesGlob, "**/*") : filesGlob.input ? (0, _stryke_path.joinPaths)(filesGlob.input, filesGlob.glob) : filesGlob.glob, (0, defu.default)(require_is_string.isString(filesGlob) ? {} : {
30
+ return glob.glob.sync((0, _stryke_type_checks.isString)(filesGlob) ? filesGlob.includes("*") ? filesGlob : (0, _stryke_path.joinPaths)(filesGlob, "**/*") : filesGlob.input ? (0, _stryke_path.joinPaths)(filesGlob.input, filesGlob.glob) : filesGlob.glob, (0, defu.default)((0, _stryke_type_checks.isString)(filesGlob) ? {} : {
32
31
  dot: filesGlob.dot,
33
32
  ignore: filesGlob.ignore
34
33
  }, options ?? {}, DEFAULT_OPTIONS));
@@ -1,5 +1,5 @@
1
- import { AssetGlob } from "./types/src/file.cjs";
2
1
  import { GlobOptions, Path } from "glob";
2
+ import { AssetGlob } from "@stryke/types/file";
3
3
 
4
4
  //#region src/list-files.d.ts
5
5
  type ListOptions = GlobOptions;
@@ -1,5 +1,5 @@
1
- import { AssetGlob } from "./types/src/file.mjs";
2
1
  import { GlobOptions, Path } from "glob";
2
+ import { AssetGlob } from "@stryke/types/file";
3
3
 
4
4
  //#region src/list-files.d.ts
5
5
  type ListOptions = GlobOptions;
@@ -1,6 +1,5 @@
1
- import { isString } from "./type-checks/src/is-string.mjs";
2
- import "./type-checks/src/index.mjs";
3
1
  import { joinPaths } from "@stryke/path";
2
+ import { isString } from "@stryke/type-checks";
4
3
  import defu from "defu";
5
4
  import { glob } from "glob";
6
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"list-files.mjs","names":[],"sources":["../src/list-files.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 { joinPaths } from \"@stryke/path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport defu from \"defu\";\nimport type { GlobOptions, GlobOptionsWithFileTypesTrue, Path } from \"glob\";\nimport { glob } from \"glob\";\n\nexport type ListOptions = GlobOptions;\nexport type InferListReturnType<TOptions extends GlobOptions> =\n TOptions[\"withFileTypes\"] extends true ? Path[] : string[];\n\nconst DEFAULT_OPTIONS: ListOptions = {\n dot: true\n};\n\n/**\n * A files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function list<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): Promise<InferListReturnType<TOptions>> {\n return glob(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as Promise<InferListReturnType<TOptions>>;\n}\n\n/**\n * A synchronous files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): InferListReturnType<TOptions> {\n return glob.sync(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as InferListReturnType<TOptions>;\n}\n\n/**\n * A file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listFiles<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listFilesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listDirectories<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listDirectoriesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n"],"mappings":";;;;;;;AA6BA,MAAM,kBAA+B,EACnC,KAAK,MACN;;;;;;;AAQD,eAAsB,KACpB,WACA,SACwC;AACxC,QAAO,KACL,SAAS,UAAU,GACf,UAAU,SAAS,IAAI,GACrB,YACA,UAAU,WAAW,OAAO,GAC9B,UAAU,QACR,UAAU,UAAU,OAAO,UAAU,KAAK,GAC1C,UAAU,MAChB,KACE,SAAS,UAAU,GACf,EAAE,GACF;EAAE,KAAK,UAAU;EAAK,QAAQ,UAAU;EAAQ,EACpD,WAAW,EAAE,EACb,gBACD,CACF;;;;;;;;AASH,SAAgB,SACd,WACA,SAC+B;AAC/B,QAAO,KAAK,KACV,SAAS,UAAU,GACf,UAAU,SAAS,IAAI,GACrB,YACA,UAAU,WAAW,OAAO,GAC9B,UAAU,QACR,UAAU,UAAU,OAAO,UAAU,KAAK,GAC1C,UAAU,MAChB,KACE,SAAS,UAAU,GACf,EAAE,GACF;EAAE,KAAK,UAAU;EAAK,QAAQ,UAAU;EAAQ,EACpD,WAAW,EAAE,EACb,gBACD,CACF;;;;;;;;AASH,eAAsB,UACpB,WACA,SACA;CACA,MAAM,UACJ,MAAM,KACJ,WACA,KACE,EAAE,eAAe,MAAM,EACvB,WAAW,EAAE,CACd,CACF,EACD,QAAO,QAAO,IAAI,QAAQ,CAAC;AAC7B,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,SAAgB,cACd,WACA,SACA;CACA,MAAM,SAAS,SACb,WACA,KAAK,EAAE,eAAe,MAAM,EAAE,WAAW,EAAE,CAAC,CAC7C,CAAC,QAAO,QAAO,IAAI,QAAQ,CAAC;AAC7B,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,eAAsB,gBACpB,WACA,SACA;CACA,MAAM,UACJ,MAAM,KACJ,WACA,KACE,EAAE,eAAe,MAAM,EACvB,WAAW,EAAE,CACd,CACF,EACD,QAAO,QAAO,IAAI,aAAa,CAAC;AAClC,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,SAAgB,oBACd,WACA,SACA;CACA,MAAM,SAAS,SACb,WACA,KAAK,EAAE,eAAe,MAAM,EAAE,WAAW,EAAE,CAAC,CAC7C,CAAC,QAAO,QAAO,IAAI,aAAa,CAAC;AAClC,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO"}
1
+ {"version":3,"file":"list-files.mjs","names":[],"sources":["../src/list-files.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 { joinPaths } from \"@stryke/path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport defu from \"defu\";\nimport type { GlobOptions, GlobOptionsWithFileTypesTrue, Path } from \"glob\";\nimport { glob } from \"glob\";\n\nexport type ListOptions = GlobOptions;\nexport type InferListReturnType<TOptions extends GlobOptions> =\n TOptions[\"withFileTypes\"] extends true ? Path[] : string[];\n\nconst DEFAULT_OPTIONS: ListOptions = {\n dot: true\n};\n\n/**\n * A files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function list<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): Promise<InferListReturnType<TOptions>> {\n return glob(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as Promise<InferListReturnType<TOptions>>;\n}\n\n/**\n * A synchronous files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): InferListReturnType<TOptions> {\n return glob.sync(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as InferListReturnType<TOptions>;\n}\n\n/**\n * A file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listFiles<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listFilesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listDirectories<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listDirectoriesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n"],"mappings":";;;;;;AA6BA,MAAM,kBAA+B,EACnC,KAAK,MACN;;;;;;;AAQD,eAAsB,KACpB,WACA,SACwC;AACxC,QAAO,KACL,SAAS,UAAU,GACf,UAAU,SAAS,IAAI,GACrB,YACA,UAAU,WAAW,OAAO,GAC9B,UAAU,QACR,UAAU,UAAU,OAAO,UAAU,KAAK,GAC1C,UAAU,MAChB,KACE,SAAS,UAAU,GACf,EAAE,GACF;EAAE,KAAK,UAAU;EAAK,QAAQ,UAAU;EAAQ,EACpD,WAAW,EAAE,EACb,gBACD,CACF;;;;;;;;AASH,SAAgB,SACd,WACA,SAC+B;AAC/B,QAAO,KAAK,KACV,SAAS,UAAU,GACf,UAAU,SAAS,IAAI,GACrB,YACA,UAAU,WAAW,OAAO,GAC9B,UAAU,QACR,UAAU,UAAU,OAAO,UAAU,KAAK,GAC1C,UAAU,MAChB,KACE,SAAS,UAAU,GACf,EAAE,GACF;EAAE,KAAK,UAAU;EAAK,QAAQ,UAAU;EAAQ,EACpD,WAAW,EAAE,EACb,gBACD,CACF;;;;;;;;AASH,eAAsB,UACpB,WACA,SACA;CACA,MAAM,UACJ,MAAM,KACJ,WACA,KACE,EAAE,eAAe,MAAM,EACvB,WAAW,EAAE,CACd,CACF,EACD,QAAO,QAAO,IAAI,QAAQ,CAAC;AAC7B,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,SAAgB,cACd,WACA,SACA;CACA,MAAM,SAAS,SACb,WACA,KAAK,EAAE,eAAe,MAAM,EAAE,WAAW,EAAE,CAAC,CAC7C,CAAC,QAAO,QAAO,IAAI,QAAQ,CAAC;AAC7B,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,eAAsB,gBACpB,WACA,SACA;CACA,MAAM,UACJ,MAAM,KACJ,WACA,KACE,EAAE,eAAe,MAAM,EACvB,WAAW,EAAE,CACd,CACF,EACD,QAAO,QAAO,IAAI,aAAa,CAAC;AAClC,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO;;;;;;;;AAST,SAAgB,oBACd,WACA,SACA;CACA,MAAM,SAAS,SACb,WACA,KAAK,EAAE,eAAe,MAAM,EAAE,WAAW,EAAE,CAAC,CAC7C,CAAC,QAAO,QAAO,IAAI,aAAa,CAAC;AAClC,KAAI,CAAC,SAAS,cACZ,QAAO,OAAO,KAAI,SAAQ,KAAK,UAAU,CAAC;AAG5C,QAAO"}
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_exists = require('./exists.cjs');
4
- const require_is_string = require('./type-checks/src/is-string.cjs');
5
4
  const require_get_parent_path = require('./get-parent-path.cjs');
6
5
  const require_get_workspace_root = require('./get-workspace-root.cjs');
7
6
  const require_resolve = require('./resolve.cjs');
@@ -10,6 +9,7 @@ let node_fs = require("node:fs");
10
9
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
11
10
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
12
11
  let _stryke_string_format_package = require("@stryke/string-format/package");
12
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
13
13
  let semver = require("semver");
14
14
 
15
15
  //#region src/package-fns.ts
@@ -93,7 +93,7 @@ async function loadPackageJson(cwd = require_get_workspace_root.getWorkspaceRoot
93
93
  */
94
94
  async function isPackageListed(name, cwdOrOptions) {
95
95
  const packageName = (0, _stryke_string_format_package.getPackageName)(name);
96
- const packageJson = await loadPackageJson(require_is_string.isString(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd);
96
+ const packageJson = await loadPackageJson((0, _stryke_type_checks_is_string.isString)(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd);
97
97
  if (!packageJson) return false;
98
98
  return Boolean(packageJson.dependencies && packageName in packageJson.dependencies && packageJson.dependencies[packageName] || packageJson.devDependencies && packageName in packageJson.devDependencies && packageJson.devDependencies[packageName]);
99
99
  }
@@ -106,7 +106,7 @@ async function isPackageListed(name, cwdOrOptions) {
106
106
  */
107
107
  async function getPackageListing(name, cwdOrOptions) {
108
108
  const packageName = (0, _stryke_string_format_package.getPackageName)(name);
109
- const packageJson = await loadPackageJson(require_is_string.isString(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd);
109
+ const packageJson = await loadPackageJson((0, _stryke_type_checks_is_string.isString)(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd);
110
110
  if (!packageJson) return;
111
111
  const version = packageJson.dependencies && packageName in packageJson.dependencies ? packageJson.dependencies[packageName] : packageJson.devDependencies && packageName in packageJson.devDependencies ? packageJson.devDependencies[packageName] : void 0;
112
112
  const type = (packageJson.dependencies && packageName in packageJson.dependencies ? "dependencies" : packageJson.devDependencies && packageName in packageJson.devDependencies ? "devDependencies" : void 0) || void 0;
@@ -1,6 +1,6 @@
1
- import { PackageJson } from "./types/src/package-json.cjs";
2
- import { PackageManager } from "./types/src/package-manager.cjs";
3
1
  import { ResolveOptions } from "./resolve.cjs";
2
+ import { PackageJson } from "@stryke/types/package-json";
3
+ import { PackageManager } from "@stryke/types/package-manager";
4
4
  import { Range } from "semver";
5
5
 
6
6
  //#region src/package-fns.d.ts
@@ -10,7 +10,7 @@ import { Range } from "semver";
10
10
  * @param dir - The path to the project
11
11
  * @returns The package manager used in the project
12
12
  */
13
- declare function getPackageManager(dir?: string): PackageManager;
13
+ declare function getPackageManager(dir?: any): PackageManager;
14
14
  /**
15
15
  * Get package info
16
16
  *
@@ -31,7 +31,7 @@ declare function getPackageInfo(name: string, options?: ResolveOptions): Promise
31
31
  * @param cwd - The current working directory
32
32
  * @returns The package info
33
33
  */
34
- declare function loadPackageJson(cwd?: string): Promise<PackageJson | null>;
34
+ declare function loadPackageJson(cwd?: any): Promise<PackageJson | null>;
35
35
  interface PackageExistsOptions {
36
36
  /**
37
37
  * The current working directory
@@ -1 +1 @@
1
- {"version":3,"file":"package-fns.d.cts","names":[],"sources":["../src/package-fns.ts"],"mappings":";;;;;;;;AAwCA;;;;iBAAgB,iBAAA,CAAkB,GAAA,YAA2B,cAAA;AAwE7D;;;;;;;AAAA,iBAAsB,cAAA,CACpB,IAAA,UACA,OAAA,GAAS,cAAA,GAAmB,OAAA;;;;;;;;;;;;;iBAwBR,eAAA,CACpB,GAAA,YACC,OAAA,CAAQ,WAAA;AAAA,UAYM,oBAAA;;;;EAIf,GAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,oBAAA;EAnBzB;AAYtB;;EAWE,OAAA,YAAmB,KAAA;AAAA;;AAJrB;;;;;;iBAcsB,eAAA,CACpB,IAAA,UACA,GAAA,YACC,OAAA;;;AAHH;;;;;iBAYsB,eAAA,CACpB,IAAA,UACA,OAAA,GAAU,oBAAA,GACT,OAAA;AAAA,UA+Bc,uBAAA;EACf,OAAA;EACA,IAAA;AAAA;;;;;;;;iBAUoB,iBAAA,CACpB,IAAA,UACA,YAAA,YAAwB,oBAAA,GACvB,OAAA,CAAQ,uBAAA;;AAfX;;;;;AAYA;;iBA2CsB,gBAAA,CACpB,IAAA,UACA,OAAA,UACA,GAAA,YACC,OAAA;;;;;;;;iBAoBa,eAAA,CAAgB,IAAA,UAAc,OAAA,GAAS,cAAA"}
1
+ {"version":3,"file":"package-fns.d.cts","names":[],"sources":["../src/package-fns.ts"],"mappings":";;;;;;;;AAwCA;;;;iBAAgB,iBAAA,CAAkB,GAAA,SAA2B,cAAA;AAwE7D;;;;;;;AAAA,iBAAsB,cAAA,CACpB,IAAA,UACA,OAAA,GAAS,cAAA,GAAmB,OAAA;;;;;;;;;;;;;iBAwBR,eAAA,CACpB,GAAA,SACC,OAAA,CAAQ,WAAA;AAAA,UAYM,oBAAA;;;;EAIf,GAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,oBAAA;EAnBzB;AAYtB;;EAWE,OAAA,YAAmB,KAAA;AAAA;;AAJrB;;;;;;iBAcsB,eAAA,CACpB,IAAA,UACA,GAAA,YACC,OAAA;;;AAHH;;;;;iBAYsB,eAAA,CACpB,IAAA,UACA,OAAA,GAAU,oBAAA,GACT,OAAA;AAAA,UA+Bc,uBAAA;EACf,OAAA;EACA,IAAA;AAAA;;;;;;;;iBAUoB,iBAAA,CACpB,IAAA,UACA,YAAA,YAAwB,oBAAA,GACvB,OAAA,CAAQ,uBAAA;;AAfX;;;;;AAYA;;iBA2CsB,gBAAA,CACpB,IAAA,UACA,OAAA,UACA,GAAA,YACC,OAAA;;;;;;;;iBAoBa,eAAA,CAAgB,IAAA,UAAc,OAAA,GAAS,cAAA"}
@@ -1,7 +1,7 @@
1
- import { PackageJson } from "./types/src/package-json.mjs";
2
- import { PackageManager } from "./types/src/package-manager.mjs";
3
1
  import { ResolveOptions } from "./resolve.mjs";
4
2
  import { Range } from "semver";
3
+ import { PackageJson } from "@stryke/types/package-json";
4
+ import { PackageManager } from "@stryke/types/package-manager";
5
5
 
6
6
  //#region src/package-fns.d.ts
7
7
  /**
@@ -10,7 +10,7 @@ import { Range } from "semver";
10
10
  * @param dir - The path to the project
11
11
  * @returns The package manager used in the project
12
12
  */
13
- declare function getPackageManager(dir?: string): PackageManager;
13
+ declare function getPackageManager(dir?: any): PackageManager;
14
14
  /**
15
15
  * Get package info
16
16
  *
@@ -31,7 +31,7 @@ declare function getPackageInfo(name: string, options?: ResolveOptions): Promise
31
31
  * @param cwd - The current working directory
32
32
  * @returns The package info
33
33
  */
34
- declare function loadPackageJson(cwd?: string): Promise<PackageJson | null>;
34
+ declare function loadPackageJson(cwd?: any): Promise<PackageJson | null>;
35
35
  interface PackageExistsOptions {
36
36
  /**
37
37
  * The current working directory
@@ -1 +1 @@
1
- {"version":3,"file":"package-fns.d.mts","names":[],"sources":["../src/package-fns.ts"],"mappings":";;;;;;;;AAwCA;;;;iBAAgB,iBAAA,CAAkB,GAAA,YAA2B,cAAA;AAwE7D;;;;;;;AAAA,iBAAsB,cAAA,CACpB,IAAA,UACA,OAAA,GAAS,cAAA,GAAmB,OAAA;;;;;;;;;;;;;iBAwBR,eAAA,CACpB,GAAA,YACC,OAAA,CAAQ,WAAA;AAAA,UAYM,oBAAA;;;;EAIf,GAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,oBAAA;EAnBzB;AAYtB;;EAWE,OAAA,YAAmB,KAAA;AAAA;;AAJrB;;;;;;iBAcsB,eAAA,CACpB,IAAA,UACA,GAAA,YACC,OAAA;;;AAHH;;;;;iBAYsB,eAAA,CACpB,IAAA,UACA,OAAA,GAAU,oBAAA,GACT,OAAA;AAAA,UA+Bc,uBAAA;EACf,OAAA;EACA,IAAA;AAAA;;;;;;;;iBAUoB,iBAAA,CACpB,IAAA,UACA,YAAA,YAAwB,oBAAA,GACvB,OAAA,CAAQ,uBAAA;;AAfX;;;;;AAYA;;iBA2CsB,gBAAA,CACpB,IAAA,UACA,OAAA,UACA,GAAA,YACC,OAAA;;;;;;;;iBAoBa,eAAA,CAAgB,IAAA,UAAc,OAAA,GAAS,cAAA"}
1
+ {"version":3,"file":"package-fns.d.mts","names":[],"sources":["../src/package-fns.ts"],"mappings":";;;;;;;;AAwCA;;;;iBAAgB,iBAAA,CAAkB,GAAA,SAA2B,cAAA;AAwE7D;;;;;;;AAAA,iBAAsB,cAAA,CACpB,IAAA,UACA,OAAA,GAAS,cAAA,GAAmB,OAAA;;;;;;;;;;;;;iBAwBR,eAAA,CACpB,GAAA,SACC,OAAA,CAAQ,WAAA;AAAA,UAYM,oBAAA;;;;EAIf,GAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,oBAAA;EAnBzB;AAYtB;;EAWE,OAAA,YAAmB,KAAA;AAAA;;AAJrB;;;;;;iBAcsB,eAAA,CACpB,IAAA,UACA,GAAA,YACC,OAAA;;;AAHH;;;;;iBAYsB,eAAA,CACpB,IAAA,UACA,OAAA,GAAU,oBAAA,GACT,OAAA;AAAA,UA+Bc,uBAAA;EACf,OAAA;EACA,IAAA;AAAA;;;;;;;;iBAUoB,iBAAA,CACpB,IAAA,UACA,YAAA,YAAwB,oBAAA,GACvB,OAAA,CAAQ,uBAAA;;AAfX;;;;;AAYA;;iBA2CsB,gBAAA,CACpB,IAAA,UACA,OAAA,UACA,GAAA,YACC,OAAA;;;;;;;;iBAoBa,eAAA,CAAgB,IAAA,UAAc,OAAA,GAAS,cAAA"}
@@ -1,5 +1,4 @@
1
1
  import { exists } from "./exists.mjs";
2
- import { isString } from "./type-checks/src/is-string.mjs";
3
2
  import { getParentPath } from "./get-parent-path.mjs";
4
3
  import { getWorkspaceRoot } from "./get-workspace-root.mjs";
5
4
  import { resolvePackage } from "./resolve.mjs";
@@ -8,6 +7,7 @@ import { existsSync } from "node:fs";
8
7
  import { joinPaths } from "@stryke/path/join-paths";
9
8
  import { findFileName, findFilePath } from "@stryke/path/file-path-fns";
10
9
  import { getPackageName } from "@stryke/string-format/package";
10
+ import { isString } from "@stryke/type-checks/is-string";
11
11
  import { subset } from "semver";
12
12
 
13
13
  //#region src/package-fns.ts
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_is_object = require('./type-checks/src/is-object.cjs');
4
- const require_is_string = require('./type-checks/src/is-string.cjs');
3
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
5
4
  let semver = require("semver");
5
+ let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
6
6
 
7
7
  //#region src/semver-fns.ts
8
8
  const RELEASE_TYPES = [
@@ -40,7 +40,7 @@ const coerceVersion = (version, options) => {
40
40
  * @returns Whether the value is a valid {@link SemVer}
41
41
  */
42
42
  const isSemver = (val) => {
43
- return require_is_object.isObject(val) && "version" in val;
43
+ return (0, _stryke_type_checks_is_object.isObject)(val) && "version" in val;
44
44
  };
45
45
  /**
46
46
  * Type check for {@link Range}
@@ -49,7 +49,7 @@ const isSemver = (val) => {
49
49
  * @returns Whether the value is a valid {@link Range}
50
50
  */
51
51
  const isRange = (val) => {
52
- return require_is_object.isObject(val) && "range" in val;
52
+ return (0, _stryke_type_checks_is_object.isObject)(val) && "range" in val;
53
53
  };
54
54
  /**
55
55
  * Check if a {@link SemVer} string is valid
@@ -62,7 +62,7 @@ const isRange = (val) => {
62
62
  * @returns Whether the semver string is valid
63
63
  */
64
64
  const isValidSemver = (semver$2, loose = true) => {
65
- return (require_is_string.isString(semver$2) || isSemver(semver$2)) && (0, semver.valid)(semver$2, loose) !== null;
65
+ return ((0, _stryke_type_checks_is_string.isString)(semver$2) || isSemver(semver$2)) && (0, semver.valid)(semver$2, loose) !== null;
66
66
  };
67
67
  /**
68
68
  * Check if a {@link Range} string is valid
@@ -75,7 +75,7 @@ const isValidSemver = (semver$2, loose = true) => {
75
75
  * @returns Whether the range string is valid
76
76
  */
77
77
  const isValidRange = (range, loose = true) => {
78
- return (require_is_string.isString(range) || isRange(range)) && (0, semver.validRange)(range, loose) !== null;
78
+ return ((0, _stryke_type_checks_is_string.isString)(range) || isRange(range)) && (0, semver.validRange)(range, loose) !== null;
79
79
  };
80
80
  /**
81
81
  * Check if a {@link SemVer} or {@link Range} string is valid