@stryke/fs 0.32.13 → 0.32.15

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.
@@ -54,13 +54,13 @@ async function x(t, e = {}) {
54
54
  async function getPackageInfo(t, e = {}) {
55
55
  const n = await x(t, e);
56
56
  if (!n) return;
57
- const s = await (0, _json.readJsonFile)(n);
57
+ const a = await (0, _json.readJsonFile)(n);
58
58
  return {
59
59
  name: t,
60
- version: s.version,
60
+ version: a.version,
61
61
  rootPath: (0, _filePathFns.findFilePath)(n),
62
62
  packageJsonPath: n,
63
- packageJson: s
63
+ packageJson: a
64
64
  };
65
65
  }
66
66
  async function loadPackageJson(t = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
@@ -72,27 +72,27 @@ async function loadPackageJson(t = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
72
72
  }
73
73
  async function isPackageListed(t, e) {
74
74
  const n = (0, _package.getPackageName)(t),
75
- s = (0, _isString.isString)(e) ? e : e?.cwd,
76
- a = await loadPackageJson(s);
77
- return a ? !!(a.dependencies && n in a.dependencies && a.dependencies[n] || a.devDependencies && n in a.devDependencies && a.devDependencies[n]) : !1;
75
+ a = (0, _isString.isString)(e) ? e : e?.cwd,
76
+ s = await loadPackageJson(a);
77
+ return s ? !!(s.dependencies && n in s.dependencies && s.dependencies[n] || s.devDependencies && n in s.devDependencies && s.devDependencies[n]) : !1;
78
78
  }
79
79
  async function getPackageListing(t, e) {
80
80
  const n = (0, _package.getPackageName)(t),
81
- s = (0, _isString.isString)(e) ? e : e?.cwd,
82
- a = await loadPackageJson(s);
83
- if (!a) return;
84
- const i = a.dependencies && n in a.dependencies ? a.dependencies[n] : a.devDependencies && n in a.devDependencies ? a.devDependencies[n] : void 0,
85
- o = (a.dependencies && n in a.dependencies ? "dependencies" : a.devDependencies && n in a.devDependencies ? "devDependencies" : void 0) || void 0;
81
+ a = (0, _isString.isString)(e) ? e : e?.cwd,
82
+ s = await loadPackageJson(a);
83
+ if (!s) return;
84
+ const i = s.dependencies && n in s.dependencies ? s.dependencies[n] : s.devDependencies && n in s.devDependencies ? s.devDependencies[n] : void 0,
85
+ o = (s.dependencies && n in s.dependencies ? "dependencies" : s.devDependencies && n in s.devDependencies ? "devDependencies" : void 0) || void 0;
86
86
  return i && o ? {
87
87
  version: i,
88
88
  type: o
89
89
  } : void 0;
90
90
  }
91
91
  async function doesPackageMatch(t, e, n) {
92
- const s = await getPackageListing(t, {
92
+ const a = await getPackageListing(t, {
93
93
  cwd: n
94
94
  });
95
- return s ? s.version.startsWith("catalog:") || s.version.startsWith("workspace:") || (0, _semver.subset)(s.version, e) : !1;
95
+ return a ? a.version.startsWith("catalog:") || a.version.startsWith("workspace:") || (0, _semver.subset)(a.version, e) : !1;
96
96
  }
97
97
  function isPackageExists(t, e = {}) {
98
98
  return !!(0, _resolve.resolvePackage)(t, e);
@@ -1,7 +1,7 @@
1
1
  import type { PackageJson } from "@stryke/types/package-json";
2
2
  import type { PackageManager } from "@stryke/types/package-manager";
3
3
  import type { Range } from "semver";
4
- import type { PackageResolvingOptions } from "./resolve";
4
+ import type { ResolveOptions } from "./resolve";
5
5
  /**
6
6
  * Get the package manager used in the project
7
7
  *
@@ -16,7 +16,7 @@ export declare function getPackageManager(dir?: any): PackageManager;
16
16
  * @param options - The options to use when resolving the package
17
17
  * @returns The package info
18
18
  */
19
- export declare function getPackageInfo(name: string, options?: PackageResolvingOptions): Promise<{
19
+ export declare function getPackageInfo(name: string, options?: ResolveOptions): Promise<{
20
20
  name: string;
21
21
  version: any;
22
22
  rootPath: any;
@@ -86,4 +86,4 @@ export declare function doesPackageMatch(name: string, version: string, cwd?: st
86
86
  * @param options - The options to use when resolving the package
87
87
  * @returns An indicator specifying if the package exists
88
88
  */
89
- export declare function isPackageExists(name: string, options?: PackageResolvingOptions): boolean;
89
+ export declare function isPackageExists(name: string, options?: ResolveOptions): boolean;
@@ -1 +1 @@
1
- import{findFileName as f,findFilePath as r}from"@stryke/path/file-path-fns";import{joinPaths as m}from"@stryke/path/join-paths";import{getPackageName as c}from"@stryke/string-format/package";import{isString as p}from"@stryke/type-checks/is-string";import{existsSync as P}from"node:fs";import{subset as l}from"semver";import{exists as y}from"./exists";import{getParentPath as g}from"./get-parent-path";import{getWorkspaceRoot as d}from"./get-workspace-root";import{readJsonFile as k}from"./json";import{resolvePackage as u}from"./resolve";export function getPackageManager(t=d()){const e=g(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock"],t,{includeNameInResults:!0});if(!e)return"pnpm";switch(f(e)){case"yarn.lock":return"yarn";case"pnpm-lock.yaml":return"pnpm";case"bun.lock":return"bun";default:return"npm"}}async function v(t){let e;for(;;){if(!t)return;const n=r(t);if(n===t)return;if(t=n,e=m(t,"package.json"),await y(e))break}return e}async function x(t,e={}){const n=await u(t,e);if(n)return v(n)}export async function getPackageInfo(t,e={}){const n=await x(t,e);if(!n)return;const s=await k(n);return{name:t,version:s.version,rootPath:r(n),packageJsonPath:n,packageJson:s}}export async function loadPackageJson(t=d()){const e=g("package.json",t,{skipCwd:!1,includeNameInResults:!0});return!e||!P(e)?null:k(e)}export async function isPackageListed(t,e){const n=c(t),s=p(e)?e:e?.cwd,a=await loadPackageJson(s);return a?!!(a.dependencies&&n in a.dependencies&&a.dependencies[n]||a.devDependencies&&n in a.devDependencies&&a.devDependencies[n]):!1}export async function getPackageListing(t,e){const n=c(t),s=p(e)?e:e?.cwd,a=await loadPackageJson(s);if(!a)return;const i=a.dependencies&&n in a.dependencies?a.dependencies[n]:a.devDependencies&&n in a.devDependencies?a.devDependencies[n]:void 0,o=(a.dependencies&&n in a.dependencies?"dependencies":a.devDependencies&&n in a.devDependencies?"devDependencies":void 0)||void 0;return i&&o?{version:i,type:o}:void 0}export async function doesPackageMatch(t,e,n){const s=await getPackageListing(t,{cwd:n});return s?s.version.startsWith("catalog:")||s.version.startsWith("workspace:")||l(s.version,e):!1}export function isPackageExists(t,e={}){return!!u(t,e)}
1
+ import{findFileName as f,findFilePath as r}from"@stryke/path/file-path-fns";import{joinPaths as m}from"@stryke/path/join-paths";import{getPackageName as c}from"@stryke/string-format/package";import{isString as p}from"@stryke/type-checks/is-string";import{existsSync as l}from"node:fs";import{subset as P}from"semver";import{exists as y}from"./exists";import{getParentPath as g}from"./get-parent-path";import{getWorkspaceRoot as d}from"./get-workspace-root";import{readJsonFile as k}from"./json";import{resolvePackage as u}from"./resolve";export function getPackageManager(t=d()){const e=g(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock"],t,{includeNameInResults:!0});if(!e)return"pnpm";switch(f(e)){case"yarn.lock":return"yarn";case"pnpm-lock.yaml":return"pnpm";case"bun.lock":return"bun";default:return"npm"}}async function v(t){let e;for(;;){if(!t)return;const n=r(t);if(n===t)return;if(t=n,e=m(t,"package.json"),await y(e))break}return e}async function x(t,e={}){const n=await u(t,e);if(n)return v(n)}export async function getPackageInfo(t,e={}){const n=await x(t,e);if(!n)return;const a=await k(n);return{name:t,version:a.version,rootPath:r(n),packageJsonPath:n,packageJson:a}}export async function loadPackageJson(t=d()){const e=g("package.json",t,{skipCwd:!1,includeNameInResults:!0});return!e||!l(e)?null:k(e)}export async function isPackageListed(t,e){const n=c(t),a=p(e)?e:e?.cwd,s=await loadPackageJson(a);return s?!!(s.dependencies&&n in s.dependencies&&s.dependencies[n]||s.devDependencies&&n in s.devDependencies&&s.devDependencies[n]):!1}export async function getPackageListing(t,e){const n=c(t),a=p(e)?e:e?.cwd,s=await loadPackageJson(a);if(!s)return;const i=s.dependencies&&n in s.dependencies?s.dependencies[n]:s.devDependencies&&n in s.devDependencies?s.devDependencies[n]:void 0,o=(s.dependencies&&n in s.dependencies?"dependencies":s.devDependencies&&n in s.devDependencies?"devDependencies":void 0)||void 0;return i&&o?{version:i,type:o}:void 0}export async function doesPackageMatch(t,e,n){const a=await getPackageListing(t,{cwd:n});return a?a.version.startsWith("catalog:")||a.version.startsWith("workspace:")||P(a.version,e):!1}export function isPackageExists(t,e={}){return!!u(t,e)}
package/dist/resolve.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.DEFAULT_EXTENSIONS = void 0;
6
7
  exports.importModule = importModule;
7
8
  exports.resolve = resolve;
8
9
  exports.resolvePackage = resolvePackage;
@@ -10,51 +11,117 @@ exports.resolvePackageSync = resolvePackageSync;
10
11
  exports.resolveSafe = resolveSafe;
11
12
  exports.resolveSafeSync = resolveSafeSync;
12
13
  exports.resolveSync = resolveSync;
14
+ var _getUnique = require("@stryke/helpers/get-unique");
15
+ var _path = require("@stryke/path");
13
16
  var _correctPath = require("@stryke/path/correct-path");
14
17
  var _cwd = require("@stryke/path/cwd");
15
18
  var _filePathFns = require("@stryke/path/file-path-fns");
16
19
  var _joinPaths = require("@stryke/path/join-paths");
17
20
  var _mlly = require("mlly");
21
+ var _nodeFs = require("node:fs");
18
22
  var _getWorkspaceRoot = require("./get-workspace-root.cjs");
19
- async function resolve(r, e = {}) {
20
- const t = e.paths ?? [];
21
- t.length === 0 && t.push((0, _cwd.cwd)());
22
- const n = (0, _getWorkspaceRoot.getWorkspaceRoot)();
23
- return t.includes(n) || t.push(n), (0, _correctPath.correctPath)(await (0, _mlly.resolvePath)(r, {
24
- url: t
25
- }));
23
+ const DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts", "json", "jsonc", "json5", "node"];
24
+ async function resolve(n, e = {}) {
25
+ let r = e.paths ?? [];
26
+ r.length === 0 && r.push((0, _cwd.cwd)());
27
+ const o = (0, _getWorkspaceRoot.getWorkspaceRoot)();
28
+ r.includes(o) || r.push(o), r = (0, _getUnique.getUnique)(r.filter(Boolean).map(t => (0, _correctPath.correctPath)(t)).reduce((t, i, E, x) => (t.push(i), (0, _nodeFs.existsSync)((0, _path.appendPath)(i, o)) && t.push((0, _path.appendPath)(i, o)), x.forEach(l => {
29
+ (0, _nodeFs.existsSync)((0, _path.appendPath)(i, l)) && t.push((0, _path.appendPath)(i, l));
30
+ }), t), []));
31
+ let s, c;
32
+ try {
33
+ s = await (0, _mlly.resolvePath)(n, {
34
+ url: r,
35
+ extensions: e.extensions ?? DEFAULT_EXTENSIONS,
36
+ conditions: e.conditions
37
+ });
38
+ } catch (t) {
39
+ c = t;
40
+ }
41
+ if (!s) for (let t = 0; t < r.length && !s; t++) try {
42
+ s = await (0, _mlly.resolvePath)((0, _path.replacePath)(n, r[t]), {
43
+ url: r,
44
+ extensions: e.extensions ?? DEFAULT_EXTENSIONS,
45
+ conditions: e.conditions
46
+ });
47
+ } catch (i) {
48
+ c = i;
49
+ }
50
+ if (!s && (0, _filePathFns.findFileName)(n, {
51
+ withExtension: !1
52
+ }) !== "index") try {
53
+ s = await resolve((0, _joinPaths.joinPaths)(n, "index"), {
54
+ ...e,
55
+ paths: r
56
+ }), s && (s = (0, _filePathFns.findFilePath)(s));
57
+ } catch (t) {
58
+ c = t;
59
+ }
60
+ if (!s) throw c ?? new Error(`Cannot resolve module '${n}'`);
61
+ return (0, _correctPath.correctPath)(s);
26
62
  }
27
- function resolveSync(r, e = {}) {
28
- const t = e.paths ?? [];
29
- t.length === 0 && t.push(process.cwd());
30
- const n = (0, _getWorkspaceRoot.getWorkspaceRoot)();
31
- return t.includes(n) || t.push(n), (0, _correctPath.correctPath)((0, _mlly.resolvePathSync)(r, {
32
- url: e.paths
33
- }));
63
+ function resolveSync(n, e = {}) {
64
+ let r = e.paths ?? [];
65
+ r.length === 0 && r.push(process.cwd());
66
+ const o = (0, _getWorkspaceRoot.getWorkspaceRoot)();
67
+ r.includes(o) || r.push(o), r = (0, _getUnique.getUnique)(r.filter(Boolean).map(t => (0, _correctPath.correctPath)(t)).reduce((t, i, E, x) => (t.push(i), (0, _nodeFs.existsSync)((0, _path.appendPath)(i, o)) && t.push((0, _path.appendPath)(i, o)), x.forEach(l => {
68
+ (0, _nodeFs.existsSync)((0, _path.appendPath)(i, l)) && t.push((0, _path.appendPath)(i, l));
69
+ }), t), []));
70
+ let s, c;
71
+ try {
72
+ s = (0, _mlly.resolvePathSync)(n, {
73
+ url: r,
74
+ extensions: e.extensions ?? DEFAULT_EXTENSIONS,
75
+ conditions: e.conditions
76
+ });
77
+ } catch (t) {
78
+ c = t;
79
+ }
80
+ if (!s) for (let t = 0; t < r.length && !s; t++) try {
81
+ s = (0, _mlly.resolvePathSync)((0, _path.replacePath)(n, r[t]), {
82
+ url: r,
83
+ extensions: e.extensions ?? DEFAULT_EXTENSIONS,
84
+ conditions: e.conditions
85
+ });
86
+ } catch (i) {
87
+ c = i;
88
+ }
89
+ if (!s && (0, _filePathFns.findFileName)(n, {
90
+ withExtension: !1
91
+ }) !== "index") try {
92
+ s = resolveSync((0, _joinPaths.joinPaths)(n, "index"), {
93
+ ...e,
94
+ paths: r
95
+ }), s && (s = (0, _filePathFns.findFilePath)(s));
96
+ } catch (t) {
97
+ c = t;
98
+ }
99
+ if (!s) throw c ?? new Error(`Cannot resolve module '${n}'`);
100
+ return (0, _correctPath.correctPath)(s);
34
101
  }
35
- async function resolveSafe(r, e = {}) {
102
+ async function resolveSafe(n, e = {}) {
36
103
  try {
37
- return await resolve(r, e);
104
+ return await resolve(n, e);
38
105
  } catch {
39
106
  return;
40
107
  }
41
108
  }
42
- function resolveSafeSync(r, e = {}) {
109
+ function resolveSafeSync(n, e = {}) {
43
110
  try {
44
- return resolveSync(r, e);
111
+ return resolveSync(n, e);
45
112
  } catch {
46
113
  return;
47
114
  }
48
115
  }
49
- async function importModule(r) {
50
- const e = await Promise.resolve(`${r}`).then(s => require(s));
116
+ async function importModule(n) {
117
+ const e = await Promise.resolve(`${n}`).then(s => require(s));
51
118
  return e && (0, _mlly.interopDefault)(e);
52
119
  }
53
- async function resolvePackage(r, e = {}) {
54
- let t = await resolveSafe((0, _joinPaths.joinPaths)(r, "package.json"), e);
55
- return t || (t = await resolveSafe((0, _joinPaths.joinPaths)(r, "index.js"), e), t || (t = await resolveSafe(r, e))), t ? (0, _filePathFns.findFilePath)(t) : void 0;
120
+ async function resolvePackage(n, e = {}) {
121
+ let r = await resolveSafe((0, _joinPaths.joinPaths)(n, "package.json"), e);
122
+ return r || (r = await resolveSafe((0, _joinPaths.joinPaths)(n, "index.js"), e), r || (r = await resolveSafe(n, e))), r ? (0, _filePathFns.findFilePath)(r) : void 0;
56
123
  }
57
- function resolvePackageSync(r, e = {}) {
58
- let t = resolveSafeSync((0, _joinPaths.joinPaths)(r, "package.json"), e);
59
- return t || (t = resolveSafeSync((0, _joinPaths.joinPaths)(r, "index.js"), e), t || (t = resolveSafeSync(r, e))), t ? (0, _filePathFns.findFilePath)(t) : void 0;
124
+ function resolvePackageSync(n, e = {}) {
125
+ let r = resolveSafeSync((0, _joinPaths.joinPaths)(n, "package.json"), e);
126
+ return r || (r = resolveSafeSync((0, _joinPaths.joinPaths)(n, "index.js"), e), r || (r = resolveSafeSync(n, e))), r ? (0, _filePathFns.findFilePath)(r) : void 0;
60
127
  }
package/dist/resolve.d.ts CHANGED
@@ -1,13 +1,22 @@
1
- import type { Platform } from "@stryke/types/system";
2
- export interface PackageResolvingOptions {
1
+ export declare const DEFAULT_EXTENSIONS: string[];
2
+ export interface ResolveOptions {
3
3
  /**
4
4
  * Paths to resolve the package from
5
5
  */
6
6
  paths?: string[];
7
7
  /**
8
- * Resolve path as linux (stand-in for unix/posix) or win32
8
+ * File extensions to consider when resolving the module
9
+ *
10
+ * @remarks
11
+ * Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.
12
+ *
13
+ * @defaultValue ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts", "json", "jsonc", "json5", "node", "wasm"]
9
14
  */
10
- platform?: Platform;
15
+ extensions?: string[];
16
+ /**
17
+ * Conditions to consider when resolving package exports.
18
+ */
19
+ conditions?: string[];
11
20
  }
12
21
  /**
13
22
  * Resolve the path to a specified module
@@ -16,7 +25,7 @@ export interface PackageResolvingOptions {
16
25
  * @param options - The options to use when resolving the module
17
26
  * @returns A promise for the path to the module
18
27
  */
19
- export declare function resolve(path: string, options?: PackageResolvingOptions): Promise<any>;
28
+ export declare function resolve(path: string, options?: ResolveOptions): Promise<string>;
20
29
  /**
21
30
  * Resolve the path to a specified module
22
31
  *
@@ -24,7 +33,7 @@ export declare function resolve(path: string, options?: PackageResolvingOptions)
24
33
  * @param options - The options to use when resolving the module
25
34
  * @returns The path to the module or undefined
26
35
  */
27
- export declare function resolveSync(path: string, options?: PackageResolvingOptions): any;
36
+ export declare function resolveSync(path: string, options?: ResolveOptions): any;
28
37
  /**
29
38
  * Resolve the path to a specified module with error handling
30
39
  *
@@ -32,7 +41,7 @@ export declare function resolveSync(path: string, options?: PackageResolvingOpti
32
41
  * @param options - The options to use when resolving the module
33
42
  * @returns A promise for the path to the module
34
43
  */
35
- export declare function resolveSafe(name: string, options?: PackageResolvingOptions): Promise<any>;
44
+ export declare function resolveSafe(name: string, options?: ResolveOptions): Promise<string | undefined>;
36
45
  /**
37
46
  * Resolve the path to a specified module with error handling
38
47
  *
@@ -40,7 +49,7 @@ export declare function resolveSafe(name: string, options?: PackageResolvingOpti
40
49
  * @param options - The options to use when resolving the module
41
50
  * @returns The path to the module or undefined
42
51
  */
43
- export declare function resolveSafeSync(name: string, options?: PackageResolvingOptions): any;
52
+ export declare function resolveSafeSync(name: string, options?: ResolveOptions): any;
44
53
  /**
45
54
  * Import a module from a specified path
46
55
  *
@@ -57,7 +66,7 @@ export declare function importModule<T = any>(path: string): Promise<T>;
57
66
  * @param name - The name of the module
58
67
  * @returns A promise for the module or undefined
59
68
  */
60
- export declare function resolvePackage(name: string, options?: PackageResolvingOptions): Promise<any>;
69
+ export declare function resolvePackage(name: string, options?: ResolveOptions): Promise<any>;
61
70
  /**
62
71
  * Resolve the path to a specified package synchronously
63
72
  *
@@ -68,4 +77,4 @@ export declare function resolvePackage(name: string, options?: PackageResolvingO
68
77
  * @param options - The options to use when resolving the module
69
78
  * @returns The module or undefined
70
79
  */
71
- export declare function resolvePackageSync(name: string, options?: PackageResolvingOptions): any;
80
+ export declare function resolvePackageSync(name: string, options?: ResolveOptions): any;
package/dist/resolve.mjs CHANGED
@@ -1 +1 @@
1
- import{correctPath as i}from"@stryke/path/correct-path";import{cwd as c}from"@stryke/path/cwd";import{findFilePath as s}from"@stryke/path/file-path-fns";import{joinPaths as o}from"@stryke/path/join-paths";import{interopDefault as p,resolvePath as f,resolvePathSync as u}from"mlly";import{getWorkspaceRoot as a}from"./get-workspace-root";export async function resolve(r,e={}){const t=e.paths??[];t.length===0&&t.push(c());const n=a();return t.includes(n)||t.push(n),i(await f(r,{url:t}))}export function resolveSync(r,e={}){const t=e.paths??[];t.length===0&&t.push(process.cwd());const n=a();return t.includes(n)||t.push(n),i(u(r,{url:e.paths}))}export async function resolveSafe(r,e={}){try{return await resolve(r,e)}catch{return}}export function resolveSafeSync(r,e={}){try{return resolveSync(r,e)}catch{return}}export async function importModule(r){const e=await import(r);return e&&p(e)}export async function resolvePackage(r,e={}){let t=await resolveSafe(o(r,"package.json"),e);return t||(t=await resolveSafe(o(r,"index.js"),e),t||(t=await resolveSafe(r,e))),t?s(t):void 0}export function resolvePackageSync(r,e={}){let t=resolveSafeSync(o(r,"package.json"),e);return t||(t=resolveSafeSync(o(r,"index.js"),e),t||(t=resolveSafeSync(r,e))),t?s(t):void 0}
1
+ import{getUnique as m}from"@stryke/helpers/get-unique";import{appendPath as a,replacePath as p}from"@stryke/path";import{correctPath as u}from"@stryke/path/correct-path";import{cwd as j}from"@stryke/path/cwd";import{findFileName as g,findFilePath as d}from"@stryke/path/file-path-fns";import{joinPaths as f}from"@stryke/path/join-paths";import{interopDefault as P,resolvePath as w,resolvePathSync as y}from"mlly";import{existsSync as h}from"node:fs";import{getWorkspaceRoot as v}from"./get-workspace-root";export const DEFAULT_EXTENSIONS=["js","jsx","mjs","cjs","ts","tsx","mts","cts","json","jsonc","json5","node"];export async function resolve(n,e={}){let r=e.paths??[];r.length===0&&r.push(j());const o=v();r.includes(o)||r.push(o),r=m(r.filter(Boolean).map(t=>u(t)).reduce((t,i,E,x)=>(t.push(i),h(a(i,o))&&t.push(a(i,o)),x.forEach(l=>{h(a(i,l))&&t.push(a(i,l))}),t),[]));let s,c;try{s=await w(n,{url:r,extensions:e.extensions??DEFAULT_EXTENSIONS,conditions:e.conditions})}catch(t){c=t}if(!s)for(let t=0;t<r.length&&!s;t++)try{s=await w(p(n,r[t]),{url:r,extensions:e.extensions??DEFAULT_EXTENSIONS,conditions:e.conditions})}catch(i){c=i}if(!s&&g(n,{withExtension:!1})!=="index")try{s=await resolve(f(n,"index"),{...e,paths:r}),s&&(s=d(s))}catch(t){c=t}if(!s)throw c??new Error(`Cannot resolve module '${n}'`);return u(s)}export function resolveSync(n,e={}){let r=e.paths??[];r.length===0&&r.push(process.cwd());const o=v();r.includes(o)||r.push(o),r=m(r.filter(Boolean).map(t=>u(t)).reduce((t,i,E,x)=>(t.push(i),h(a(i,o))&&t.push(a(i,o)),x.forEach(l=>{h(a(i,l))&&t.push(a(i,l))}),t),[]));let s,c;try{s=y(n,{url:r,extensions:e.extensions??DEFAULT_EXTENSIONS,conditions:e.conditions})}catch(t){c=t}if(!s)for(let t=0;t<r.length&&!s;t++)try{s=y(p(n,r[t]),{url:r,extensions:e.extensions??DEFAULT_EXTENSIONS,conditions:e.conditions})}catch(i){c=i}if(!s&&g(n,{withExtension:!1})!=="index")try{s=resolveSync(f(n,"index"),{...e,paths:r}),s&&(s=d(s))}catch(t){c=t}if(!s)throw c??new Error(`Cannot resolve module '${n}'`);return u(s)}export async function resolveSafe(n,e={}){try{return await resolve(n,e)}catch{return}}export function resolveSafeSync(n,e={}){try{return resolveSync(n,e)}catch{return}}export async function importModule(n){const e=await import(n);return e&&P(e)}export async function resolvePackage(n,e={}){let r=await resolveSafe(f(n,"package.json"),e);return r||(r=await resolveSafe(f(n,"index.js"),e),r||(r=await resolveSafe(n,e))),r?d(r):void 0}export function resolvePackageSync(n,e={}){let r=resolveSafeSync(f(n,"package.json"),e);return r||(r=resolveSafeSync(f(n,"index.js"),e),r||(r=resolveSafeSync(n,e))),r?d(r):void 0}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/fs",
3
- "version": "0.32.13",
3
+ "version": "0.32.15",
4
4
  "type": "module",
5
5
  "description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
6
6
  "repository": {
@@ -9,30 +9,31 @@
9
9
  "directory": "packages/fs"
10
10
  },
11
11
  "private": false,
12
- "peerDependencies": { "nx": "22.0.3" },
12
+ "peerDependencies": { "nx": "22.1.0" },
13
13
  "peerDependenciesMeta": { "nx": { "optional": true } },
14
14
  "dependencies": {
15
15
  "@antfu/install-pkg": "^1.1.0",
16
16
  "@ltd/j-toml": "^1.38.0",
17
- "@storm-software/config-tools": "^1.188.38",
18
- "@stryke/convert": "^0.6.2",
19
- "@stryke/path": "^0.19.2",
20
- "@stryke/string-format": "^0.12.2",
17
+ "@storm-software/config-tools": "^1.188.48",
18
+ "@stryke/convert": "^0.6.4",
19
+ "@stryke/helpers": "^0.9.6",
20
+ "@stryke/path": "^0.19.4",
21
+ "@stryke/string-format": "^0.12.4",
21
22
  "chalk": "^5.6.2",
22
23
  "defu": "^6.1.4",
23
- "glob": "^11.0.3",
24
+ "glob": "^11.1.0",
24
25
  "mlly": "1.7.4",
25
26
  "nanotar": "^0.2.0",
26
27
  "semver": "7.7.1",
27
28
  "yaml": "^2.8.1",
28
- "@stryke/json": "^0.9.5",
29
- "@stryke/type-checks": "^0.3.12",
30
- "@stryke/types": "^0.10.2"
29
+ "@stryke/json": "^0.9.7",
30
+ "@stryke/type-checks": "^0.3.14",
31
+ "@stryke/types": "^0.10.4"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^22.19.1",
34
+ "@types/node": "^24.10.1",
34
35
  "@types/semver": "^7.7.1",
35
- "nx": "22.0.3",
36
+ "nx": "22.1.0",
36
37
  "tinyexec": "^0.3.2"
37
38
  },
38
39
  "publishConfig": { "access": "public" },
@@ -409,5 +410,5 @@
409
410
  "main": "./dist/index.cjs",
410
411
  "module": "./dist/index.mjs",
411
412
  "types": "./dist/index.d.ts",
412
- "gitHead": "70bd678a49290690486da02a1721a3ba179a9867"
413
+ "gitHead": "201972005e4b1291d431d46e3fb49764f44690c5"
413
414
  }