Skip to main content

find_functions_runtime

Function find_functions_runtime 

Source
pub fn find_functions_runtime() -> Option<String>
Expand description

Spawn the Bun function runtime if a functions/ directory exists.

Returns Some(FnOpsImpl) if successful, None if no functions directory or if Bun is not installed. Errors during startup print to stderr and return None to keep the server running. Resolve the path to the TypeScript function runtime script.

Searches in order:

  1. $PYLON_FUNCTIONS_RUNTIME environment variable (if set and file exists)
  2. ./node_modules/@pylon/functions/src/runtime.ts (npm-installed)
  3. ./node_modules/@pylon/functions/dist/runtime.js (built)
  4. ~/.pylon/runtime.ts (user install)
  5. packages/functions/src/runtime.ts (dev monorepo)

Returns None if none exist.