Class: AvenxCompiler

AvenxCompiler(optionsopt)

AvenxCompiler is the main orchestrator for the Avenx-JS build process. It coordinates the parsing of components, processing of styles, and the final bundling of the application.

Constructor

new AvenxCompiler(optionsopt)

Creates an instance of AvenxCompiler and initializes its sub-processors.

Parameters:
Name Type Attributes Description
options object <optional>

Optional custom settings to override config defaults.

Source:

Members

componentParser :ComponentParser

Type:
Source:

config :object

Type:
  • object
Source:

coreDir :string

The directory containing core runtime files.

Type:
  • string
Source:

distDir :string

The distribution directory (usually 'dist').

Type:
  • string
Source:

mode :'production'|'development'

The build mode. Production is the default: avenx build is what runs in CI and in a deploy step, so the safe default is the optimised output. avenx serve and avenx watch opt into development explicitly.

Type:
  • 'production' | 'development'
Source:

outputName :string

The output bundle name without file extension. Defaults to "bundle" when outputName is not configured.

Type:
  • string
Source:

production :boolean

True when building optimised output.

Type:
  • boolean
Source:

rootDir :string

The root directory of the project.

Type:
  • string
Source:

srcDir :string

The source directory (usually 'src').

Type:
  • string
Source:

styleProcessor :StyleProcessor

Type:
Source:

Methods

analyze(optionsopt) → {AppModel}

Builds the Atlas model without emitting a bundle.

avenx atlas, avenx impact and avenx why need the model and nothing else, and writing a bundle to answer a query would be both slow and rude — it would overwrite whatever is in dist/. The work here is the same parse the build performs, so the two can never disagree.

Parameters:
Name Type Attributes Description
options object <optional>

Analysis options.

Properties
Name Type Attributes Description
tolerant boolean <optional>

Record a failing phase on the model and carry on, rather than throwing. Defaults to true, because a query is often asked precisely because the project is broken.

Source:
Returns:

The finished model.

Type
AppModel

beginModel() → {AppModel}

Starts a fresh Atlas model for this run and attaches it to the parser.

Called at the top of both build and analyze so a compiler instance can be reused — avenx watch does exactly that — without the second run inheriting the first run's nodes.

Source:
Returns:

The model being populated.

Type
AppModel

build() → {Object}

Executes the full build process.

Every fatal condition throws. Nothing here logs an error and returns as if the build had finished: a caller that cannot tell success from failure cannot set an exit code, and a pipeline that cannot see the failure deploys whatever is already in the output directory.

Source:
Throws:

When the application cannot be compiled.

Type
BuildError
Returns:

A description of what was written.

Type
Object

compileComponent(filePath) → {string}

Compiles a single component file.

Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

compilePage(filePath) → {string}

Compiles a single page file.

Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string