Environment
The inlang environment contains functions that are injected by the host application (e.g. the browser or VSCode).
These functions are prefixed with a $
to distinguish them from user-defined functions. The inlang environment is required because functions such as import()
behave differently from environment to environment (NodeJS, Browser, VSCode, Electron).
API
$fs
: Read and write files from the filesystem.
The filesystem is a subset of node:fs/promises
, asynchronous only and supports the following functions:
readFile
writeFile
readdir
mkdir
import()
$import
: Importing an ES module either from a local path in a git repository or from a url.
Importing external code via $import
is a security risk.
Imported code is not sandboxed yet. Only $import
external code that you trust (similar to NPM packages). See #129 for more information.