Class VirtualPackageFS

Virtual package file system.

Serves packages registered with addPackage method.

Package URIs has to have package: scheme.

Can be used e.g. for testing.

Hierarchy

Constructors

Accessors

Methods

  • Searches for package directory containing the given file or URI.

    Parameters

    • uri: string

      URI of the target file or directory.

    Returns Promise<undefined | PackageDir>

    Promise resolved to either enclosing package directory, or undefined if not found.

  • Tries to load package info from the given directory.

    By default, detects package info by the loaded package.json contents.

    Parameters

    • uri: string

      Source directory.

    Returns Promise<undefined | PackageInfo>

    Promise resolved to either loaded package info contents, or undefined if directory does not contain valid package.json file.

  • Finds parent directory.

    Parameters

    • uri: string

      File or directory URI.

    Returns undefined | string

    Either URI of the parent directory, or undefined if there is no one.

  • Extracts package URI from compatible URI import specifier.

    Parameters

    • importSpec: URI

      Absolute URI import specifier.

    Returns undefined | string

    Either package URI, or undefined if the URI can not be used to access packages.

  • Resolves a package by name against another one.

    Note that returned URI is not necessary the one of package directory. Call findPackageDir in order to find one.

    Parameters

    • relativeTo: PackageResolution

      Package to resolve another one against.

    • name: string

      Package name to resolve.

    Returns Promise<undefined | string>

    Promise resolved to either module URI, or undefined if the name can not be resolved.

  • Resolves path relatively to package.

    By default, uses URI resolution.

    Parameters

    • relativeTo: PackageResolution

      The base to resolve the path against.

    • path: string

      Path or URI to resolve.

    Returns string

    URI of the resolved path.

Generated using TypeDoc