-
Notifications
You must be signed in to change notification settings - Fork 0
API Host CompositeScriptSourceResolver
Ordered resolver composition. Earlier resolvers have higher priority.
Namespace: AuroraScript.Source. Kind: class.
Back to .NET Host API Reference
CompositeScriptSourceResolver chains several IScriptSourceResolver instances into one. Order is the priority rule: a memory overlay placed before a file-system resolver can shadow disk files whose resolved target falls under the memory root. Create one with ScriptSources.Composite(...) or by calling Add repeatedly.
Note
-
ResolveAsynctries resolvers in order with the original importer and requested path. The first non-null reference wins. -
GetSourceAsyncroutes by exact normalizedScriptSourceReference.BaseDirectory, not by scanning target paths. -
GetAllSourcesAsyncde-duplicates by normalizedScriptSource.FullPathso earlier sources hide later sources with the same identity. - No
ProviderIdis required; resolver order andBaseDirectoryidentify the selected provider.
A minimal use of CompositeScriptSourceResolver.
var resolver = ScriptSources.Composite(
ScriptSources.Memory("mem://app/")
.Add("main.as", "@module(MAIN); export func run() { return 42; }"),
ScriptSources.FileSystem("./scripts"));string RootNormalized root reported by the composition.
Parameters
None.
Returns
Returns string.
Console.WriteLine(resolver.Root);CompositeScriptSourceResolver Add(IScriptSourceResolver resolver)Adds a resolver and caches its normalized root for later routing.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resolver |
IScriptSourceResolver |
Yes | Resolver to append. Later entries have lower priority. |
Returns
Returns the same CompositeScriptSourceResolver, so calls can be chained.
Behavior
Roots are normalized when the resolver is added, not on every comparison, so add resolvers during host setup rather than during compilation.
var resolver = new CompositeScriptSourceResolver()
.Add(ScriptSources.Memory("mem://app/"))
.Add(ScriptSources.FileSystem("./scripts"));AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License