UNPKG

@terrazzo/parser

Version:

Parser/validator for the Design Tokens Community Group (DTCG) standard.

36 lines 1.32 kB
import { type TokenNormalized } from '@terrazzo/token-tools'; import type ytm from 'yaml-to-momoa'; import Logger from '../logger.js'; import type { ConfigInit, InputSource } from '../types.js'; import normalize from './normalize.js'; import validateTokenNode from './validate.js'; export * from './alias.js'; export * from './normalize.js'; export * from './json.js'; export * from './validate.js'; export { normalize, validateTokenNode }; export interface ParseOptions { logger?: Logger; config: ConfigInit; /** * Skip lint step * @default false */ skipLint?: boolean; /** * Continue on error? (Useful for `tz check`) * @default false */ continueOnError?: boolean; /** Provide yamlToMomoa module to parse YAML (by default, this isn’t shipped to cut down on package weight) */ yamlToMomoa?: typeof ytm; /** (internal cache; do not use) */ _sources?: Record<string, InputSource>; } export interface ParseResult { tokens: Record<string, TokenNormalized>; sources: InputSource[]; } /** Parse */ export default function parse(_input: Omit<InputSource, 'document'> | Omit<InputSource, 'document'>[], { logger, skipLint, config, continueOnError, yamlToMomoa, _sources, }?: ParseOptions): Promise<ParseResult>; //# sourceMappingURL=index.d.ts.map