@stryke/fs 0.33.79 → 0.33.80

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 +12 -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 +110 -10
@@ -0,0 +1,14 @@
1
+ import { remove_file_exports } from "./remove-file.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/remove-file.test.ts
5
+ describe("remove-file.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(remove_file_exports).toBeDefined();
8
+ expect(typeof remove_file_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=remove-file.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-file.test.mjs","names":["moduleExports"],"sources":["../src/remove-file.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./remove-file.ts\";\n\ndescribe(\"remove-file.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,gCAAgC;AACvC,IAAG,8BAA8B;AAC/B,SAAOA,oBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,oBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
package/dist/resolve.cjs CHANGED
@@ -12,6 +12,19 @@ let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
12
12
  let _stryke_path_is_type = require("@stryke/path/is-type");
13
13
 
14
14
  //#region src/resolve.ts
15
+ var resolve_exports = /* @__PURE__ */ require_runtime.__exportAll({
16
+ DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
17
+ getNodeModulesPaths: () => getNodeModulesPaths,
18
+ getResolutionCombinations: () => getResolutionCombinations,
19
+ getResolutionPaths: () => getResolutionPaths,
20
+ importModule: () => importModule,
21
+ resolve: () => resolve,
22
+ resolvePackage: () => resolvePackage,
23
+ resolvePackageSync: () => resolvePackageSync,
24
+ resolveSafe: () => resolveSafe,
25
+ resolveSafeSync: () => resolveSafeSync,
26
+ resolveSync: () => resolveSync
27
+ });
15
28
  const DEFAULT_EXTENSIONS = [
16
29
  "js",
17
30
  "jsx",
@@ -236,4 +249,10 @@ exports.resolvePackage = resolvePackage;
236
249
  exports.resolvePackageSync = resolvePackageSync;
237
250
  exports.resolveSafe = resolveSafe;
238
251
  exports.resolveSafeSync = resolveSafeSync;
239
- exports.resolveSync = resolveSync;
252
+ exports.resolveSync = resolveSync;
253
+ Object.defineProperty(exports, 'resolve_exports', {
254
+ enumerable: true,
255
+ get: function () {
256
+ return resolve_exports;
257
+ }
258
+ });
package/dist/resolve.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { existsSync } from "./exists.mjs";
2
3
  import { getWorkspaceRoot } from "./get-workspace-root.mjs";
3
4
  import { appendExtension } from "@stryke/path";
@@ -10,6 +11,19 @@ import { getUnique } from "@stryke/helpers/get-unique";
10
11
  import { isAbsolutePath, isNpmScopedPackage } from "@stryke/path/is-type";
11
12
 
12
13
  //#region src/resolve.ts
14
+ var resolve_exports = /* @__PURE__ */ __exportAll({
15
+ DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
16
+ getNodeModulesPaths: () => getNodeModulesPaths,
17
+ getResolutionCombinations: () => getResolutionCombinations,
18
+ getResolutionPaths: () => getResolutionPaths,
19
+ importModule: () => importModule,
20
+ resolve: () => resolve,
21
+ resolvePackage: () => resolvePackage,
22
+ resolvePackageSync: () => resolvePackageSync,
23
+ resolveSafe: () => resolveSafe,
24
+ resolveSafeSync: () => resolveSafeSync,
25
+ resolveSync: () => resolveSync
26
+ });
13
27
  const DEFAULT_EXTENSIONS = [
14
28
  "js",
15
29
  "jsx",
@@ -224,5 +238,5 @@ function resolvePackageSync(name, options = {}) {
224
238
  }
225
239
 
226
240
  //#endregion
227
- export { DEFAULT_EXTENSIONS, getNodeModulesPaths, getResolutionCombinations, getResolutionPaths, importModule, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync };
241
+ export { DEFAULT_EXTENSIONS, getNodeModulesPaths, getResolutionCombinations, getResolutionPaths, importModule, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync, resolve_exports };
228
242
  //# sourceMappingURL=resolve.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.mjs","names":["findFolderName","joinPaths","findFilePath"],"sources":["../src/resolve.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 { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendExtension } from \"@stryke/path\";\nimport { correctPath, toAbsolutePath } from \"@stryke/path/correct-path\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport {\n findFileName,\n findFilePath,\n findFolderName,\n hasFileExtension\n} from \"@stryke/path/file-path-fns\";\nimport { isAbsolutePath, isNpmScopedPackage } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { interopDefault, resolvePath, resolvePathSync } from \"mlly\";\nimport { existsSync } from \"./exists\";\nimport { getWorkspaceRoot } from \"./get-workspace-root\";\n\nexport const DEFAULT_EXTENSIONS = [\n \"js\",\n \"jsx\",\n \"mjs\",\n \"cjs\",\n \"ts\",\n \"tsx\",\n \"mts\",\n \"cts\",\n \"json\",\n \"jsonc\",\n \"json5\",\n \"node\"\n];\n\nexport interface ResolveOptions {\n /**\n * Paths to resolve the package from\n */\n paths?: string[];\n\n /**\n * File extensions to consider when resolving the module\n *\n * @remarks\n * Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.\n *\n * @defaultValue [\"js\", \"jsx\", \"mjs\", \"cjs\", \"ts\", \"tsx\", \"mts\", \"cts\", \"json\", \"jsonc\", \"json5\", \"node\", \"wasm\"]\n */\n extensions?: string[];\n\n /**\n * Conditions to consider when resolving package exports.\n */\n conditions?: string[];\n}\n\n/**\n * Get the resolution paths based on the provided paths, current working directory, and workspace root.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionPaths(paths: string[] = []) {\n let resolutionPaths = paths;\n if (!resolutionPaths.includes(cwd())) {\n resolutionPaths.push(cwd());\n }\n\n const workspaceRoot = getWorkspaceRoot();\n if (!resolutionPaths.includes(workspaceRoot)) {\n resolutionPaths.push(workspaceRoot);\n }\n\n resolutionPaths = getUnique(\n resolutionPaths\n .filter(Boolean)\n .map(path => correctPath(path))\n .reduce((ret, path, _, arr) => {\n ret.push(path);\n if (!isAbsolutePath(path)) {\n ret.push(toAbsolutePath(path, cwd()));\n ret.push(toAbsolutePath(path, workspaceRoot));\n\n arr.forEach(existing => {\n ret.push(toAbsolutePath(path, existing));\n });\n }\n\n return ret;\n }, [] as string[])\n );\n\n return resolutionPaths;\n}\n\n/**\n * Get the node_modules resolution paths based on the provided paths.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected node_modules resolution paths.\n */\nexport function getNodeModulesPaths(paths: string[] = []) {\n return getUnique(\n paths.reduce((ret, path) => {\n if (findFolderName(path) === \"node_modules\") {\n ret.push(correctPath(path));\n }\n\n if (existsSync(joinPaths(path, \"node_modules\"))) {\n ret.push(correctPath(joinPaths(path, \"node_modules\")));\n }\n\n return ret;\n }, [] as string[])\n );\n}\n\nexport interface ResolutionCombinationOptions extends ResolveOptions {\n /**\n * Whether to include additional paths (like node_modules) in the resolution combinations. If set to false, only the provided paths will be used for generating combinations. This can be useful for scenarios where you want to limit the resolution to specific directories without considering the default node_modules paths.\n *\n * @defaultValue true\n */\n useAdditionalPaths?: boolean;\n}\n\n/**\n * Get all combinations of resolution paths for a given path and options.\n *\n * @param path - The base path to combine with resolution paths.\n * @param options - The options containing resolution paths.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionCombinations(\n path: string,\n options: ResolutionCombinationOptions = {}\n) {\n let paths = options.useAdditionalPaths\n ? getResolutionPaths(options.paths)\n : (options.paths ?? []);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let combinations = paths.map(base => joinPaths(base, path));\n if (findFileName(path, { withExtension: false }) !== \"index\") {\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n ret.push(joinPaths(combination, \"index\"));\n\n return ret;\n }, [] as string[]);\n }\n\n if (!hasFileExtension(path)) {\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS;\n\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n extensions.forEach(ext => {\n ret.push(appendExtension(combination, ext));\n });\n\n return ret;\n }, [] as string[]);\n\n combinations.push(\n ...extensions\n .map(ext =>\n getResolutionCombinations(appendExtension(path, ext), options)\n )\n .flat()\n );\n }\n\n paths.map(p => {\n if (hasFileExtension(p)) {\n combinations.push(\n ...getResolutionCombinations(path, {\n ...options,\n useAdditionalPaths: false,\n paths: [findFilePath(p)]\n })\n );\n }\n });\n\n return getUnique(combinations.filter(Boolean)).map(p => correctPath(p));\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolve(\n path: string,\n options: ResolveOptions = {}\n): Promise<string> {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result: string | undefined;\n let error: Error | undefined;\n\n try {\n result = await resolvePath(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = await resolvePath(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSync(path: string, options: ResolveOptions = {}) {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result!: string;\n let error: Error | undefined;\n\n try {\n result = resolvePathSync(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = resolvePathSync(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n // if (!result && findFileName(path, { withExtension: false }) !== \"index\") {\n // try {\n // result = resolveSync(joinPaths(path, \"index\"), {\n // ...options,\n // paths\n // });\n // if (result) {\n // // Remove the previously added index file from the path\n // result = findFilePath(result);\n // }\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolveSafe(name: string, options: ResolveOptions = {}) {\n try {\n return await resolve(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSafeSync(name: string, options: ResolveOptions = {}) {\n try {\n return resolveSync(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Import a module from a specified path\n *\n * @param path - The path to the module\n * @returns The module\n */\nexport async function importModule<T = any>(path: string): Promise<T> {\n const i = await import(path);\n\n if (i) {\n return interopDefault(i);\n }\n\n return i;\n}\n\n/**\n * Resolve the path to a specified package asynchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @returns A promise for the module or undefined\n */\nexport async function resolvePackage(\n name: string,\n options: ResolveOptions = {}\n) {\n let result = await resolveSafe(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = await resolveSafe(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = await resolveSafe(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n\n/**\n * Resolve the path to a specified package synchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The module or undefined\n */\nexport function resolvePackageSync(name: string, options: ResolveOptions = {}) {\n let result = resolveSafeSync(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = resolveSafeSync(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = resolveSafeSync(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"resolve.mjs","names":["findFolderName","joinPaths","findFilePath"],"sources":["../src/resolve.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 { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendExtension } from \"@stryke/path\";\nimport { correctPath, toAbsolutePath } from \"@stryke/path/correct-path\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport {\n findFileName,\n findFilePath,\n findFolderName,\n hasFileExtension\n} from \"@stryke/path/file-path-fns\";\nimport { isAbsolutePath, isNpmScopedPackage } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { interopDefault, resolvePath, resolvePathSync } from \"mlly\";\nimport { existsSync } from \"./exists\";\nimport { getWorkspaceRoot } from \"./get-workspace-root\";\n\nexport const DEFAULT_EXTENSIONS = [\n \"js\",\n \"jsx\",\n \"mjs\",\n \"cjs\",\n \"ts\",\n \"tsx\",\n \"mts\",\n \"cts\",\n \"json\",\n \"jsonc\",\n \"json5\",\n \"node\"\n];\n\nexport interface ResolveOptions {\n /**\n * Paths to resolve the package from\n */\n paths?: string[];\n\n /**\n * File extensions to consider when resolving the module\n *\n * @remarks\n * Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.\n *\n * @defaultValue [\"js\", \"jsx\", \"mjs\", \"cjs\", \"ts\", \"tsx\", \"mts\", \"cts\", \"json\", \"jsonc\", \"json5\", \"node\", \"wasm\"]\n */\n extensions?: string[];\n\n /**\n * Conditions to consider when resolving package exports.\n */\n conditions?: string[];\n}\n\n/**\n * Get the resolution paths based on the provided paths, current working directory, and workspace root.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionPaths(paths: string[] = []) {\n let resolutionPaths = paths;\n if (!resolutionPaths.includes(cwd())) {\n resolutionPaths.push(cwd());\n }\n\n const workspaceRoot = getWorkspaceRoot();\n if (!resolutionPaths.includes(workspaceRoot)) {\n resolutionPaths.push(workspaceRoot);\n }\n\n resolutionPaths = getUnique(\n resolutionPaths\n .filter(Boolean)\n .map(path => correctPath(path))\n .reduce((ret, path, _, arr) => {\n ret.push(path);\n if (!isAbsolutePath(path)) {\n ret.push(toAbsolutePath(path, cwd()));\n ret.push(toAbsolutePath(path, workspaceRoot));\n\n arr.forEach(existing => {\n ret.push(toAbsolutePath(path, existing));\n });\n }\n\n return ret;\n }, [] as string[])\n );\n\n return resolutionPaths;\n}\n\n/**\n * Get the node_modules resolution paths based on the provided paths.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected node_modules resolution paths.\n */\nexport function getNodeModulesPaths(paths: string[] = []) {\n return getUnique(\n paths.reduce((ret, path) => {\n if (findFolderName(path) === \"node_modules\") {\n ret.push(correctPath(path));\n }\n\n if (existsSync(joinPaths(path, \"node_modules\"))) {\n ret.push(correctPath(joinPaths(path, \"node_modules\")));\n }\n\n return ret;\n }, [] as string[])\n );\n}\n\nexport interface ResolutionCombinationOptions extends ResolveOptions {\n /**\n * Whether to include additional paths (like node_modules) in the resolution combinations. If set to false, only the provided paths will be used for generating combinations. This can be useful for scenarios where you want to limit the resolution to specific directories without considering the default node_modules paths.\n *\n * @defaultValue true\n */\n useAdditionalPaths?: boolean;\n}\n\n/**\n * Get all combinations of resolution paths for a given path and options.\n *\n * @param path - The base path to combine with resolution paths.\n * @param options - The options containing resolution paths.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionCombinations(\n path: string,\n options: ResolutionCombinationOptions = {}\n) {\n let paths = options.useAdditionalPaths\n ? getResolutionPaths(options.paths)\n : (options.paths ?? []);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let combinations = paths.map(base => joinPaths(base, path));\n if (findFileName(path, { withExtension: false }) !== \"index\") {\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n ret.push(joinPaths(combination, \"index\"));\n\n return ret;\n }, [] as string[]);\n }\n\n if (!hasFileExtension(path)) {\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS;\n\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n extensions.forEach(ext => {\n ret.push(appendExtension(combination, ext));\n });\n\n return ret;\n }, [] as string[]);\n\n combinations.push(\n ...extensions\n .map(ext =>\n getResolutionCombinations(appendExtension(path, ext), options)\n )\n .flat()\n );\n }\n\n paths.map(p => {\n if (hasFileExtension(p)) {\n combinations.push(\n ...getResolutionCombinations(path, {\n ...options,\n useAdditionalPaths: false,\n paths: [findFilePath(p)]\n })\n );\n }\n });\n\n return getUnique(combinations.filter(Boolean)).map(p => correctPath(p));\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolve(\n path: string,\n options: ResolveOptions = {}\n): Promise<string> {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result: string | undefined;\n let error: Error | undefined;\n\n try {\n result = await resolvePath(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = await resolvePath(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSync(path: string, options: ResolveOptions = {}) {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result!: string;\n let error: Error | undefined;\n\n try {\n result = resolvePathSync(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = resolvePathSync(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n // if (!result && findFileName(path, { withExtension: false }) !== \"index\") {\n // try {\n // result = resolveSync(joinPaths(path, \"index\"), {\n // ...options,\n // paths\n // });\n // if (result) {\n // // Remove the previously added index file from the path\n // result = findFilePath(result);\n // }\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolveSafe(name: string, options: ResolveOptions = {}) {\n try {\n return await resolve(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSafeSync(name: string, options: ResolveOptions = {}) {\n try {\n return resolveSync(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Import a module from a specified path\n *\n * @param path - The path to the module\n * @returns The module\n */\nexport async function importModule<T = any>(path: string): Promise<T> {\n const i = await import(path);\n\n if (i) {\n return interopDefault(i);\n }\n\n return i;\n}\n\n/**\n * Resolve the path to a specified package asynchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @returns A promise for the module or undefined\n */\nexport async function resolvePackage(\n name: string,\n options: ResolveOptions = {}\n) {\n let result = await resolveSafe(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = await resolveSafe(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = await resolveSafe(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n\n/**\n * Resolve the path to a specified package synchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The module or undefined\n */\nexport function resolvePackageSync(name: string, options: ResolveOptions = {}) {\n let result = resolveSafeSync(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = resolveSafeSync(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = resolveSafeSync(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n"],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_resolve = require('./resolve.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/resolve.test.ts
6
+ (0, vitest.describe)("resolve.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_resolve.resolve_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_resolve.resolve_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { resolve_exports } from "./resolve.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/resolve.test.ts
5
+ describe("resolve.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(resolve_exports).toBeDefined();
8
+ expect(typeof resolve_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=resolve.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.test.mjs","names":["moduleExports"],"sources":["../src/resolve.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./resolve.ts\";\n\ndescribe(\"resolve.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"}
@@ -5,6 +5,19 @@ let semver = require("semver");
5
5
  let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
6
6
 
7
7
  //#region src/semver-fns.ts
8
+ var semver_fns_exports = /* @__PURE__ */ require_runtime.__exportAll({
9
+ RELEASE_TYPES: () => RELEASE_TYPES,
10
+ coerceVersion: () => coerceVersion,
11
+ deriveNewSemverVersion: () => deriveNewSemverVersion,
12
+ isRange: () => isRange,
13
+ isRelativeVersionKeyword: () => isRelativeVersionKeyword,
14
+ isSemver: () => isSemver,
15
+ isValidRange: () => isValidRange,
16
+ isValidSemver: () => isValidSemver,
17
+ isValidVersion: () => isValidVersion,
18
+ parseVersion: () => parseVersion,
19
+ satisfiesVersion: () => satisfiesVersion
20
+ });
8
21
  const RELEASE_TYPES = [
9
22
  "major",
10
23
  "premajor",
@@ -138,4 +151,10 @@ exports.isValidRange = isValidRange;
138
151
  exports.isValidSemver = isValidSemver;
139
152
  exports.isValidVersion = isValidVersion;
140
153
  exports.parseVersion = parseVersion;
141
- exports.satisfiesVersion = satisfiesVersion;
154
+ exports.satisfiesVersion = satisfiesVersion;
155
+ Object.defineProperty(exports, 'semver_fns_exports', {
156
+ enumerable: true,
157
+ get: function () {
158
+ return semver_fns_exports;
159
+ }
160
+ });
@@ -1,8 +1,22 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { isString } from "@stryke/type-checks/is-string";
2
3
  import { coerce, inc, parse, satisfies, valid, validRange } from "semver";
3
4
  import { isObject } from "@stryke/type-checks/is-object";
4
5
 
5
6
  //#region src/semver-fns.ts
7
+ var semver_fns_exports = /* @__PURE__ */ __exportAll({
8
+ RELEASE_TYPES: () => RELEASE_TYPES,
9
+ coerceVersion: () => coerceVersion,
10
+ deriveNewSemverVersion: () => deriveNewSemverVersion,
11
+ isRange: () => isRange,
12
+ isRelativeVersionKeyword: () => isRelativeVersionKeyword,
13
+ isSemver: () => isSemver,
14
+ isValidRange: () => isValidRange,
15
+ isValidSemver: () => isValidSemver,
16
+ isValidVersion: () => isValidVersion,
17
+ parseVersion: () => parseVersion,
18
+ satisfiesVersion: () => satisfiesVersion
19
+ });
6
20
  const RELEASE_TYPES = [
7
21
  "major",
8
22
  "premajor",
@@ -126,5 +140,5 @@ const deriveNewSemverVersion = (currentSemverVersion, semverSpecifier, preid) =>
126
140
  };
127
141
 
128
142
  //#endregion
129
- export { RELEASE_TYPES, coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion };
143
+ export { RELEASE_TYPES, coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion, semver_fns_exports };
130
144
  //# sourceMappingURL=semver-fns.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"semver-fns.mjs","names":[],"sources":["../src/semver-fns.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 { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { CoerceOptions, Range, SemVer } from \"semver\";\nimport { coerce, inc, parse, satisfies, valid, validRange } from \"semver\";\n\nexport type ReleaseType =\n | \"major\"\n | \"premajor\"\n | \"minor\"\n | \"preminor\"\n | \"patch\"\n | \"prepatch\"\n | \"prerelease\"\n | \"release\";\n\nexport const RELEASE_TYPES: ReleaseType[] = [\n \"major\",\n \"premajor\",\n \"minor\",\n \"preminor\",\n \"patch\",\n \"prepatch\",\n \"prerelease\",\n \"release\"\n];\n\n/**\n * Parse a semver string into a SemVer object\n *\n * @param semver - The semver string to parse\n * @param loose - Whether to use loose parsing\n * @returns The parsed SemVer object\n */\nexport const parseVersion = (semver: string, loose = true) =>\n parse(semver, loose);\n\n/**\n * Coerce a version string into a valid SemVer string\n *\n * @param version - The version string or number or {@link SemVer} to coerce\n * @param options - Options to use when coercing the version\n * @returns The coerced SemVer string or null if invalid\n */\nexport const coerceVersion = (\n version: string | number | SemVer | null | undefined,\n options?: CoerceOptions\n): SemVer | null => {\n return coerce(version, options);\n};\n\n/**\n * Type check for {@link SemVer}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link SemVer}\n */\nexport const isSemver = (val: any): val is SemVer => {\n return isObject(val) && \"version\" in val;\n};\n\n/**\n * Type check for {@link Range}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link Range}\n */\nexport const isRange = (val: any): val is Range => {\n return isObject(val) && \"range\" in val;\n};\n\n/**\n * Check if a {@link SemVer} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isSemver} function.\n *\n * @param semver - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidSemver = (semver: any, loose = true): boolean => {\n return (\n (isString(semver) || isSemver(semver)) && valid(semver, loose) !== null\n );\n};\n\n/**\n * Check if a {@link Range} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isRange} function.\n *\n * @param range - The range string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the range string is valid\n */\nexport const isValidRange = (range: any, loose = true): boolean => {\n return (\n (isString(range) || isRange(range)) && validRange(range, loose) !== null\n );\n};\n\n/**\n * Check if a {@link SemVer} or {@link Range} string is valid\n *\n * @param version - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidVersion = (\n version: string | SemVer | Range | null | undefined,\n loose = true\n) => {\n return isValidSemver(version, loose) || isValidRange(version, loose);\n};\n\n/**\n * Check if a semver string satisfies a range\n *\n * @param version - The semver string to check\n * @param range - The range to check against\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string satisfies the range\n */\nexport const satisfiesVersion = (\n version: string | SemVer | null | undefined,\n range: string | Range | null | undefined,\n loose = true\n) => {\n if (\n !version ||\n !range ||\n !isValidSemver(version, loose) ||\n !isValidRange(range, loose)\n ) {\n return false;\n }\n\n return satisfies(version, range, { loose });\n};\n\n/**\n * Check if a string is a valid relative version keyword\n *\n * @param val - The string to check\n * @returns Whether the string is a valid relative version keyword\n */\nexport const isRelativeVersionKeyword = (val: string): val is ReleaseType => {\n return RELEASE_TYPES.includes(val as ReleaseType);\n};\n\n/**\n * Derive a new semver version from the current version and a version specifier\n *\n * @param currentSemverVersion - The current semver version\n * @param semverSpecifier - The semver specifier to use\n * @param preid - The pre-release identifier to use\n * @returns The derived new semver version\n */\nexport const deriveNewSemverVersion = (\n currentSemverVersion: string,\n semverSpecifier: string,\n preid?: string\n) => {\n if (!valid(currentSemverVersion)) {\n throw new Error(\n `Invalid semver version \"${currentSemverVersion}\" provided.`\n );\n }\n\n let newVersion = semverSpecifier;\n\n if (isRelativeVersionKeyword(semverSpecifier)) {\n // Derive the new version from the current version combined with the new version specifier.\n const derivedVersion = inc(currentSemverVersion, semverSpecifier, preid!);\n\n if (!derivedVersion) {\n throw new Error(\n `Unable to derive new version from current version \"${currentSemverVersion}\" and version specifier \"${semverSpecifier}\"`\n );\n }\n newVersion = derivedVersion;\n } else if (!valid(semverSpecifier)) {\n // Ensure the new version specifier is a valid semver version, given it is not a valid semver keyword\n throw new Error(\n `Invalid semver version specifier \"${semverSpecifier}\" provided. Please provide either a valid semver version or a valid semver version keyword.`\n );\n }\n\n return newVersion;\n};\n"],"mappings":";;;;;AAiCA,MAAa,gBAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,MAAa,gBAAgB,QAAgB,QAAQ,SACnD,MAAM,QAAQ,MAAM;;;;;;;;AAStB,MAAa,iBACX,SACA,YACkB;AAClB,QAAO,OAAO,SAAS,QAAQ;;;;;;;;AASjC,MAAa,YAAY,QAA4B;AACnD,QAAO,SAAS,IAAI,IAAI,aAAa;;;;;;;;AASvC,MAAa,WAAW,QAA2B;AACjD,QAAO,SAAS,IAAI,IAAI,WAAW;;;;;;;;;;;;AAarC,MAAa,iBAAiB,QAAa,QAAQ,SAAkB;AACnE,SACG,SAAS,OAAO,IAAI,SAAS,OAAO,KAAK,MAAM,QAAQ,MAAM,KAAK;;;;;;;;;;;;AAcvE,MAAa,gBAAgB,OAAY,QAAQ,SAAkB;AACjE,SACG,SAAS,MAAM,IAAI,QAAQ,MAAM,KAAK,WAAW,OAAO,MAAM,KAAK;;;;;;;;;AAWxE,MAAa,kBACX,SACA,QAAQ,SACL;AACH,QAAO,cAAc,SAAS,MAAM,IAAI,aAAa,SAAS,MAAM;;;;;;;;;;AAWtE,MAAa,oBACX,SACA,OACA,QAAQ,SACL;AACH,KACE,CAAC,WACD,CAAC,SACD,CAAC,cAAc,SAAS,MAAM,IAC9B,CAAC,aAAa,OAAO,MAAM,CAE3B,QAAO;AAGT,QAAO,UAAU,SAAS,OAAO,EAAE,OAAO,CAAC;;;;;;;;AAS7C,MAAa,4BAA4B,QAAoC;AAC3E,QAAO,cAAc,SAAS,IAAmB;;;;;;;;;;AAWnD,MAAa,0BACX,sBACA,iBACA,UACG;AACH,KAAI,CAAC,MAAM,qBAAqB,CAC9B,OAAM,IAAI,MACR,2BAA2B,qBAAqB,aACjD;CAGH,IAAI,aAAa;AAEjB,KAAI,yBAAyB,gBAAgB,EAAE;EAE7C,MAAM,iBAAiB,IAAI,sBAAsB,iBAAiB,MAAO;AAEzE,MAAI,CAAC,eACH,OAAM,IAAI,MACR,sDAAsD,qBAAqB,2BAA2B,gBAAgB,GACvH;AAEH,eAAa;YACJ,CAAC,MAAM,gBAAgB,CAEhC,OAAM,IAAI,MACR,qCAAqC,gBAAgB,6FACtD;AAGH,QAAO"}
1
+ {"version":3,"file":"semver-fns.mjs","names":[],"sources":["../src/semver-fns.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 { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { CoerceOptions, Range, SemVer } from \"semver\";\nimport { coerce, inc, parse, satisfies, valid, validRange } from \"semver\";\n\nexport type ReleaseType =\n | \"major\"\n | \"premajor\"\n | \"minor\"\n | \"preminor\"\n | \"patch\"\n | \"prepatch\"\n | \"prerelease\"\n | \"release\";\n\nexport const RELEASE_TYPES: ReleaseType[] = [\n \"major\",\n \"premajor\",\n \"minor\",\n \"preminor\",\n \"patch\",\n \"prepatch\",\n \"prerelease\",\n \"release\"\n];\n\n/**\n * Parse a semver string into a SemVer object\n *\n * @param semver - The semver string to parse\n * @param loose - Whether to use loose parsing\n * @returns The parsed SemVer object\n */\nexport const parseVersion = (semver: string, loose = true) =>\n parse(semver, loose);\n\n/**\n * Coerce a version string into a valid SemVer string\n *\n * @param version - The version string or number or {@link SemVer} to coerce\n * @param options - Options to use when coercing the version\n * @returns The coerced SemVer string or null if invalid\n */\nexport const coerceVersion = (\n version: string | number | SemVer | null | undefined,\n options?: CoerceOptions\n): SemVer | null => {\n return coerce(version, options);\n};\n\n/**\n * Type check for {@link SemVer}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link SemVer}\n */\nexport const isSemver = (val: any): val is SemVer => {\n return isObject(val) && \"version\" in val;\n};\n\n/**\n * Type check for {@link Range}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link Range}\n */\nexport const isRange = (val: any): val is Range => {\n return isObject(val) && \"range\" in val;\n};\n\n/**\n * Check if a {@link SemVer} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isSemver} function.\n *\n * @param semver - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidSemver = (semver: any, loose = true): boolean => {\n return (\n (isString(semver) || isSemver(semver)) && valid(semver, loose) !== null\n );\n};\n\n/**\n * Check if a {@link Range} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isRange} function.\n *\n * @param range - The range string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the range string is valid\n */\nexport const isValidRange = (range: any, loose = true): boolean => {\n return (\n (isString(range) || isRange(range)) && validRange(range, loose) !== null\n );\n};\n\n/**\n * Check if a {@link SemVer} or {@link Range} string is valid\n *\n * @param version - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidVersion = (\n version: string | SemVer | Range | null | undefined,\n loose = true\n) => {\n return isValidSemver(version, loose) || isValidRange(version, loose);\n};\n\n/**\n * Check if a semver string satisfies a range\n *\n * @param version - The semver string to check\n * @param range - The range to check against\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string satisfies the range\n */\nexport const satisfiesVersion = (\n version: string | SemVer | null | undefined,\n range: string | Range | null | undefined,\n loose = true\n) => {\n if (\n !version ||\n !range ||\n !isValidSemver(version, loose) ||\n !isValidRange(range, loose)\n ) {\n return false;\n }\n\n return satisfies(version, range, { loose });\n};\n\n/**\n * Check if a string is a valid relative version keyword\n *\n * @param val - The string to check\n * @returns Whether the string is a valid relative version keyword\n */\nexport const isRelativeVersionKeyword = (val: string): val is ReleaseType => {\n return RELEASE_TYPES.includes(val as ReleaseType);\n};\n\n/**\n * Derive a new semver version from the current version and a version specifier\n *\n * @param currentSemverVersion - The current semver version\n * @param semverSpecifier - The semver specifier to use\n * @param preid - The pre-release identifier to use\n * @returns The derived new semver version\n */\nexport const deriveNewSemverVersion = (\n currentSemverVersion: string,\n semverSpecifier: string,\n preid?: string\n) => {\n if (!valid(currentSemverVersion)) {\n throw new Error(\n `Invalid semver version \"${currentSemverVersion}\" provided.`\n );\n }\n\n let newVersion = semverSpecifier;\n\n if (isRelativeVersionKeyword(semverSpecifier)) {\n // Derive the new version from the current version combined with the new version specifier.\n const derivedVersion = inc(currentSemverVersion, semverSpecifier, preid!);\n\n if (!derivedVersion) {\n throw new Error(\n `Unable to derive new version from current version \"${currentSemverVersion}\" and version specifier \"${semverSpecifier}\"`\n );\n }\n newVersion = derivedVersion;\n } else if (!valid(semverSpecifier)) {\n // Ensure the new version specifier is a valid semver version, given it is not a valid semver keyword\n throw new Error(\n `Invalid semver version specifier \"${semverSpecifier}\" provided. Please provide either a valid semver version or a valid semver version keyword.`\n );\n }\n\n return newVersion;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,MAAa,gBAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,MAAa,gBAAgB,QAAgB,QAAQ,SACnD,MAAM,QAAQ,MAAM;;;;;;;;AAStB,MAAa,iBACX,SACA,YACkB;AAClB,QAAO,OAAO,SAAS,QAAQ;;;;;;;;AASjC,MAAa,YAAY,QAA4B;AACnD,QAAO,SAAS,IAAI,IAAI,aAAa;;;;;;;;AASvC,MAAa,WAAW,QAA2B;AACjD,QAAO,SAAS,IAAI,IAAI,WAAW;;;;;;;;;;;;AAarC,MAAa,iBAAiB,QAAa,QAAQ,SAAkB;AACnE,SACG,SAAS,OAAO,IAAI,SAAS,OAAO,KAAK,MAAM,QAAQ,MAAM,KAAK;;;;;;;;;;;;AAcvE,MAAa,gBAAgB,OAAY,QAAQ,SAAkB;AACjE,SACG,SAAS,MAAM,IAAI,QAAQ,MAAM,KAAK,WAAW,OAAO,MAAM,KAAK;;;;;;;;;AAWxE,MAAa,kBACX,SACA,QAAQ,SACL;AACH,QAAO,cAAc,SAAS,MAAM,IAAI,aAAa,SAAS,MAAM;;;;;;;;;;AAWtE,MAAa,oBACX,SACA,OACA,QAAQ,SACL;AACH,KACE,CAAC,WACD,CAAC,SACD,CAAC,cAAc,SAAS,MAAM,IAC9B,CAAC,aAAa,OAAO,MAAM,CAE3B,QAAO;AAGT,QAAO,UAAU,SAAS,OAAO,EAAE,OAAO,CAAC;;;;;;;;AAS7C,MAAa,4BAA4B,QAAoC;AAC3E,QAAO,cAAc,SAAS,IAAmB;;;;;;;;;;AAWnD,MAAa,0BACX,sBACA,iBACA,UACG;AACH,KAAI,CAAC,MAAM,qBAAqB,CAC9B,OAAM,IAAI,MACR,2BAA2B,qBAAqB,aACjD;CAGH,IAAI,aAAa;AAEjB,KAAI,yBAAyB,gBAAgB,EAAE;EAE7C,MAAM,iBAAiB,IAAI,sBAAsB,iBAAiB,MAAO;AAEzE,MAAI,CAAC,eACH,OAAM,IAAI,MACR,sDAAsD,qBAAqB,2BAA2B,gBAAgB,GACvH;AAEH,eAAa;YACJ,CAAC,MAAM,gBAAgB,CAEhC,OAAM,IAAI,MACR,qCAAqC,gBAAgB,6FACtD;AAGH,QAAO"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_semver_fns = require('./semver-fns.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/semver-fns.test.ts
6
+ (0, vitest.describe)("semver-fns.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_semver_fns.semver_fns_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_semver_fns.semver_fns_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { semver_fns_exports } from "./semver-fns.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/semver-fns.test.ts
5
+ describe("semver-fns.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(semver_fns_exports).toBeDefined();
8
+ expect(typeof semver_fns_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=semver-fns.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semver-fns.test.mjs","names":["moduleExports"],"sources":["../src/semver-fns.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./semver-fns.ts\";\n\ndescribe(\"semver-fns.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,+BAA+B;AACtC,IAAG,8BAA8B;AAC/B,SAAOA,mBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,mBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
package/dist/toml.cjs CHANGED
@@ -6,6 +6,12 @@ let smol_toml = require("smol-toml");
6
6
  smol_toml = require_runtime.__toESM(smol_toml, 1);
7
7
 
8
8
  //#region src/toml.ts
9
+ var toml_exports = /* @__PURE__ */ require_runtime.__exportAll({
10
+ readTomlFile: () => readTomlFile,
11
+ readTomlFileSync: () => readTomlFileSync,
12
+ writeTomlFile: () => writeTomlFile,
13
+ writeTomlFileSync: () => writeTomlFileSync
14
+ });
9
15
  /**
10
16
  * Reads a TOML file and returns the object the TOML content represents.
11
17
  *
@@ -52,5 +58,11 @@ async function writeTomlFile(path, data, options) {
52
58
  //#endregion
53
59
  exports.readTomlFile = readTomlFile;
54
60
  exports.readTomlFileSync = readTomlFileSync;
61
+ Object.defineProperty(exports, 'toml_exports', {
62
+ enumerable: true,
63
+ get: function () {
64
+ return toml_exports;
65
+ }
66
+ });
55
67
  exports.writeTomlFile = writeTomlFile;
56
68
  exports.writeTomlFileSync = writeTomlFileSync;
package/dist/toml.mjs CHANGED
@@ -1,8 +1,15 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { readFile, readFileSync } from "./read-file.mjs";
2
3
  import { writeFile, writeFileSync } from "./write-file.mjs";
3
4
  import TOML from "smol-toml";
4
5
 
5
6
  //#region src/toml.ts
7
+ var toml_exports = /* @__PURE__ */ __exportAll({
8
+ readTomlFile: () => readTomlFile,
9
+ readTomlFileSync: () => readTomlFileSync,
10
+ writeTomlFile: () => writeTomlFile,
11
+ writeTomlFileSync: () => writeTomlFileSync
12
+ });
6
13
  /**
7
14
  * Reads a TOML file and returns the object the TOML content represents.
8
15
  *
@@ -47,5 +54,5 @@ async function writeTomlFile(path, data, options) {
47
54
  }
48
55
 
49
56
  //#endregion
50
- export { readTomlFile, readTomlFileSync, writeTomlFile, writeTomlFileSync };
57
+ export { readTomlFile, readTomlFileSync, toml_exports, writeTomlFile, writeTomlFileSync };
51
58
  //# sourceMappingURL=toml.mjs.map
package/dist/toml.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"toml.mjs","names":[],"sources":["../src/toml.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 TOML from \"smol-toml\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport function readTomlFileSync(\n path: string,\n options?: Parameters<typeof TOML.parse>[1]\n) {\n const content = readFileSync(path);\n\n return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport async function readTomlFile(\n path: string,\n options?: Parameters<typeof TOML.parse>[1]\n) {\n const content = await readFile(path);\n\n return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport function writeTomlFileSync(\n path: string,\n data: object,\n options?: Parameters<typeof TOML.stringify>[1]\n): void {\n return writeFileSync(path, TOML.stringify(data, options));\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport async function writeTomlFile(\n path: string,\n data: object,\n options?: Parameters<typeof TOML.stringify>[1]\n): Promise<void> {\n return writeFile(path, TOML.stringify(data, options));\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,iBACd,MACA,SACA;CACA,MAAM,UAAU,aAAa,KAAK;AAElC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,eAAsB,aACpB,MACA,SACA;CACA,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,SAAgB,kBACd,MACA,MACA,SACM;AACN,QAAO,cAAc,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC;;;;;;;;;AAU3D,eAAsB,cACpB,MACA,MACA,SACe;AACf,QAAO,UAAU,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"toml.mjs","names":[],"sources":["../src/toml.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 TOML from \"smol-toml\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport function readTomlFileSync(\n path: string,\n options?: Parameters<typeof TOML.parse>[1]\n) {\n const content = readFileSync(path);\n\n return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport async function readTomlFile(\n path: string,\n options?: Parameters<typeof TOML.parse>[1]\n) {\n const content = await readFile(path);\n\n return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport function writeTomlFileSync(\n path: string,\n data: object,\n options?: Parameters<typeof TOML.stringify>[1]\n): void {\n return writeFileSync(path, TOML.stringify(data, options));\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport async function writeTomlFile(\n path: string,\n data: object,\n options?: Parameters<typeof TOML.stringify>[1]\n): Promise<void> {\n return writeFile(path, TOML.stringify(data, options));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,iBACd,MACA,SACA;CACA,MAAM,UAAU,aAAa,KAAK;AAElC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,eAAsB,aACpB,MACA,SACA;CACA,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,SAAgB,kBACd,MACA,MACA,SACM;AACN,QAAO,cAAc,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC;;;;;;;;;AAU3D,eAAsB,cACpB,MACA,MACA,SACe;AACf,QAAO,UAAU,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_toml = require('./toml.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/toml.test.ts
6
+ (0, vitest.describe)("toml.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_toml.toml_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_toml.toml_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { toml_exports } from "./toml.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/toml.test.ts
5
+ describe("toml.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(toml_exports).toBeDefined();
8
+ expect(typeof toml_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=toml.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toml.test.mjs","names":["moduleExports"],"sources":["../src/toml.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./toml.ts\";\n\ndescribe(\"toml.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,yBAAyB;AAChC,IAAG,8BAA8B;AAC/B,SAAOA,aAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,aAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
package/dist/tsconfig.cjs CHANGED
@@ -12,6 +12,7 @@ let _stryke_path_cwd = require("@stryke/path/cwd");
12
12
  let _stryke_path_is_type = require("@stryke/path/is-type");
13
13
 
14
14
  //#region src/tsconfig.ts
15
+ var tsconfig_exports = /* @__PURE__ */ require_runtime.__exportAll({ loadTsConfig: () => loadTsConfig });
15
16
  /**
16
17
  * Loads a tsconfig.json file and returns the parsed JSON object.
17
18
  *
@@ -35,4 +36,10 @@ async function loadTsConfig(filePath = (0, _stryke_path_cwd.cwd)()) {
35
36
  }
36
37
 
37
38
  //#endregion
38
- exports.loadTsConfig = loadTsConfig;
39
+ exports.loadTsConfig = loadTsConfig;
40
+ Object.defineProperty(exports, 'tsconfig_exports', {
41
+ enumerable: true,
42
+ get: function () {
43
+ return tsconfig_exports;
44
+ }
45
+ });
package/dist/tsconfig.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { existsSync } from "./exists.mjs";
2
3
  import { resolve } from "./resolve.mjs";
3
4
  import { readJsonFile } from "./json.mjs";
@@ -9,6 +10,7 @@ import { cwd } from "@stryke/path/cwd";
9
10
  import { isNpmScopedPackage } from "@stryke/path/is-type";
10
11
 
11
12
  //#region src/tsconfig.ts
13
+ var tsconfig_exports = /* @__PURE__ */ __exportAll({ loadTsConfig: () => loadTsConfig });
12
14
  /**
13
15
  * Loads a tsconfig.json file and returns the parsed JSON object.
14
16
  *
@@ -32,5 +34,5 @@ async function loadTsConfig(filePath = cwd()) {
32
34
  }
33
35
 
34
36
  //#endregion
35
- export { loadTsConfig };
37
+ export { loadTsConfig, tsconfig_exports };
36
38
  //# sourceMappingURL=tsconfig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.mjs","names":[],"sources":["../src/tsconfig.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport { findFileExtension, findFilePath } from \"@stryke/path/file-path-fns\";\nimport { isNpmScopedPackage } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport { existsSync } from \"./exists\";\nimport { readJsonFile } from \"./json\";\nimport { resolve } from \"./resolve\";\n\n/**\n * Loads a tsconfig.json file and returns the parsed JSON object.\n *\n * @param filePath - The directory to start searching for the tsconfig.json file.\n * @returns The parsed tsconfig.json object or null if not found.\n */\nexport async function loadTsConfig(\n filePath: string = cwd()\n): Promise<TsConfigJson> {\n let tsconfigFilePath =\n findFileExtension(filePath) === \"json\"\n ? filePath\n : joinPaths(filePath, \"tsconfig.json\");\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = await resolve(filePath, { extensions: [\"json\"] });\n if (!existsSync(tsconfigFilePath)) {\n throw new Error(\n `tsconfig.json not found at ${tsconfigFilePath}. Please ensure the file exists.`\n );\n }\n }\n\n let config = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n if (config?.compilerOptions?.rootDir) {\n config.compilerOptions.rootDir = joinPaths(\n findFilePath(tsconfigFilePath),\n config.compilerOptions.rootDir\n );\n }\n\n if (config?.extends) {\n for (const extendsName of toArray(config.extends)) {\n const parentConfig = await loadTsConfig(\n isNpmScopedPackage(extendsName)\n ? extendsName\n : joinPaths(findFilePath(tsconfigFilePath), extendsName)\n );\n if (parentConfig) {\n config = defu(config, parentConfig ?? {});\n }\n }\n }\n\n config.extends = undefined;\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,eAAsB,aACpB,WAAmB,KAAK,EACD;CACvB,IAAI,mBACF,kBAAkB,SAAS,KAAK,SAC5B,WACA,UAAU,UAAU,gBAAgB;AAC1C,KAAI,CAAC,WAAW,iBAAiB,EAAE;AACjC,qBAAmB,MAAM,QAAQ,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;AACpE,MAAI,CAAC,WAAW,iBAAiB,CAC/B,OAAM,IAAI,MACR,8BAA8B,iBAAiB,kCAChD;;CAIL,IAAI,SAAS,MAAM,aAA2B,iBAAiB;AAC/D,KAAI,QAAQ,iBAAiB,QAC3B,QAAO,gBAAgB,UAAU,UAC/B,aAAa,iBAAiB,EAC9B,OAAO,gBAAgB,QACxB;AAGH,KAAI,QAAQ,QACV,MAAK,MAAM,eAAe,QAAQ,OAAO,QAAQ,EAAE;EACjD,MAAM,eAAe,MAAM,aACzB,mBAAmB,YAAY,GAC3B,cACA,UAAU,aAAa,iBAAiB,EAAE,YAAY,CAC3D;AACD,MAAI,aACF,UAAS,KAAK,QAAQ,gBAAgB,EAAE,CAAC;;AAK/C,QAAO,UAAU;AACjB,QAAO"}
1
+ {"version":3,"file":"tsconfig.mjs","names":[],"sources":["../src/tsconfig.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport { findFileExtension, findFilePath } from \"@stryke/path/file-path-fns\";\nimport { isNpmScopedPackage } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport { existsSync } from \"./exists\";\nimport { readJsonFile } from \"./json\";\nimport { resolve } from \"./resolve\";\n\n/**\n * Loads a tsconfig.json file and returns the parsed JSON object.\n *\n * @param filePath - The directory to start searching for the tsconfig.json file.\n * @returns The parsed tsconfig.json object or null if not found.\n */\nexport async function loadTsConfig(\n filePath: string = cwd()\n): Promise<TsConfigJson> {\n let tsconfigFilePath =\n findFileExtension(filePath) === \"json\"\n ? filePath\n : joinPaths(filePath, \"tsconfig.json\");\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = await resolve(filePath, { extensions: [\"json\"] });\n if (!existsSync(tsconfigFilePath)) {\n throw new Error(\n `tsconfig.json not found at ${tsconfigFilePath}. Please ensure the file exists.`\n );\n }\n }\n\n let config = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n if (config?.compilerOptions?.rootDir) {\n config.compilerOptions.rootDir = joinPaths(\n findFilePath(tsconfigFilePath),\n config.compilerOptions.rootDir\n );\n }\n\n if (config?.extends) {\n for (const extendsName of toArray(config.extends)) {\n const parentConfig = await loadTsConfig(\n isNpmScopedPackage(extendsName)\n ? extendsName\n : joinPaths(findFilePath(tsconfigFilePath), extendsName)\n );\n if (parentConfig) {\n config = defu(config, parentConfig ?? {});\n }\n }\n }\n\n config.extends = undefined;\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,aACpB,WAAmB,KAAK,EACD;CACvB,IAAI,mBACF,kBAAkB,SAAS,KAAK,SAC5B,WACA,UAAU,UAAU,gBAAgB;AAC1C,KAAI,CAAC,WAAW,iBAAiB,EAAE;AACjC,qBAAmB,MAAM,QAAQ,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;AACpE,MAAI,CAAC,WAAW,iBAAiB,CAC/B,OAAM,IAAI,MACR,8BAA8B,iBAAiB,kCAChD;;CAIL,IAAI,SAAS,MAAM,aAA2B,iBAAiB;AAC/D,KAAI,QAAQ,iBAAiB,QAC3B,QAAO,gBAAgB,UAAU,UAC/B,aAAa,iBAAiB,EAC9B,OAAO,gBAAgB,QACxB;AAGH,KAAI,QAAQ,QACV,MAAK,MAAM,eAAe,QAAQ,OAAO,QAAQ,EAAE;EACjD,MAAM,eAAe,MAAM,aACzB,mBAAmB,YAAY,GAC3B,cACA,UAAU,aAAa,iBAAiB,EAAE,YAAY,CAC3D;AACD,MAAI,aACF,UAAS,KAAK,QAAQ,gBAAgB,EAAE,CAAC;;AAK/C,QAAO,UAAU;AACjB,QAAO"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_tsconfig = require('./tsconfig.cjs');
3
+ let vitest = require("vitest");
4
+
5
+ //#region src/tsconfig.test.ts
6
+ (0, vitest.describe)("tsconfig.ts exports", () => {
7
+ (0, vitest.it)("loads module exports", () => {
8
+ (0, vitest.expect)(require_tsconfig.tsconfig_exports).toBeDefined();
9
+ (0, vitest.expect)(typeof require_tsconfig.tsconfig_exports).toBe("object");
10
+ });
11
+ });
12
+
13
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,14 @@
1
+ import { tsconfig_exports } from "./tsconfig.mjs";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ //#region src/tsconfig.test.ts
5
+ describe("tsconfig.ts exports", () => {
6
+ it("loads module exports", () => {
7
+ expect(tsconfig_exports).toBeDefined();
8
+ expect(typeof tsconfig_exports).toBe("object");
9
+ });
10
+ });
11
+
12
+ //#endregion
13
+ export { };
14
+ //# sourceMappingURL=tsconfig.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.test.mjs","names":["moduleExports"],"sources":["../src/tsconfig.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./tsconfig.ts\";\n\ndescribe(\"tsconfig.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"}
@@ -8,6 +8,10 @@ let _stryke_path_correct_path = require("@stryke/path/correct-path");
8
8
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
9
9
 
10
10
  //#region src/write-file.ts
11
+ var write_file_exports = /* @__PURE__ */ require_runtime.__exportAll({
12
+ writeFile: () => writeFile,
13
+ writeFileSync: () => writeFileSync
14
+ });
11
15
  /**
12
16
  * Write the given content to the given file path
13
17
  *
@@ -38,4 +42,10 @@ const writeFile = async (filePath, content = "", options = {}) => {
38
42
 
39
43
  //#endregion
40
44
  exports.writeFile = writeFile;
41
- exports.writeFileSync = writeFileSync;
45
+ exports.writeFileSync = writeFileSync;
46
+ Object.defineProperty(exports, 'write_file_exports', {
47
+ enumerable: true,
48
+ get: function () {
49
+ return write_file_exports;
50
+ }
51
+ });
@@ -1,3 +1,4 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
1
2
  import { existsSync as existsSync$1 } from "./exists.mjs";
2
3
  import { createDirectory, createDirectorySync } from "./helpers.mjs";
3
4
  import { writeFileSync as writeFileSync$1 } from "node:fs";
@@ -6,6 +7,10 @@ import { correctPath } from "@stryke/path/correct-path";
6
7
  import { findFilePath } from "@stryke/path/file-path-fns";
7
8
 
8
9
  //#region src/write-file.ts
10
+ var write_file_exports = /* @__PURE__ */ __exportAll({
11
+ writeFile: () => writeFile,
12
+ writeFileSync: () => writeFileSync
13
+ });
9
14
  /**
10
15
  * Write the given content to the given file path
11
16
  *
@@ -35,5 +40,5 @@ const writeFile = async (filePath, content = "", options = {}) => {
35
40
  };
36
41
 
37
42
  //#endregion
38
- export { writeFile, writeFileSync };
43
+ export { writeFile, writeFileSync, write_file_exports };
39
44
  //# sourceMappingURL=write-file.mjs.map