View Source Hologram.Compiler (hologram v0.2.0)
Summary
Functions
Builds the call graph of all modules in the project.
Builds the call graph of all modules in the given IR PLT.
Builds IR persistent lookup table (PLT) of all modules in the project.
Builds IR persistent lookup table (PLT) of all modules in the project using the given module BEAM path PLT.
Builds module BEAM path persistent lookup table (PLT) of all modules in the project.
Builds a persistent lookup table (PLT) containing the BEAM defs digests for all the modules in the project. Mutates module BEAM path PLT.
Builds page digest PLT, where the keys represent page modules, and the values are hex digests of their corresponding JavaScript bundles.
Builds JavaScript code for the given Hologram page.
Builds Hologram runtime JavaScript source code.
Bundles multiple entry files. Includes the source maps of the output files. The output files' and source maps' file names contain hex digest.
Bundles the given entry file. Includes the source map of the output file. The output file and source map file names contain hex digest.
Creates page bundle entry file.
Creates runtime bundle entry file.
Compares two module digest PLTs and returns the added, removed, and updated modules lists.
Formats the given JavaScript files with Biome.
Groups the given MFAs by module.
Installs JavaScript deps which are specified in package.json located in assets_dir. Saves the package.json digest to package_json_digest.bin file in build_dir.
Installs JavaScript deps if package.json has changed or if the deps haven't been installed yet.
Loads call graph from a dump file if the file exists or creates an empty call graph.
Loads IR PLT from a dump file if the file exists or creates an empty PLT.
Loads module BEAM path PLT from a dump file if the file exists or creates an empty PLT.
Loads module digest PLT from a dump file if the file exists or creates an empty PLT.
Given a module digests diff, updates the IR persistent lookup table (PLT) by deleting entries for modules that have been removed, rebuilding the IR of modules that have been updated, and adding the IR of new modules.
Keeps only those IR expressions that are function definitions of the given reachable MFAs.
Raises a compilation error if any page module lacks a specified route or layout.
Functions
@spec build_call_graph() :: Hologram.Compiler.CallGraph.t()
Builds the call graph of all modules in the project.
@spec build_call_graph(Hologram.Commons.PLT.t()) :: Hologram.Compiler.CallGraph.t()
Builds the call graph of all modules in the given IR PLT.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/build_call_graph_1/README.md
@spec build_ir_plt() :: Hologram.Commons.PLT.t()
Builds IR persistent lookup table (PLT) of all modules in the project.
@spec build_ir_plt(Hologram.Commons.PLT.t()) :: Hologram.Commons.PLT.t()
Builds IR persistent lookup table (PLT) of all modules in the project using the given module BEAM path PLT.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/build_ir_plt_1/README.md
@spec build_module_beam_path_plt() :: Hologram.Commons.PLT.t()
Builds module BEAM path persistent lookup table (PLT) of all modules in the project.
@spec build_module_digest_plt!(Hologram.Commons.PLT.t()) :: Hologram.Commons.PLT.t()
Builds a persistent lookup table (PLT) containing the BEAM defs digests for all the modules in the project. Mutates module BEAM path PLT.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/build_module_digest_plt!_1/README.md
@spec build_page_digest_plt([map()], Hologram.Commons.Types.opts()) :: {Hologram.Commons.PLT.t(), Hologram.Commons.Types.file_path()}
Builds page digest PLT, where the keys represent page modules, and the values are hex digests of their corresponding JavaScript bundles.
@spec build_page_js( module(), Hologram.Compiler.CallGraph.t(), Hologram.Commons.PLT.t(), Hologram.Commons.Types.file_path() ) :: String.t()
Builds JavaScript code for the given Hologram page.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/build_page_js_4/README.md
@spec build_runtime_js( [mfa()], Hologram.Commons.PLT.t(), Hologram.Commons.Types.file_path() ) :: String.t()
Builds Hologram runtime JavaScript source code.
@spec bundle( [{term(), Hologram.Commons.Types.file_path(), String.t()}], Hologram.Commons.Types.opts() ) :: [map()]
Bundles multiple entry files. Includes the source maps of the output files. The output files' and source maps' file names contain hex digest.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/bundle_2/README.md
@spec bundle( term(), Hologram.Commons.Types.file_path(), String.t(), Hologram.Commons.Types.opts() ) :: map()
Bundles the given entry file. Includes the source map of the output file. The output file and source map file names contain hex digest.
@spec create_page_entry_files( [module()], Hologram.Compiler.CallGraph.t(), Hologram.Commons.PLT.t(), Hologram.Commons.Types.opts() ) :: [{module(), Hologram.Commons.Types.file_path()}]
Creates page bundle entry file.
@spec create_runtime_entry_file( [mfa()], Hologram.Commons.PLT.t(), Hologram.Commons.Types.opts() ) :: Hologram.Commons.Types.file_path()
Creates runtime bundle entry file.
@spec diff_module_digest_plts(Hologram.Commons.PLT.t(), Hologram.Commons.PLT.t()) :: %{ added_modules: [module()], removed_modules: [module()], updated_modules: [module()] }
Compares two module digest PLTs and returns the added, removed, and updated modules lists.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/diff_module_digest_plts_2/README.md
@spec format_files( [Hologram.Commons.Types.file_path()], Hologram.Commons.Types.opts() ) :: {Collectable.t(), exit_status :: non_neg_integer()}
Formats the given JavaScript files with Biome.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/format_files_2/README.md
Groups the given MFAs by module.
@spec install_js_deps( Hologram.Commons.Types.file_path(), Hologram.Commons.Types.file_path() ) :: :ok
Installs JavaScript deps which are specified in package.json located in assets_dir. Saves the package.json digest to package_json_digest.bin file in build_dir.
@spec maybe_install_js_deps( Hologram.Commons.Types.file_path(), Hologram.Commons.Types.file_path() ) :: :ok | nil
Installs JavaScript deps if package.json has changed or if the deps haven't been installed yet.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/maybe_install_js_deps_2/README.md
@spec maybe_load_call_graph(Hologram.Commons.Types.file_path()) :: {Hologram.Compiler.CallGraph.t(), String.t()}
Loads call graph from a dump file if the file exists or creates an empty call graph.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/maybe_load_call_graph_1/README.md
@spec maybe_load_ir_plt(Hologram.Commons.Types.file_path()) :: {Hologram.Commons.PLT.t(), String.t()}
Loads IR PLT from a dump file if the file exists or creates an empty PLT.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/maybe_load_ir_plt_1/README.md
@spec maybe_load_module_beam_path_plt(Hologram.Commons.Types.file_path()) :: {Hologram.Commons.PLT.t(), String.t()}
Loads module BEAM path PLT from a dump file if the file exists or creates an empty PLT.
@spec maybe_load_module_digest_plt(Hologram.Commons.Types.file_path()) :: {Hologram.Commons.PLT.t(), String.t()}
Loads module digest PLT from a dump file if the file exists or creates an empty PLT.
@spec patch_ir_plt!(Hologram.Commons.PLT.t(), map(), Hologram.Commons.PLT.t()) :: Hologram.Commons.PLT.t()
Given a module digests diff, updates the IR persistent lookup table (PLT) by deleting entries for modules that have been removed, rebuilding the IR of modules that have been updated, and adding the IR of new modules.
@spec prune_module_def(Hologram.Compiler.IR.ModuleDefinition.t(), [mfa()]) :: Hologram.Compiler.IR.ModuleDefinition.t()
Keeps only those IR expressions that are function definitions of the given reachable MFAs.
@spec validate_page_modules([module()]) :: :ok
Raises a compilation error if any page module lacks a specified route or layout.