@oazmi/esbuild-plugin-deno - v0.4.0
    Preparing search index...

    Interface RelativePathResolverConfig

    configuration for the relative-path resolver in resolverPluginSetup.

    interface RelativePathResolverConfig {
        enabled: boolean;
        resolvePath: (path?: string, importer?: string) => string;
        isAbsolutePath: (segment: string) => boolean;
    }
    Index

    Properties

    enabled: boolean

    enable or disable relative path resolution.

    true (enabled)

    resolvePath: (path?: string, importer?: string) => string

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

    this function is utilized by the relativePathResolver function inside the plugin's body, and it will operate independent of what your isAbsolutePath function is. this means that you will have to check for absolute paths yourself, because every resource that will make its way to the relativePathResolver will be processed by this resolvePath function.

    in general, there are four checks that your path resolver function should perform in the provided order:

    1. if path is undefined or an empty string, then the current working directory should be returned.
    2. if the path begins with a leading slash ("/"), you should treat it as a root-path and join it with the importer's domain (for instance, the domain of https://esm.sh/hello/world would be https://esm.sh/). but if no importer argument is present, then go to the next case (where you'll effectively resolve it as an absolute local unix file path).
    3. if the path is an absolute path of some kind, you should simply return it as is, after ensuring posix separators ("/") are being used.
    4. finally, for all remaining cases (i.e. relative paths, which begin with either "./", "../", or a bare file subpath), you should join them with their importer if it is present, otherwise join them with your current working directory (or absWorkingDir).

    Type declaration

      • (path?: string, importer?: string): string
      • Parameters

        • Optionalpath: string

          the path of the resource that is being resolved. it could be a relative path (i.e. starts with "./" or "../"), or a root-path (i.e. starts with "/"), or a pre-existing absolute path (such as jsr:@std/jsonc/parses). and it may use windows backslashes instead of posix forward slashes, so make sure to handle all of these cases.

        • Optionalimporter: string

          when an importer file is present, this parameter will be provided, and you will be expected to join the importer with the path if the path is either relative or a root-path. do note that the importer is never an empty string.

        Returns string

        the absolute path to the provided resource.

    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).