Skip to content

pantoken / packages/utils/src / unknownReferences

Function: unknownReferences()

unknownReferences(text, ir): string[]

Beta

Drift check: --instui-* names in text that the IR doesn't define (sorted; empty means no drift). Use for outputs that reference tokens defined elsewhere — e.g. the docusaurus/vitepress bridges, whose var(--instui-*) targets must all be real tokens.

Parameters

text

string

The generated output.

ir

readonly Token[]

The source token IR.

Returns

string[]

The unknown token names.

Example

ts
import { unknownReferences } from "@pantoken/utils";
import type { Token } from "@pantoken/model";

const ir: Token[] = [
  { name: "--instui-leaf", syntax: "<color>", inherits: true, value: "#0374B5" },
];

unknownReferences("--x: var(--instui-leaf); --y: var(--instui-gone);", ir);
// → ["--instui-gone"]
unknownReferences("--x: var(--instui-leaf);", ir); // → []  (no drift)