pub struct MultiSourceOptions {
pub resolver: SharedResolver,
pub path: String,
pub markchar: String,
pub processor: IndexMap<String, ProcessorEntry>,
pub implicit_ext: Vec<String>,
pub preload: Option<PreloadOptions>,
pub fs: Option<SharedFs>,
pub deps: Option<Arc<Mutex<DependencyMap>>>,
pub max_depth: usize,
}Expand description
Configuration for the plugin.
Fields§
§resolver: SharedResolverResolves a reference to a source.
path: StringThe base path references resolve against at the top level.
markchar: StringThe character that starts a reference.
processor: IndexMap<String, ProcessorEntry>Per-kind processors. The empty kind is the fallback.
implicit_ext: Vec<String>Extensions tried for a reference with none, in order.
preload: Option<PreloadOptions>A declarative record of a folder preload. As in TypeScript and
Go, the plugin does not consume it: call preload_files and
hand the result to FileResolver::with_preload.
fs: Option<SharedFs>The filesystem the file and pkg resolvers read, when they
carry none of their own. None is the real filesystem.
This is the Rust spelling of the TypeScript ctx.meta.fs
injection point and of Go’s MultiSourceOptions.FS.
deps: Option<Arc<Mutex<DependencyMap>>>Where to record the tar to src dependency tree, when the
caller wants one.
max_depth: usizeHow deep a chain of sources may nest. See DEFAULT_MAX_DEPTH.
Implementations§
Source§impl MultiSourceOptions
impl MultiSourceOptions
Sourcepub fn new(resolver: impl Resolver + 'static) -> Self
pub fn new(resolver: impl Resolver + 'static) -> Self
Options resolving through resolver, everything else default.
Sourcepub fn with_resolver(self, resolver: SharedResolver) -> Self
pub fn with_resolver(self, resolver: SharedResolver) -> Self
Options resolving through an already shared resolver.
Sourcepub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
Set the base path references resolve against.
Sourcepub fn with_markchar(self, markchar: impl Into<String>) -> Self
pub fn with_markchar(self, markchar: impl Into<String>) -> Self
Set the directive character.
Sourcepub fn with_processor(
self,
kind: impl Into<String>,
processor: impl Processor + 'static,
) -> Self
pub fn with_processor( self, kind: impl Into<String>, processor: impl Processor + 'static, ) -> Self
Register a processor for one kind, replacing any entry for it.
Sourcepub fn with_processor_alias(
self,
kind: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn with_processor_alias( self, kind: impl Into<String>, target: impl Into<String>, ) -> Self
Point one kind at another kind’s processor.
Sourcepub fn with_processors(
self,
processors: IndexMap<String, ProcessorEntry>,
) -> Self
pub fn with_processors( self, processors: IndexMap<String, ProcessorEntry>, ) -> Self
Replace the whole processor table.
Sourcepub fn with_implicit_ext<I, S>(self, extensions: I) -> Self
pub fn with_implicit_ext<I, S>(self, extensions: I) -> Self
Replace the implicit extension list. A missing leading dot is added, as the TypeScript plugin does when it installs.
Sourcepub fn with_preload(self, preload: PreloadOptions) -> Self
pub fn with_preload(self, preload: PreloadOptions) -> Self
Record a preload configuration. The plugin does not act on it.
Sourcepub fn with_fs(self, filesystem: impl SourceFs + 'static) -> Self
pub fn with_fs(self, filesystem: impl SourceFs + 'static) -> Self
Set the filesystem the file and pkg resolvers read.
Set the filesystem from an already shared handle.
Sourcepub fn with_deps(self, deps: Arc<Mutex<DependencyMap>>) -> Self
pub fn with_deps(self, deps: Arc<Mutex<DependencyMap>>) -> Self
Collect the dependency tree into deps as the parse runs.
Sourcepub fn with_max_depth(self, max_depth: usize) -> Self
pub fn with_max_depth(self, max_depth: usize) -> Self
Set how deep a chain of sources may nest.