Skip to main content

XpmActions class

A collection of xpm actions for a build configuration or the entire package.

Signature

export declare class XpmActions

Remarks

This class manages a collection of named actions, each containing one or more commands to be executed. Actions can belong to a package or a build configuration and support template-based definitions with matrix expansion to generate multiple actions from a single template.

The collection always exists, even as empty if no actions are defined.

Action lifecycle phases:

  1. Construction: Basic setup with optional inheritance from parent package.
  2. Initialisation: Template name expansion without content evaluation.
  3. Retrieval: On-demand instantiation when accessed via get().
  4. Action Initialisation: Liquid template evaluation and substitution.

This multi-phase approach ensures efficient resource usage by deferring expensive operations until actions are actually needed.

Constructors

Constructor

Modifiers

Description

(constructor)({ log, engine, substitutionsVariables, jsonActions, inheritedActionsMap, buildConfiguration, })

Constructs an actions collection instance.

Properties

Property

Modifiers

Type

Description

_actionsMap

protected

readonly

Map<string, XpmAction | undefined>

Map of action names to their corresponding action instances.

_actionsNames

protected

string[]

Cached array of all action names in the collection.

_actionsNamesSet

protected

readonly

Set<string>

Set of all action names for quick lookup.

_isInitialised

protected

boolean

Flag indicating whether the actions collection has been initialised.

_jsonActionsNamesMap

protected

readonly

Map<string, string>

Map of expanded action names to their original JSON action names.

buildConfiguration

readonly

XpmBuildConfiguration | undefined

The build configuration this actions collection belongs to, if any.

engine

readonly

XpmLiquidEngine

The Liquid templating engine for variable substitution.

isEmpty

readonly

boolean

Indicates whether the actions collection is empty.

jsonActions

readonly

JsonActions

The JSON object containing action definitions from the package manifest.

log

readonly

Logger

The logger instance for output and diagnostics.

names

readonly

string[]

The names of all actions in the collection.

size

readonly

number

The number of actions in the collection.

substitutionsVariables

readonly

XpmLiquidSubstitutionsVariables

The variables available for substitution in action definitions.

Methods

Method

Modifiers

Description

_createSubstitutedAction({ actionName, jsonAction, combination, newActionsMap, })

protected

Creates a substituted action from a template and matrix combination.

_expandTemplateActions({ actionName, jsonActionTemplate, })

protected

Expands a template action into multiple concrete actions.

_processTemplate({ actionName, jsonActionTemplate, })

protected

Processes a template action by expanding it and registering the generated actions.

get(actionName)

Retrieves an action by name, creating it if not yet instantiated.

has(actionName)

Checks whether an action with the specified name exists.

initialise()

Completes the async initialisation of the actions collection.


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.