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

    Interface HttpPluginSetupConfig

    configuration options for the httpPluginSetup and httpPlugin functions.

    interface HttpPluginSetupConfig {
        filters: RegExp[];
        namespace: string;
        defaultLoader: Loader;
        acceptLoaders?: Loader[];
        acceptNamespaces: (undefined | string)[];
        convertFileUriToLocalPath: { enabled: boolean; resolveAgain: boolean };
        log: undefined | boolean | LoggerFunction;
    }
    Index

    Properties

    filters: RegExp[]

    the regex filters which the plugin's resolvers should use for the interception of resource-paths.

    [/^https?\:///, /^file\:///] (captures "http://", "https://", and "file://" uris)

    namespace: string

    specify the namespace that the http plugin's loader should use for fetchable resources.

    if the convertFileUriToLocalPath option is enabled (default), then file-uris will not use this namespace, and instead adopt the regular "" namespace.

    Caution

    it is best if you don't modify it to something besides the default value PLUGIN_NAMESPACE.LOADER_HTTP, as this plugin relies on the entry-plugin's prior intervention to have relative-paths and import-map paths resolved to a full http path.

    defaultLoader: Loader

    the default loader that the plugin's loader should use for unidentified content types.

    if you would like to use esbuild's own default loader, set the value to "default".

    acceptLoaders?: Loader[]

    only accept the following subset of loaders when auto content-detection is used for guessing the loader type.

    Note

    if there is no intersection between the set of guessed loaders, and this set of acceptLoaders, then the default loader (defaultLoader) will be used as a fallback.

    acceptNamespaces: (undefined | string)[]

    specify which namespaces should be intercepted by the http-plugin. all other namespaces will not be processed by this plugin.

    if you have a plugin with a custom loader that works under some "custom-namespace", you can include your "custom-namespace" here, so that if it performs an http-import, that import path will be captured by this plugin, and then consequently fetched by this plugin's http-loader. but do note that the namespace of the loaded resource will switch to this plugin's loader namespace (which defaults to PLUGIN_NAMESPACE.LOADER_HTTP), instead of your "custom-namespace".

    [undefined, "", "file"] (also this plugin's namespace gets added later on)

    convertFileUriToLocalPath: { enabled: boolean; resolveAgain: boolean }

    specify if "file://" uris should be converted to local paths, so that esbuild natively loads them, instead of us fetching the resource ourselves.

    when this option is enabled, the resulting resolved local-path of a file uris will not use the namespace config option, and instead adopt the the default namespace "", so that esbuild (or some other plugin) would be capable of loading it.

    Warning

    for best compatibility with ./node_modules/ resolution and other plugins, it is best to have this option enabled always. that's because if a file uri ends up becoming the resolveDir of an npm-package resource, then esbuild will halt and complain that it does not understand the "non-absolute" local path specified, because it is incapable of interpreting file uris, and will refuse to scan directories based on it.

    • if esbuild's native resolver/loader intercepts the resolved path, then it will strip away the pluginData. on the otherhand, our url-loader will not do such a thing

    Type declaration

    • enabled: boolean

      enable or disable file-uri to local path conversion.

      true

    • resolveAgain: boolean

      enable or disable re-resolution of the local path, to allow other plugins to intercept.

      true

    { enabled: true, resolveAgain: true } (file uris are converted to local paths, and re-resolved to give other plugins the chance to initercept it)

    log: undefined | boolean | LoggerFunction