Skip to content

Latest commit

 

History

History
123 lines (62 loc) · 2.3 KB

Class.BazelLikeSpec.md

File metadata and controls

123 lines (62 loc) · 2.3 KB

@109cafe/label / BazelLikeSpec

Class: abstract BazelLikeSpec<Target>

An abstract spec for Bazel-like build systems

Type Parameters

Target extends BazelTarget

Implements

Constructors

new BazelLikeSpec()

new BazelLikeSpec<Target>(): BazelLikeSpec<Target>

Returns

BazelLikeSpec<Target>

Methods

extract()

extract(targets, target): null | string | string[]

Extract targets from a package

Parameters

targets: Record<string, Target>

the map returned by load

target: string

the target name in a label

Returns

null | string | string[]

the matched target names or null if not found

Implementation of

Spec.extract


load()

abstract load(pkg): Promise<Record<string, Target>>

Load targets from a package

Parameters

pkg: ExactLabel

the label that is returned by lookup

Returns

Promise<Record<string, Target>>

a <TargetName, Target> map for the package

Implementation of

Spec.load


lookup()

abstract lookup(label): Promise<ExactLabel[]>

Lookup packages by label. Typically, it should return a list label for the BUILD files of these packages.

Parameters

label: Label

the label to lookup

Returns

Promise<ExactLabel[]>

a list of matched packages presented by ExactLabel

Implementation of

Spec.lookup


validate()

validate(label): undefined | "`...` can only be used with wildcard targets"

Validate a label

Parameters

label: Label

the label to validate

Returns

undefined | "`...` can only be used with wildcard targets"

a string or an Error for invalid label, and falsy values for valid label

Implementation of

Spec.validate