@gesslar/toolkit 3.22.0 → 3.22.1
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/package.json
CHANGED
|
@@ -613,7 +613,8 @@ export default class DirectoryObject extends FS {
|
|
|
613
613
|
if(this.isVirtual && dir.startsWith(this.sep)) {
|
|
614
614
|
const normalized = this.#resolveAndValidateFromCap(dir)
|
|
615
615
|
|
|
616
|
-
|
|
616
|
+
// Pass cap as parent so it resolves from cap root, not current directory
|
|
617
|
+
return new this.constructor(normalized, this.cap)
|
|
617
618
|
}
|
|
618
619
|
|
|
619
620
|
// Regular resolution
|
|
@@ -35,7 +35,7 @@ export default class VFileObject extends FileObject {
|
|
|
35
35
|
/**
|
|
36
36
|
* Constructs a VFileObject instance.
|
|
37
37
|
*
|
|
38
|
-
* @param {string} virtualPath - The virtual file path (
|
|
38
|
+
* @param {string} virtualPath - The virtual file path (can be absolute like "/path/to/file.ext" or relative like "file.txt")
|
|
39
39
|
* @param {VDirectoryObject} parent - The parent virtual directory (required, used for cap reference)
|
|
40
40
|
*/
|
|
41
41
|
constructor(virtualPath, parent) {
|
|
@@ -44,9 +44,23 @@ export default class VFileObject extends FileObject {
|
|
|
44
44
|
|
|
45
45
|
// Normalize the virtual path
|
|
46
46
|
const normalizedVirtual = FS.fixSlashes(virtualPath)
|
|
47
|
+
const isAbsolute = normalizedVirtual.startsWith("/")
|
|
47
48
|
|
|
48
|
-
//
|
|
49
|
-
|
|
49
|
+
// If absolute path, it's already resolved from cap root (from getFile())
|
|
50
|
+
// If relative path, resolve from parent directory (from hasFile(), read(), etc.)
|
|
51
|
+
let resolvedVirtualPath
|
|
52
|
+
if(isAbsolute) {
|
|
53
|
+
// Absolute path is already resolved - use as-is
|
|
54
|
+
resolvedVirtualPath = normalizedVirtual
|
|
55
|
+
} else {
|
|
56
|
+
// Relative path: resolve from parent directory (not cap root!)
|
|
57
|
+
resolvedVirtualPath = FS.resolvePath(parent.path, normalizedVirtual)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const normalized = FS.fixSlashes(resolvedVirtualPath)
|
|
61
|
+
|
|
62
|
+
// Extract the directory and filename from the resolved virtual path
|
|
63
|
+
const {dir: virtualDir, base} = FS.pathParts(normalized)
|
|
50
64
|
|
|
51
65
|
// Determine the virtual parent directory
|
|
52
66
|
// If virtualDir is "/" or empty or equals cap path, use the cap root
|
|
@@ -67,13 +81,13 @@ export default class VFileObject extends FileObject {
|
|
|
67
81
|
super(base, virtualParent)
|
|
68
82
|
|
|
69
83
|
// Convert virtual path to real path
|
|
70
|
-
// The virtual path is relative to the cap root, so we resolve it relative to cap's real path
|
|
84
|
+
// The resolved virtual path is relative to the cap root, so we resolve it relative to cap's real path
|
|
71
85
|
const capRealPath = parent.cap.real.path
|
|
72
86
|
|
|
73
|
-
// Strip leading "/" from virtual path if present to make it relative
|
|
74
|
-
const relativeFromCap =
|
|
75
|
-
?
|
|
76
|
-
:
|
|
87
|
+
// Strip leading "/" from resolved virtual path if present to make it relative
|
|
88
|
+
const relativeFromCap = normalized.startsWith("/")
|
|
89
|
+
? normalized.slice(1)
|
|
90
|
+
: normalized
|
|
77
91
|
|
|
78
92
|
// Resolve the real filesystem path
|
|
79
93
|
const realPath = FS.resolvePath(capRealPath, relativeFromCap)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/DirectoryObject.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH;IA2DE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA3CD;;;;OAIG;IACH,uBAFW,MAAM,OAAC,EA0BjB;IA2BD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;I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AeG;IACH,cAZa,eAAe,CAc3B;IAED;;;;;;;;;;;;;;OAcG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAQ5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAgED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBAdW,MAAM,GACJ,eAAe,CA6C3B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAfW,MAAM,GACJ,UAAU,GAAC,WAAW,CA6ClC;;CACF;eAnrBc,iBAAiB;uBADT,iBAAiB;wBAIhB,kBAAkB"}
|
|
@@ -21,7 +21,7 @@ export default class VFileObject extends FileObject {
|
|
|
21
21
|
/**
|
|
22
22
|
* Constructs a VFileObject instance.
|
|
23
23
|
*
|
|
24
|
-
* @param {string} virtualPath - The virtual file path (
|
|
24
|
+
* @param {string} virtualPath - The virtual file path (can be absolute like "/path/to/file.ext" or relative like "file.txt")
|
|
25
25
|
* @param {VDirectoryObject} parent - The parent virtual directory (required, used for cap reference)
|
|
26
26
|
*/
|
|
27
27
|
constructor(virtualPath: string, parent: VDirectoryObject);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VFileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/VFileObject.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;IAGE;;;;;OAKG;IACH,yBAHW,MAAM,UACN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"VFileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/VFileObject.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;IAGE;;;;;OAKG;IACH,yBAHW,MAAM,UACN,gBAAgB,EA8D1B;IAED,yBAEC;IAED,uBAEC;;CACF;uBAtGsB,iBAAiB"}
|