@stryke/fs 0.33.3 → 0.33.4
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.
- package/dist/resolve.cjs +1 -1
- package/dist/resolve.mjs +1 -1
- package/package.json +9 -9
package/dist/resolve.cjs
CHANGED
|
@@ -40,7 +40,7 @@ function getResolutionCombinations(n, r = {}) {
|
|
|
40
40
|
let e = getResolutionPaths(r.paths);
|
|
41
41
|
(0, _isType.isNpmScopedPackage)(n) ? e = getNodeModulesPaths(e) : e.push(...getNodeModulesPaths(e));
|
|
42
42
|
const s = r.extensions ?? DEFAULT_EXTENSIONS;
|
|
43
|
-
let t = e.map(o => (0, _joinPaths.joinPaths)(
|
|
43
|
+
let t = e.map(o => (0, _joinPaths.joinPaths)(o, n));
|
|
44
44
|
return (0, _filePathFns.findFileName)(n, {
|
|
45
45
|
withExtension: !1
|
|
46
46
|
}) !== "index" && (t = t.reduce((o, u) => (o.push(u), o.push((0, _joinPaths.joinPaths)(u, "index")), o), [])), (0, _filePathFns.findFileExtension)(n) || (t = t.reduce((o, u) => (o.push(u), s.forEach(c => {
|
package/dist/resolve.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getUnique as a}from"@stryke/helpers/get-unique";import{appendExtension as g}from"@stryke/path";import{correctPath as l,toAbsolutePath as f}from"@stryke/path/correct-path";import{cwd as d}from"@stryke/path/cwd";import{findFileExtension as h,findFileName as x,findFilePath as m,findFolderName as v}from"@stryke/path/file-path-fns";import{isAbsolutePath as w,isNpmScopedPackage as p}from"@stryke/path/is-type";import{joinPaths as i}from"@stryke/path/join-paths";import{interopDefault as P,resolvePath as j,resolvePathSync as y}from"mlly";import{existsSync as E}from"./exists";import{getWorkspaceRoot as R}from"./get-workspace-root";export const DEFAULT_EXTENSIONS=["js","jsx","mjs","cjs","ts","tsx","mts","cts","json","jsonc","json5","node"];export function getResolutionPaths(n=[]){let r=n;r.includes(d())||r.push(d());const e=R();return r.includes(e)||r.push(e),r=a(r.filter(Boolean).map(s=>l(s)).reduce((s,t,o,u)=>(s.push(t),w(t)||(s.push(f(t,d())),s.push(f(t,e)),u.forEach(c=>{s.push(f(t,c))})),s),[])),r}export function getNodeModulesPaths(n=[]){return a(n.reduce((r,e)=>(v(e)==="node_modules"&&r.push(l(e)),E(i(e,"node_modules"))&&r.push(l(i(e,"node_modules"))),r),[]))}export function getResolutionCombinations(n,r={}){let e=getResolutionPaths(r.paths);p(n)?e=getNodeModulesPaths(e):e.push(...getNodeModulesPaths(e));const s=r.extensions??DEFAULT_EXTENSIONS;let t=e.map(o=>i(n
|
|
1
|
+
import{getUnique as a}from"@stryke/helpers/get-unique";import{appendExtension as g}from"@stryke/path";import{correctPath as l,toAbsolutePath as f}from"@stryke/path/correct-path";import{cwd as d}from"@stryke/path/cwd";import{findFileExtension as h,findFileName as x,findFilePath as m,findFolderName as v}from"@stryke/path/file-path-fns";import{isAbsolutePath as w,isNpmScopedPackage as p}from"@stryke/path/is-type";import{joinPaths as i}from"@stryke/path/join-paths";import{interopDefault as P,resolvePath as j,resolvePathSync as y}from"mlly";import{existsSync as E}from"./exists";import{getWorkspaceRoot as R}from"./get-workspace-root";export const DEFAULT_EXTENSIONS=["js","jsx","mjs","cjs","ts","tsx","mts","cts","json","jsonc","json5","node"];export function getResolutionPaths(n=[]){let r=n;r.includes(d())||r.push(d());const e=R();return r.includes(e)||r.push(e),r=a(r.filter(Boolean).map(s=>l(s)).reduce((s,t,o,u)=>(s.push(t),w(t)||(s.push(f(t,d())),s.push(f(t,e)),u.forEach(c=>{s.push(f(t,c))})),s),[])),r}export function getNodeModulesPaths(n=[]){return a(n.reduce((r,e)=>(v(e)==="node_modules"&&r.push(l(e)),E(i(e,"node_modules"))&&r.push(l(i(e,"node_modules"))),r),[]))}export function getResolutionCombinations(n,r={}){let e=getResolutionPaths(r.paths);p(n)?e=getNodeModulesPaths(e):e.push(...getNodeModulesPaths(e));const s=r.extensions??DEFAULT_EXTENSIONS;let t=e.map(o=>i(o,n));return x(n,{withExtension:!1})!=="index"&&(t=t.reduce((o,u)=>(o.push(u),o.push(i(u,"index")),o),[])),h(n)||(t=t.reduce((o,u)=>(o.push(u),s.forEach(c=>{o.push(g(u,c))}),o),[])),a(t.filter(Boolean)).map(o=>l(o))}export async function resolve(n,r={}){let e=getResolutionPaths(r.paths);p(n)?e=getNodeModulesPaths(e):e.push(...getNodeModulesPaths(e));let s,t;try{s=await j(n,{url:e,extensions:r.extensions??DEFAULT_EXTENSIONS,conditions:r.conditions})}catch(o){t=o}if(!s)throw new Error(`Unable to resolve module "${n}". The following import paths were tried:
|
|
2
2
|
${e.join(`
|
|
3
3
|
`)}`,{cause:t});return l(s)}export function resolveSync(n,r={}){let e=getResolutionPaths(r.paths);p(n)?e=getNodeModulesPaths(e):e.push(...getNodeModulesPaths(e));let s,t;try{s=y(n,{url:e,extensions:r.extensions??DEFAULT_EXTENSIONS,conditions:r.conditions})}catch(o){t=o}if(!s)throw new Error(`Unable to resolve module "${n}". The following import paths were tried:
|
|
4
4
|
${e.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.4",
|
|
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": {
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"@antfu/install-pkg": "^1.1.0",
|
|
16
16
|
"@ltd/j-toml": "^1.38.0",
|
|
17
17
|
"@storm-software/config-tools": "^1.188.48",
|
|
18
|
-
"@stryke/convert": "^0.6.
|
|
19
|
-
"@stryke/helpers": "^0.9.
|
|
20
|
-
"@stryke/path": "^0.21.
|
|
21
|
-
"@stryke/string-format": "^0.12.
|
|
18
|
+
"@stryke/convert": "^0.6.8",
|
|
19
|
+
"@stryke/helpers": "^0.9.10",
|
|
20
|
+
"@stryke/path": "^0.21.2",
|
|
21
|
+
"@stryke/string-format": "^0.12.8",
|
|
22
22
|
"chalk": "^5.6.2",
|
|
23
23
|
"defu": "^6.1.4",
|
|
24
24
|
"glob": "^11.1.0",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"nanotar": "^0.2.0",
|
|
27
27
|
"semver": "7.7.1",
|
|
28
28
|
"yaml": "^2.8.1",
|
|
29
|
-
"@stryke/json": "^0.9.
|
|
30
|
-
"@stryke/type-checks": "^0.3.
|
|
31
|
-
"@stryke/types": "^0.10.
|
|
29
|
+
"@stryke/json": "^0.9.11",
|
|
30
|
+
"@stryke/type-checks": "^0.3.18",
|
|
31
|
+
"@stryke/types": "^0.10.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^24.10.1",
|
|
@@ -410,5 +410,5 @@
|
|
|
410
410
|
"main": "./dist/index.cjs",
|
|
411
411
|
"module": "./dist/index.mjs",
|
|
412
412
|
"types": "./dist/index.d.ts",
|
|
413
|
-
"gitHead": "
|
|
413
|
+
"gitHead": "0bf29ab54e34a0247f121fa489941a93625748d9"
|
|
414
414
|
}
|