@jspm/generator
    Preparing search index...

    Function getPackageBase

    • Get the package base URL for the given module URL.

      Parameters

      • url: string | URL

        module URL

      • lookupOptions: LookupOptions = {}

        Optional provider and cache defaults for lookup

      Returns Promise<string>

      Base package URL

      Modules can be remote CDN URLs or local file:/// URLs.

      All modules in JSPM are resolved as within a package boundary, which is the parent path of the package containing a package.json file.

      For JSPM CDN this will always be the base of the package as defined by the JSPM CDN provider. For non-provider-defined origins it is always determined by trying to fetch the package.json in each parent path until the root is reached or one is found. On file:/// URLs this exactly matches the Node.js resolution algorithm boundary lookup.

      This package.json file controls the package name, imports resolution, dependency resolutions and other package information.

      getPackageBase will return the folder containing the package.json, with a trailing '/'.

      This URL will either be the root URL of the origin, or it will be a path "pkgBase" such that fetch(${pkgBase}package.json) is an existing package.json file.

        import { getPackageBase } from '@jspm/generator';
      const pkgUrl = await getPackageBase('https://ga.jspm.io/npm:lit-element@2.5.1/lit-element.js');
      // Returns: https://ga.jspm.io/npm:lit-element@2.5.1/