Skip to main content

XpmPolicies.(constructor)

Constructs policy flags based on a minimum xpm version.

Signature

constructor({ log, minVersion }: {
log: Logger;
minVersion: string;
});

Parameters

Parameter

Type

Description

{ log, minVersion }

{ log: Logger; minVersion: string; }

Remarks

The constructor evaluates each policy flag by comparing the provided minimum version against threshold versions where behavior changed.

Evaluation process:

  1. Validate that minVersion is a valid semver string.
  2. If invalid, retain default values (all flags false = modern behavior).
  3. For each policy, use semver.lt() to check if minVersion is less than the threshold version.
  4. If minVersion < threshold, enable legacy behavior (flag = true).
  5. If minVersion >= threshold, use modern behavior (flag = false).

This ensures that packages explicitly declaring their minimum version get the behavior that was current at that version, while packages without a valid minimum version default to the most modern behavior.


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