@jspm/import-map
    Preparing search index...

    Class ImportMap

    Implements

    Index

    Constructors

    • Create a new import map instance

      Parameters

      • opts:
            | string
            | URL
            | { map?: IImportMap; mapUrl?: string
            | URL; rootUrl?: string | URL }

        import map options, can be an optional bag of { map?, mapUrl?, rootUrl? } or just a direct mapUrl

      Returns ImportMap

    Methods

    • Extends the import map mappings

      Parameters

      • map: IImportMap

        Import map to extend with

      • overrideScopes: boolean = false

        Set to true to have scopes be replacing instead of extending

      Returns ImportMap

      ImportMap for chaining

    • Performs an alphanumerical sort on the import map imports and scopes

      Returns ImportMap

      ImportMap for chaining

    • Set a specific entry in the import map

      Parameters

      • name: string

        Specifier to set

      • target: string

        Target of the map

      • Optionalparent: string

        Optional parent scope

      Returns ImportMap

      ImportMap for chaining

    • Parameters

      • target: string

        URL target

      • integrity: string

        Integrity

      Returns void

    • Parameters

      • target: string

        URL target

      • integrity: string

        Integrity

      Returns string

    • Bulk replace URLs in the import map Provide a URL ending in "/" to perform path replacements

      Parameters

      • url: string

        {String} The URL to replace

      • newUrl: string

        {String} The URL to replace it with

      Returns ImportMap

      ImportMap for chaining

    • Groups subpath mappings into path mappings when multiple exact subpaths exist under the same path.

      For two mappings like { "base/a.js": "/a.js", "base/b.js": "/b.js" }, these will be replaced with a single path mapping { "base/": "/" }. Groupings are done throughout all import scopes individually.

      Returns ImportMap

      ImportMap for chaining

    • Groups the import map scopes to shared URLs to reduce duplicate mappings.

      For two given scopes, "https://site.com/x/" and "https://site.com/y/", a single scope will be constructed for "https://site.com/" including their shared mappings, only retaining the scopes if they have differences.

      In the case where the scope is on the same origin as the mapUrl, the grouped scope is determined based on determining the common baseline over all local scopes

      Returns ImportMap

      ImportMap for chaining

    • Rebase the entire import map to a new mapUrl and rootUrl

      If the rootUrl is not provided, it will remain null if it was already set to null.

      Otherwise, just like the constructor options, the rootUrl will default to the mapUrl base if it is an http: or https: scheme URL, and null otherwise keeping absolute URLs entirely in-tact.

      Parameters

      • mapUrl: string | URL = ...

        The new map URL to use

      • OptionalrootUrl: string | URL

        The new root URL to use

      Returns ImportMap

      ImportMap for chaining

    • Perform a module resolution against the import map

      Parameters

      • specifier: string

        Specifier to resolve

      • parentUrl: string | URL = ...

        Parent URL to resolve against

      Returns string

      Resolved URL string

    Properties

    imports: Record<string, string> = ...
    scopes: Record<string, Record<string, string>> = ...
    integrity: Record<string, string> = ...
    mapUrl: URL

    The absolute URL of the import map, for determining relative resolutions When using file:/// URLs this allows relative modules to be co-located

    rootUrl: URL

    The URL to use for root-level resolutions in the import map If null, root resolutions are not resolved and instead left as-is

    By default, rootUrl is null unless the mapUrl is an http or https URL, in which case it is taken to be the root of the mapUrl.