Environment functions

The config can make use of environment functions, denoted by a prefixed $, to call read from the filesystem, import external code, and more.

Inlang's config is executed in a variety of environments such as the browser, NodeJS, or Electron. Unfortunately, functions such as import() behave differently from environment to environment. Environment functions assure consistent behaviour across different environments.

Reference

Always up-to-date reference can be found in the repository.

$fs: FS

Is an implementation of a file system. node:fs and memfs fit without any wrapper. vscode.workspace.fs needs a wrapper. Read more about the internal file system of inlang here.

$import: dynamic import()

WARNING

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.

Importing an ES module either from a local path in a git repository or from a url. Note that the imported module must not have imports itself. If dependencies are required for a module, the module needs to be bundled into one single file. For an example of bundling, take a look at the official plugin template.