Skip to content

API reference / @jsprismarine/content / Tags

Class: Tags<T> ​

Defined in: packages/content/src/tags.ts:116

Tag storage for one registry: the tag files of a whole pack stack merged, resolved and indexed both ways.

Build the registry first, then the tags, because resolution reports a required member the registry does not have. Members stay holders, so a later registry rebuild is visible through the same sets.

Type Parameters ​

T ​

T

Constructors ​

Constructor ​

new Tags<T>(registry): Tags<T>

Defined in: packages/content/src/tags.ts:122

Parameters ​

registry ​

Registry<T>

The registry whose keys the tags name.

Returns ​

Tags<T>

Accessors ​

diagnostics ​

Get Signature ​

get diagnostics(): readonly Diagnostic[]

Defined in: packages/content/src/tags.ts:125

What the last Tags.rebuild reported, in report order.

Returns ​

readonly Diagnostic[]

Methods ​

get() ​

get(tag): HolderSet<T> | undefined

Defined in: packages/content/src/tags.ts:188

The resolved set for a tag, or undefined when no pack declares it.

Parameters ​

tag ​

string

Returns ​

HolderSet<T> | undefined


has() ​

has(tag): boolean

Defined in: packages/content/src/tags.ts:193

Whether any pack declares the tag.

Parameters ​

tag ​

string

Returns ​

boolean


names() ​

names(): readonly string[]

Defined in: packages/content/src/tags.ts:198

Every declared tag, in first-declaration order.

Returns ​

readonly string[]


rebuild() ​

rebuild(sources): void

Defined in: packages/content/src/tags.ts:138

Merges every tag file in stack order, then resolves tag references.

A later file appends to the tag unless it sets replace, which drops everything earlier packs contributed. A #namespace:tag member expands to that tag's own members, transitively. A reference that closes a cycle is dropped and reported as tag.cycle rather than thrown, so one bad pack cannot stop a load.

Parameters ​

sources ​

Iterable<TagSource>

Returns ​

void


tagsOf() ​

tagsOf(key): readonly string[]

Defined in: packages/content/src/tags.ts:203

The tags that contain a registry key, in first-declaration order.

Parameters ​

key ​

string

Returns ​

readonly string[]