Popcorn (Popcorn v0.1.0)

View Source

Popcorn is a tool for running Elixir in the browser.

Summary

Functions

Bundles compiled project code into an .avm file.

Generates static artifacts to run the project in the browser.

Generates artifacts needed to run any Popcorn-based project.

Functions

bundle(options \\ [])

@spec bundle(
  out_dir: String.t(),
  start_module: module(),
  compile_artifacts: [String.t()]
) :: :ok

Bundles compiled project code into an .avm file.

Options have the same semantics as in cook/1.

cook(options \\ [])

@spec cook(
  out_dir: String.t(),
  start_module: module(),
  target: :wasm | :unix,
  compile_artifacts: [String.t()]
) :: :ok

Generates static artifacts to run the project in the browser.

Options:

  • out_dir - The directory to write artifacts to. Required, unless provided via config.exs.
  • start_module - Optional; a module with start/0 function that will be called after applications start.
  • target - wasm (default) or unix. If unix is chosed, you need to build the runtime first with mix popcorn.build_runtime --target unix
  • compile_artifacts - Compiled BEAMs and other artifacts that should be included in the generated bundle. Defaults to all the .beam and .app files for the application and dependencies.

Instead of calling cook/1, you can call ingredients/1 and then bundle/1.

ingredients(options \\ [])

@spec ingredients(out_dir: String.t(), target: :wasm | :unix) :: :ok

Generates artifacts needed to run any Popcorn-based project.

Options have the same semantics as in cook/1.