export { LintFile, LintIssue, LintWidgetInput, LintWidgetResult, TemplateEngine, TemplateOptions, coerceNumber, isValidColor, isValidNumber, isValidString, isValidTrustedURL, isValidURL, lintWidget, sanitizeString } from './index.js'; import { W as WidgetManifest, M as ManifestField } from '../manifest-Dj_fC51m.js'; export { b as MANIFEST_FIELD_SCOPES, a as MANIFEST_FIELD_TYPES, e as ManifestFieldOption, d as ManifestFieldScope, c as ManifestFieldType, V as ValidateManifestResult, f as WidgetCanvas, v as validateManifest } from '../manifest-Dj_fC51m.js'; import '../types-CJtAzafC.js'; import '../lifecycle-DRSAPNpC.js'; /** * @eeko/sdk - Template Loader (Node.js only) * * File loading utilities for a widget project's canonical files * (`widget.json`, `index.html`, `styles.css`, `script.js`). Uses Node.js APIs * and should only be imported in Node.js environments. * * SECURITY: Includes path traversal protection to prevent directory escape attacks. */ /** * Load and validate `widget.json` from a widget project directory. * * @param templateDir - Absolute path to the widget directory * @returns The validated {@link WidgetManifest} * @throws Error if the file is missing, invalid JSON, fails validation, or path traversal is detected * * @example * ```typescript * const manifest = await loadManifest('/path/to/widget') * console.log(manifest.globalConfig) // { goalTitle: 'My Goal', ... } * ``` */ declare function loadManifest(templateDir: string): Promise; /** * Build a configuration object from manifest fields using their default values, * keyed by each field's `key`. * * `both`-scoped fields participate in both the `global` and `variant` scopes. * * @param fields - Array of manifest field definitions * @param scope - Optional scope filter ('global' or 'variant') * @returns Configuration object keyed by field `key` with default values * * @example * ```typescript * const fields = [ * { key: 'goalTitle', type: 'text', scope: 'global', label: 'Title', defaultValue: 'My Goal' }, * { key: 'progress', type: 'number', scope: 'variant', label: 'Progress', defaultValue: 0 } * ] * * buildConfigFromFields(fields) // { goalTitle: 'My Goal', progress: 0 } * buildConfigFromFields(fields, 'global') // { goalTitle: 'My Goal' } * ``` */ declare function buildConfigFromFields(fields: ManifestField[], scope?: 'global' | 'variant'): Record; /** * Merge multiple configuration objects with later objects taking precedence * * @param configs - Configuration objects to merge (in order of precedence) * @returns Merged configuration object */ declare function mergeConfigs(...configs: Record[]): Record; /** * Load the canonical template files (`index.html`, `styles.css`, `script.js`) * from a widget project directory. * * @param templateDir - Absolute path to the widget directory * @returns Object containing file contents (html required; css/js optional) * * @example * ```typescript * const files = await loadTemplateFiles('/path/to/widget') * console.log(files.html) // Contents of index.html * console.log(files.css) // Contents of styles.css (or undefined if not found) * ``` */ declare function loadTemplateFiles(templateDir: string): Promise<{ html: string; css?: string; js?: string; }>; /** * Get the parent directory of a file path * Useful for getting the widget directory from a file path * * @param filePath - Path to a file * @returns Parent directory path */ declare function getTemplateDir(filePath: string): string; export { ManifestField, WidgetManifest, buildConfigFromFields, getTemplateDir, loadManifest, loadTemplateFiles, mergeConfigs };