Browser Compiler API
Browser-compatible PromptScript compiler.
Provides in-memory compilation for browser environments (playgrounds, web editors). Uses a virtual file system instead of Node.js fs operations.
Example
import { compile, VirtualFileSystem, getBundledRegistryFiles } from '@promptscript/browser-compiler';
// Create virtual file system with project filesconst files = new Map([ ['project.prs', ` @meta { id: "my-project" syntax: "1.0.0" } @identity { """You are a helpful assistant.""" } `],]);
// Optionally add bundled registry files for @inherit supportconst registry = getBundledRegistryFiles();for (const [path, content] of Object.entries(registry)) { files.set(path, content);}
// Compileconst result = await compile(files, 'project.prs');
if (result.success) { for (const [outputPath, output] of result.outputs) { console.log(`${outputPath}:`, output.content); }} else { console.error('Compilation errors:', result.errors);}Classes
Interfaces
Type Aliases
Functions
References
createOutputPlan
Re-exports createOutputPlan
normalizeOutputCollisionKey
Re-exports normalizeOutputCollisionKey
normalizeOutputPath
Re-exports normalizeOutputPath
OutputArtifact
Re-exports OutputArtifact
OutputPlan
Re-exports OutputPlan
OutputPlanArtifactRole
Re-exports OutputPlanArtifactRole
OutputPlanCandidate
Re-exports OutputPlanCandidate
OutputPlanCollision
Re-exports OutputPlanCollision
OutputPlanCollisionResolution
Re-exports OutputPlanCollisionResolution
OutputPlanFile
Re-exports OutputPlanFile
OutputPlanManagedPaths
Re-exports OutputPlanManagedPaths
OutputPlanPathError
Re-exports OutputPlanPathError