this is the common configuration interface for resolver functions of most plugins of this library.

interface CommonPluginResolverConfig {
    namespace: string;
    log?: boolean;
    globalImportMap?: ImportMap;
    resolvePath: (...segments: string[]) => string;
    isAbsolutePath: (segment: string) => boolean;
}

Properties

namespace: string

the namespace that the plugin should use.

if the plugin requires multiple namespaces, it should append additional characters to this base namespace for consistency and collision resistance.

log?: boolean

enable logging of the input arguments and resolved paths, when DEBUG.LOG is ennabled.

false

globalImportMap?: ImportMap

specify a global import-map for aliases to resources.

the full import-map within the body of the resolver function should be a merger between this global import-map, and the import-map acquired from the plugin data (i.e. CommonPluginData.importMap). the plugin data's import-map will take a higher priority in case of conflicting key (i.e. same alias key but different absolute path values).

the resolve function will always look for a match for args.path inside of the import-map, before resolving it with respect to the current importer or resolve-directory (i.e. args.importer or args.resolveDir).

{} (empty object/dictionary)

resolvePath: (...segments: string[]) => string

a function that joins/resolves path segments to an absolute path (i.e. a path that the plugin itself can recognize as an absolute path).

typically, only two or one segments are provided at a time, but it's better if your function accepts variable number of segments.

isAbsolutePath: (segment: string) => boolean

a function that declares whether or not a given path segment is an absolute path (i.e. the plugin itself recognizes it as an absolute path).