FileLoader
Defined in: resolver/src/loader.ts:78
File loader for loading and resolving PromptScript files.
Constructors
Constructor
new FileLoader(
options):FileLoader
Defined in: resolver/src/loader.ts:84
Parameters
options
Returns
FileLoader
Methods
getLocalPath()
getLocalPath():
string
Defined in: resolver/src/loader.ts:223
Get the local path.
Returns
string
getProjectRoot()
getProjectRoot():
string
Defined in: resolver/src/loader.ts:230
Get the project root used as the traversal safety boundary.
Returns
string
getRegistryPath()
getRegistryPath():
string
Defined in: resolver/src/loader.ts:216
Get the registry path.
Returns
string
load()
load(
path):Promise<string>
Defined in: resolver/src/loader.ts:103
Load file content from disk.
Parameters
path
string
Absolute path to the file
Returns
Promise<string>
File content as string
Throws
FileNotFoundError if file doesn’t exist
resolveRef()
resolveRef(
ref,fromFile):string
Defined in: resolver/src/loader.ts:155
Resolve a PathReference to an absolute path.
Parameters
ref
PathReference from AST
fromFile
string
File containing the reference (for relative resolution)
Returns
string
Absolute filesystem path
toAbsolutePath()
toAbsolutePath(
path):string
Defined in: resolver/src/loader.ts:125
Convert a path string to an absolute path.
Handles:
- Already absolute paths (start with /)
- Registry paths (@namespace/path)
- Relative paths (./path, ../path, or bare path)
Parameters
path
string
Path to convert
Returns
string
Absolute filesystem path