/** * Node.js-specific loader for DomainLang models. * * **WARNING: This module is NOT browser-compatible.** * * For browser environments, use: * - `fromDocument()` with documents from the LSP * - `fromModel()` with pre-parsed models * - `loadModelFromText()` for in-memory parsing * * This loader creates **isolated Langium services** for standalone CLI usage. * It does NOT integrate with an existing LSP workspace. * * For full workspace management with cross-file imports: * - Use the WorkspaceManager service * - Or host the LSP server and use its services * * @module sdk/loader-node */ import type { LoadOptions, QueryContext } from './types.js'; /** * Loads a DomainLang model from a file on disk. * * **Node.js only** - uses file system APIs. * * Supports multi-file models with imports: all imported files are * automatically loaded and linked. Use `documents` in the result * to see all loaded files. * * @param entryFile - Path to the entry .dlang file * @param options - Optional load configuration * @returns QueryContext with model, documents, and query API * @throws Error if file cannot be loaded or parsing fails * * @example * ```typescript * import { loadModel } from '@domainlang/language/sdk/loader-node'; * * const { query, model, documents } = await loadModel('./domains.dlang', { * workspaceDir: process.cwd() * }); * * // Query spans all imported files * for (const bc of query.boundedContexts()) { * console.log(bc.name); * } * * console.log(`Loaded ${documents.length} files`); * ``` */ export declare function loadModel(entryFile: string, options?: LoadOptions): Promise; export { validateFile } from './validator.js'; export type { ValidationResult, ValidationDiagnostic, ValidationOptions } from './validator.js';