import { CyclicReferenceError } from '../errors/CyclicReferenceError.js'; export class Context { constructor( public cwf: string, /** * Array of cwfs file paths processed so far */ public callStack: string[], public variables: Record, public processingOptions: { omitFrontmatter?: boolean } = {}, ) {} addCwfToCallstack(cwf: string) { this.callStack.push(cwf); } hasExceededMaxCallstackSize() { return this.callStack.length > CyclicReferenceError.MAX_RECURSIVE_DEPTH; } clone() { return new Context(this.cwf, this.callStack.map(cwf => cwf), this.variables, this.processingOptions); } }