compile()
compile(
entryPath,options?):Promise<CompileResult>
Defined in: compiler/src/compiler.ts:1543
Compile a PromptScript file using default or specified options.
This is a convenience function that creates a Compiler instance and runs the compilation pipeline. For repeated compilations, consider creating a Compiler instance directly for better performance.
Parameters
entryPath
string
Path to the entry PromptScript file
options?
CompileOptions = {}
Optional compilation options
Returns
Promise<CompileResult>
Compilation result with outputs, errors, and stats
Example
import { compile } from '@promptscript/compiler';
// Simple usage with defaultsconst result = await compile('./project.prs');
// With custom optionsconst result = await compile('./project.prs', { formatters: ['github', 'claude'], resolver: { registryPath: './registry' },});
if (result.success) { for (const [path, output] of result.outputs) { console.log(`Generated: ${path}`); }}