Expose native filesystem sources through public loading API

This commit is contained in:
2026-09-29 17:36:20 +00:00
parent 6111cb23a1
commit 1ff3c812a7
18 changed files with 430 additions and 36 deletions

View File

@@ -28,10 +28,14 @@ type Options[T any] struct {
Overrides []Override
}
// FilesystemContext supplies filesystem roots for imports and overlays.
// FilesystemContext supplies roots for imports and overlays. With FS nil,
// BaseDir and Root use absolute host paths. With FS set, they use slash-relative
// paths in that namespace ("." denotes its root). File sources derive BaseDir
// from the selected file; a native file's explicit Root limits its scope.
type FilesystemContext struct {
BaseDir string
Root string
FS *Filesystem
}
// Override describes one explicitly supplied application override. Value uses
@@ -223,6 +227,10 @@ func toEngineOptions[T any](options Options[T]) engine.Options[T] {
}
if options.Filesystem != nil {
result.Filesystem = &engine.FilesystemContext{BaseDir: options.Filesystem.BaseDir, Root: options.Filesystem.Root}
if options.Filesystem.FS != nil {
filesystem := options.Filesystem.FS.value
result.Filesystem.FS = &filesystem
}
}
if options.Overrides != nil {
result.Overrides = make([]engine.Override, len(options.Overrides))