Skip to main content

BuildConfiguration._processInherits() method

Processes inheritance for a build configuration.

Signature

protected _processInherits(localJsonBuildConfiguration: JsonBuildConfigurationContent): Promise<Map<string, Action>>;

Parameters

Parameter

Type

Description

localJsonBuildConfiguration

JsonBuildConfigurationContent

The JSON configuration content after template or inherits field substitution.

Returns

Promise<Map<string, Action>>

A promise that resolves to a map of inherited actions, where keys are action names and values are action instances from all inherited configurations.

Exceptions

InputError If an inherited configuration name does not exist in the parent collection.

InputError If a circular inheritance reference is detected.

Remarks

This method implements the inheritance resolution mechanism for build configurations, enabling configurations to share properties, dependencies, and actions by inheriting from one or more base configurations, recursively.

Processing workflow:

  1. Extract inheritance specification from the configuration:
    • Supports both the current inherits field and the deprecated inherit field for backwards compatibility.
    • Handles both string format (single parent) and array format (multiple parents).
    • Normalises line-separated names within array elements to support multi-line specifications.
  2. Process each inherited configuration sequentially:
    • Skip empty names from the inheritance list.
    • Validate that the inherited configuration exists in the parent collection.
    • Detect circular references by checking \_inheritedNamesSet.
    • Recursively initialise the inherited configuration (which may itself have inheritance).
  3. Merge inherited content into the current configuration:
    • Properties: Later inherited configurations override earlier ones, local properties override all inherited.
    • Dependencies and devDependencies: Same override behaviour as properties.
    • Actions: Collected into a map where later definitions override earlier ones with the same name.

The inheritance chain is processed depth-first, ensuring that transitive inheritance (A inherits B, B inherits C) is fully resolved before merging properties. Circular references are detected to prevent infinite recursion.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.