Skip to main content

xpm-lib package

A Node.js TypeScript module with the core code for xpm and xpm enabled projects.

Remarks

This library groups together various classes and functions used in common by xpm and the Visual Studio Code extension.

The main functionality is to manage actions and build configurations, especially those defined using Liquid templates.

The Lazy Evaluation Mechanism

Actions (XpmActions) and build configurations (XpmBuildConfigurations) implement a two-step lazy evaluation process to avoid unnecessary operations:

  1. Name Expansion: During collection initialisation, only the matrix of options is evaluated for each template, expanding template names into concrete action or configuration names without processing their content.
  2. Content Evaluation: Later, when an action or build configuration is actually accessed and initialised (via XpmAction.initialise() or XpmBuildConfiguration.initialise()), the template is fully evaluated and Liquid substitutions are performed.

This approach ensures that only items that are actually used incur the cost of template evaluation and variable substitution, significantly improving performance for projects with many actions or configurations.

Classes

Class

Description

XpmAction

An individual xpm action containing commands to be executed.

XpmActions

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

XpmBuildConfiguration

An individual xpm build configuration.

XpmBuildConfigurations

A collection of xpm build configurations.

XpmDataModel

Represents a lazy-loading data model for an xpm package.

XpmError

Base class for xpm-related errors.

XpmInputError

Error indicating that user input is invalid.

XpmLiquidEngine

Liquid engine configured for xpm templates.

XpmLiquidMatrixDrop

Liquid drop that resolves matrix parameter values for templates.

XpmLiquidPropertiesDrop

Liquid drop that resolves property values for template substitutions.

XpmOutputError

Error indicating a failure during output generation.

XpmPackage

Provides access to package metadata and xpm-specific validation.

XpmPolicies

Computes feature policy flags based on a minimum xpm version.

XpmPrerequisitesError

Error indicating that required prerequisites are not met.

XpmSyntaxError

Error indicating a syntax error in configuration or template files.

Abstract Classes

Abstract Class

Description

XpmInitTemplateBase

Base class for xpm initialisation templates.

Functions

Function

Description

chmodRecursively({ inputPath, readOnly, log, })

Recursively changes file permissions within a folder tree.

filterPath(input)

Replaces non-alphanumeric characters with dashes to make paths comply with file system names.

filterPosixPath(input)

Replaces non-alphanumeric characters with dashes to make paths comply with POSIX file system names.

filterWin32Path(input)

Replaces non-alphanumeric characters with dashes to make paths comply with Windows file system names.

getErrorMessage(error)

Extracts an error message string from an unknown error value.

getPlatformKey({ doForce32bit, })

Builds a unique key using the current platform and architecture.

isBoolean(value)

Determines whether a value is a boolean.

isJsonArray(value)

Determines whether a value is a JSON array.

isJsonObject(value)

Determines whether a value is a JSON object.

isNonEmptyJsonObject(value)

Determines whether a value is a non-empty JSON object.

isNumber(value)

Determines whether a value is a finite number.

isObject(value)

Determines whether a value is a non-array object.

isPrimitive(value)

Determines whether a value is a JavaScript primitive.

isString(value)

Determines whether a value is a string.

performSubstitutions({ log, engine, input, substitutionsVariables, })

Performs substitutions on an input string using Liquid.

Interfaces

Interface

Description

JsonActionTemplate

Represents a JSON template action with a matrix for expansion.

JsonBuildConfigurationContent

Represents a JSON build configuration definition.

JsonBuildConfigurationTemplate

Represents a JSON template build configuration with matrix expansion.

JsonDependencyExtended

Represents a JSON extended dependency definition.

JsonNpmPackage

Represents a JSON npm package.json structure.

JsonPackageSpecifier

Represents a JSON npm package specifier.

JsonXpack

Represents a JSON xpm-specific section in package.json.

JsonXpmBinaries

Represents a JSON binaries definition in package.json.

JsonXpmPackage

Represents a JSON xpm package.json structure.

JsonXpmPlatformFile

Represents a JSON platform-specific binary file definition.

XpmConfig

Defines the xpm configuration options.

XpmContext

Provides the execution context for xpm operations.

XpmInitTemplateConstructorParameters

XpmInitTemplateItemValue

Defines an xpm init template platform-specific item value.

XpmInitTemplatePropertiesDefinition

Defines an xpm init single template property.

XpmInitTemplateSubstitutionsVariables

Defines the substitution variables used by xpm init templates.

XpmLiquidSubstitutionsVariables

Defines the substitution variables available to Liquid templates.

Variables

Variable

Description

buildFolderRelativePathPropertyName

The property name used for the build folder relative path.

xpmLiquidSubstitutionsVariablesBase

The base substitution variables initialised from the current environment.

Type Aliases

Type Alias

Description

JsonAction

Represents a JSON action definition or a template of one.

JsonActionContent

Represents a JSON action content as a string or string array.

JsonActions

Represents a JSON map of action definitions.

JsonBuildConfiguration

Represents a JSON build configuration definition or a template of one.

JsonBuildConfigurationInherits

Represents a JSON array of build configuration names to inherit from.

JsonBuildConfigurations

Represents a JSON map of build configuration definitions.

JsonDependencies

Represents a JSON map of dependencies.

JsonDependenciesContent

Represents a JSON dependency content as a string or extended definition.

JsonProperties

Represents a JSON map of properties.

JsonPropertyValue

Represents a JSON property value.

JsonScripts

Represents a JSON map of npm scripts.

JsonXpmBinariesPlatforms

Represents a JSON map of binaries platforms.

XpmActionCommands

Represents a list of action command strings.

XpmInitTemplateItems

Represents the available items for a select type property in xpm init templates.

XpmInitTemplatePlatform

Represents the supported platform identifiers for xpm init template items.

XpmInitTemplatePropertiesDefinitions

Represents a map of xpm init template property definitions.

XpmInitTemplateType

Represents the supported property types for xpm init template properties.

XpmLiquidSubstitutionsStrings

Represents a map of substitution values used by Liquid templates.


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