compile()
compile(
files,entryPath,options?):Promise<CompileResult>
Defined in: browser-compiler/src/index.ts:155
Compile PromptScript files in the browser.
This is the main entry point for browser-based compilation. It creates a virtual file system from the provided files and runs the full compilation pipeline.
Parameters
files
Map<string, string> | Record<string, string>
Map of file paths to contents
entryPath
string
Path to the entry file (e.g., “project.prs”)
options?
CompileOptions = {}
Compilation options
Returns
Promise<CompileResult>
Compilation result with outputs for all formatters
Example
const files = new Map([ ['project.prs', '@meta { id: "demo" syntax: "1.0.0" }'],]);
const result = await compile(files, 'project.prs');
if (result.success) { // Get Claude output const claudeOutput = result.outputs.get('CLAUDE.md'); console.log(claudeOutput?.content);}