Class ProjectConfig

Project configuration.

Implements

Constructors

Accessors

  • get supportsVmModules(): boolean
  • Detects whether this project supports ESM.

    true when --experimental-vm-modules command-line option passed to Node.js process.

    Returns boolean

Methods

  • Gains value of the given kind or creates one if not yet exists.

    Caches the value once constructed.

    Type Parameters

    • T

    Parameters

    • kind: ((this: void, project: ProjectConfig) => T)

      Kind of values to gain. This function is used as a cache key. It is called to create

    Returns T

    Gained value.

  • Loads arbitrary configuration represented as ESM module.

    The module has to export configuration as default export.

    Type Parameters

    • TConfig

    Parameters

    • url: string

      Configuration module specifier relative to project root.

    • OptionaldefaultConfig: TConfig

      Default configuration used when module not found.

    Returns Promise<TConfig>

    Promise resolved to loaded configuration, or to undefined if no configuration file found.

    When module not found and no default configuration provided.

  • Loads project configuration from specified module.

    The default export of target ESM module treated as project specifier, i.e. either as project configuration instance, or its initialization options.

    If no configuration module found, then new project configuration created.

    Parameters

    • url: string = './project.config.js'

      Configuration module specifier relative to current working dir. ./project.config.js by default.

    Returns Promise<ProjectConfig>

    Promise resolved to project configuration.

  • Gains specified project configuration.

    Project configuration can be specified by one of:

    • Project configuration instance, which is returned as is.
    • Project initialization options. New project configuration created in this case.
    • Nothing to create default configuration.

    Parameters

    • Optionalspec: ProjectSpec

      Project configuration specifier.

    Returns ProjectConfig

    Project configuration instance.