@terrazzo/parser
Version:
Parser/validator for the Design Tokens Community Group (DTCG) standard.
23 lines • 1.29 kB
TypeScript
import type * as momoa from '@humanwhocodes/momoa';
import type { default as Logger, LogEntry } from '../logger.js';
/**
* Determine whether this is likely a resolver
* We use terms the word “likely” because this occurs before validation. Since
* we may be dealing with a doc _intended_ to be a resolver, but may be lacking
* some critical information, how can we determine intent? There’s a bit of
* guesswork here, but we try and find a reasonable edge case where we sniff out
* invalid DTCG syntax that a resolver doc would have.
*/
export declare function isLikelyResolver(doc: momoa.DocumentNode): boolean;
export interface ValidateResolverOptions {
logger: Logger;
src: string;
}
/**
* Validate a resolver document.
* There’s a ton of boilerplate here, only to surface detailed code frames. Is there a better abstraction?
*/
export declare function validateResolver(node: momoa.DocumentNode, { logger, src }: ValidateResolverOptions): void;
export declare function validateSet(node: momoa.ObjectNode, isInline: boolean | undefined, { src }: ValidateResolverOptions): LogEntry[];
export declare function validateModifier(node: momoa.ObjectNode, isInline: boolean | undefined, { src }: ValidateResolverOptions): LogEntry[];
//# sourceMappingURL=validate.d.ts.map