Members
(constant) ALLOWED_GLOBALS :Set:.<string:>
Whitelist allocation set tracking global identifiers authorized for inline evaluation scope. Global scopes outside this tracking collection are rejected with a sandbox exception.
Type:
Properties:
| Name | Type | Description |
|---|---|---|
Math |
string | Native mathematical calculations and constants. |
JSON |
string | Structured string serialization and parsing tools. |
Array |
string | Array generation constructors. |
Object |
string | Standard JavaScript object manipulators. |
String |
string | Text parsing constructors. |
console |
string | Core debugging console methods. |
parseInt |
string | Numeric text converter algorithms. |
parseFloat |
string | Decimal text converter algorithms. |
- Source:
(constant) ATOMIC_VALUE :RegExp
Matches the : atomic( that marks a bridge action as transactional.
Type:
- RegExp
- Source:
(constant) AvenxErrorCodes :AvenxErrorCodesType
Type:
- Source:
(constant) AvenxErrorMessages :Object:.<string:, string:>
Message templates mapping for each AvenxErrorCodes identifier. Placeholders are specified as {0}, {1}, etc. and replaced at formatting time.
Type:
- Source:
(constant) BOOLEAN_ATTRIBUTES :Set:.<string:>
A set of known HTML boolean attributes.
Type:
- Source:
(constant) BUILTIN_COMPONENT_MODULES :Array:.<Array:.<string:>>
Built-in components that are only linked when a template references them.
AvenxApp used to import every built-in directly, which put each of them in
every bundle regardless of use. The registry in
lib/core/runtime/builtins.js is filled by these modules instead, and this
map is what decides which of them the entry graph reaches.
Type:
- Source:
(constant) BUILTIN_TAGS :Set:.<string:>
Framework tags the compiler understands directly. These are never real components, so a reference to one must not be reported as an unresolved component (see ComponentParser#validateComponentTags / AVX_W46).
The @-prefixed directives (@for, @if, @suspense, …) are handled
separately: any tag beginning with @ is skipped unconditionally, so it is
enough to list the non-prefixed framework tags here.
Type:
- Source:
(constant) BUNDLE_SIZE_WARNING_THRESHOLD_KB :number
Default size above which a build warns about the JavaScript it produced.
Raised from 50 KB when the bundler replaced the concatenator, because 50 KB
was never satisfiable: the framework runtime alone is several times that, so
AVX_W01 fired on avenx init output and on every build after it. A warning
that always fires is a warning nobody reads, and it made the repository's own
bundle-size CI gate permanently red.
The number is a ceiling for the whole bundle -- runtime included -- chosen to
sit above what an application of a few dozen components costs and to fire
when something large joins the graph. bundleSizeWarningKb in
avenx.config.json overrides it, because the honest number depends on what the
application is.
Type:
- number
- Source:
(constant) CONFIG_SCHEMA :Object
The configuration keys avenx.config.json accepts.
Exported so that every consumer validates against one list. avenx doctor
kept a second copy and drifted from this one, reporting valid options as
unrecognised.
Type:
- Object
- Source:
(constant) CONFLICT_POLICIES :Array:.<string:>
Conflict policies an <action atomic> may select.
Mirrors rewind.onConflict in avenx.config.json, which supplies the default
when an action does not name one.
Type:
- Source:
(constant) DEFAULT_ALLOWED_ATTRIBUTES
Safe allowed attributes by default.
- Source:
(constant) DEFAULT_ALLOWED_TAGS
Safe allowed tags by default.
- Source:
(constant) DIAGNOSTIC_CATALOGUE
Structured diagnostic catalogue mapping stable error and warning codes to detailed descriptions, causes, remedies, and documentation links.
- Source:
(constant) FUNCTION_CONSTRUCTORS :Set:.<function()>
The dynamic-code constructors. Reaching any of these from a template would allow arbitrary code execution, so the sandbox refuses to hand them out or invoke them regardless of the route taken to obtain them (property access, property descriptors, prototype walks).
Type:
- Source:
(constant) INSTANCE_API_KEYS :Set:.<string:>
Keys of the consumer-facing instance that are not bridge state.
Type:
- Source:
(constant) INVALID_URL_PROTOCOL
Regex matching unsafe URL protocols.
- Source:
(constant) ISOLATION_VIOLATION_PATTERNS
Isolation violation patterns (accessing ambient global bridges or parent scope).
- Source:
(constant) IS_BRIDGE :symbol
Marks a value as an Avenx bridge instance.
Type:
- symbol
- Source:
(constant) KNOWN_ELEMENTS :Set:.<string:>
A conservative set of known HTML and SVG element names. Element names are lowercase, so a PascalCase tag can practically never collide with one; this set exists only as a defensive net for an element written with an unusual case. It is deliberately not exhaustive — anything lowercase is treated as an ordinary element regardless of membership (see ComponentParser#validateComponentTags).
Type:
- Source:
(constant) LIVE_REGION_ID
Accessibility helper for managing focus and route announcements during SPA navigation.
(constant) MAX_TRACE_BYTES :number
The largest request body the trace ingest endpoint will buffer.
A recording is bounded by the recorder's ring buffer, so anything larger is not a trace and must not be accumulated in memory.
Type:
- number
- Source:
(constant) NAMESPACE_GLOBAL :string
The name of the namespace object carrying the complete runtime surface.
Type:
- string
- Source:
(constant) PROTECTED_PROTOTYPES :Set:.<object:>
Built-in prototypes shared by every object in the realm.
validateSource only rejects the literal identifiers constructor,
__proto__ and prototype, which a computed access such as
Object.getPrototypeOf({}) or Object['proto' + 'type'] walks straight
past. Handing one of these objects to a template would let it mutate state
shared with the host application, so the sandbox refuses to surface them at
all rather than trying to enumerate every mutating API.
Type:
- Source:
(constant) PUBLIC_GLOBALS :Array:.<string:>
The runtime names published as bare globals in a compiled application.
A compiled bundle is one concatenated script. The compiler strips the
import statements from main.app.js, guard modules and bridge modules,
and rewrites them into destructuring from the Avenx namespace — so an
import is not what makes a name reachable. Two things still need a bare
identifier:
- Code the compiler generates itself. Components and pages are emitted as
class X extends AvenxComponent, so that name must resolve on its own. - Authoring entry points a project may reference without importing, which older projects and older examples do.
Everything else the runtime exports lives on globalThis.Avenx and nowhere
else. It used to be that every export was copied onto globalThis —
67 names, including html, logger, profile and nextTick — which
collided with ordinary page scripts for no benefit.
Adding a name here is a public API decision: it is a global that Avenx then owns in every application, forever.
Type:
- Source:
(constant) RESERVED_KEYS :Array:.<string:>
Definition keys that the Bridge API owns and a definition may not redeclare.
Type:
- Source:
(constant) RUNTIME_SPECIFIER :RegExp
Module specifiers that resolve to the Avenx runtime.
Type:
- RegExp
- Source:
(constant) SET_NAME :symbol
Internal channel used by the compiler to label a bridge. A symbol keeps it
out of the member namespace that templates and ownKeys see.
Type:
- symbol
- Source:
(constant) STRIP_CONTENT_TAGS
Elements whose content must be stripped completely if the element itself is not allowed.
- Source:
(constant) URL_ATTRIBUTES
Attributes that expect a URL value.
- Source:
(constant) VOID_ELEMENTS
Void elements in HTML.
- Source:
activeScope :DisposalScope|null
The scope that currently owns newly created teardown callbacks.
Type:
- DisposalScope | null
- Source:
activeWatcher :AvenxWatcher|null
The currently active watcher evaluating a reactive expression/function.
Type:
- AvenxWatcher | null
- Source:
(constant) blue
Blue text, used for informational notices.
- Source:
(constant) bold
Bold text, used for section headings.
- Source:
(constant) configCache :Map:.<string:, (object:|null:)>
Cache of resolved avenx.config.json contents, keyed by the directory
the search started from, so each component file doesn't re-read and
re-parse the config from disk.
Type:
- Source:
(constant) consoleTransport
Default console transport. Dispatches messages to console methods dynamically.
- Source:
(constant) cyan
Cyan text, used for headings and highlighted values.
- Source:
(constant) deadlockHandlers :Set:.<function()>
Registered deadlock event callbacks.
Type:
- Source:
(constant) declarationCache :LruCache
Declaration sets keyed by source text.
Every parseX method needs the same scan, and ComponentParser calls six of
them per file. Scanning once per unique source keeps that a single pass
without changing any method's signature.
Type:
- Source:
(constant) depMap :WeakMap:.<object:, Map:.<string:, Set:.<AvenxWatcher:>>>
WeakMap tracking raw target to Map of keys to Set of active Watchers depending on them.
Type:
- WeakMap:.<object:, Map:.<string:, Set:.<AvenxWatcher:>>>
- Source:
(constant) dim
Dimmed text, used for secondary details.
- Source:
(constant) executionHistory :Array:.<{id:: any:, name:: string:, job:: function()}>
Ordered log of jobs executed during the current flush for deadlock cycle diagnosis.
Type:
- Source:
flushDepth :number
Recursion depth of the currently executing flush.
Incremented once per flushJobs invocation, not once per job: a flush pass legitimately drains arbitrarily many jobs (one per updating component), so only re-entry — a pass whose jobs queued yet more work — indicates a potential runaway update chain.
Type:
- number
- Source:
(constant) gray
Gray text, used for descriptions and hints.
- Source:
(constant) green
Green text, reserved for successful actions.
- Source:
(constant) jobExecutionCounts :Map:.<any:, number:>
Execution count of individual jobs in the current flush cycle. Keyed by job or job.id.
Type:
- Source:
maxFlushCount :number
Maximum recursive flush depth allowed before triggering reactive deadlock abort. Defaults to 25 to accommodate deep legitimate multi-pass updates while stopping infinite cycles.
Type:
- number
- Source:
(constant) parentMap :WeakMap:.<object:, {parentTarget:: object:, parentKey:: string:}>
WeakMap tracking nested child targets to their parent relationship.
Type:
- Source:
parserInstance :DOMParser|null
The DOMParser used for every patch.
One instance rather than one per patch. Constructing a DOMParser is not free, and the update path runs it on every component on every flush.
Type:
- DOMParser | null
- Source:
(constant) queued :Set:.<function()>
Membership index for queue.
Deduplication used to be queue.includes(job), a linear scan on every
enqueue. That was unnoticeable when a queue held one job per updating
component. Fine-grained rendering puts one job per binding in it, so a
component with 500 bound values turned a flush into 125,000 comparisons
before running a single job. The set is kept exactly in step with the array:
anything that removes from one removes from the other.
Type:
- Source:
(constant) red
Red text, reserved for errors and failed checks.
- Source:
(constant) styleMountManager :StyleMountManager
The singleton instance used by all components.
Type:
(constant) watcherStack :Array:.<AvenxWatcher:>
Call stack of active watchers.
Type:
- Array:.<AvenxWatcher:>
- Source:
(constant) yellow
Yellow text, reserved for warnings.
- Source:
Methods
abortIfGeneratedPathExists(baseDir, type, name, targetPaths) → {boolean}
Stops generation if any target path already exists.
Parameters:
| Name | Type | Description |
|---|---|---|
baseDir |
string | |
type |
string | |
name |
string | |
targetPaths |
Array:.<string:> |
- Source:
Returns:
- Type
- boolean
actionLabel(name) → {string}
Human-readable label for the command being run, used in failure headlines.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The command name. |
- Source:
Returns:
The label.
- Type
- string
age(mtime) → {string}
Renders an age as a short relative string.
Parameters:
| Name | Type | Description |
|---|---|---|
mtime |
number | Epoch milliseconds. |
- Source:
Returns:
e.g. 2m, 8h, 3d.
- Type
- string
analyzeBridge(filePath, source) → {object|null}
Analyses a bridge module.
A bridge module imports bridge from the Avenx runtime and exports the
definition object it returns. Anything else in a *.bridge.js file is not a
bridge, and is reported as such so the caller can raise a build error rather
than emit a module the runtime cannot use.
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Absolute path to the |
source |
string | The module source. |
- Source:
Returns:
A descriptor of the bridge, or null when the module is
not built on the bridge() factory.
- Type
- object | null
analyzeBridgeFile(filePath, transformopt) → {object|null}
Reads and analyses a bridge module from disk.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
filePath |
string | Absolute path to the |
|
transform |
function |
<optional> |
Optional source transform, used by the compiler to substitute environment variables. |
- Source:
Returns:
The descriptor, or null when the file cannot be read or
is not built on the bridge() factory.
- Type
- object | null
analyzeStats(cli) → {object}
Scans the project source directory and collects component, page, bridge, and guard metrics.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | AvenxCLI instance containing baseDir and config. |
- Source:
Returns:
Analysis result containing summary and item metrics.
- Type
- object
announce(message)
Announces a message to screen readers via the live region. Clears and updates after a microtask/frame to ensure assistive tech detects changes.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string |
applyCustomHeaders(res, headersopt)
Applies configured custom headers to an HTTP response.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
res |
object | Node HTTP response object. |
|
headers |
object |
<optional> |
Header name/value pairs from server.headers. |
- Source:
arrowParameters(code) → {Set:.<string:>}
The parameter names bound by arrow functions in an expression.
Covers x => … and (x, y) => …, which is the whole of what the template
expression language admits -- a destructuring parameter is not an expression
and is refused before it reaches here.
Parameters:
| Name | Type | Description |
|---|---|---|
code |
string | The expression source. |
- Source:
Returns:
The bound names.
assertNotFunctionConstructor(value)
Throws when a value is one of the dynamic-code constructors.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value about to be returned or invoked. |
- Source:
assertNotProtectedPrototype(value)
Throws when a value is a shared built-in prototype.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value about to be returned, passed or invoked. |
- Source:
assertSnapshot(received, nameopt, optionsopt) → {void}
Asserts that the received DOM node, wrapper, or HTML matches a persisted snapshot.
Parameters:
- Source:
Returns:
- Type
- void
attachRequestLogger(req, res, loggeropt) → {function}
Attaches an HTTP request logging listener to a response object.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
req |
object | ||
res |
object | ||
logger |
function |
<optional> |
Custom logger function. |
- Source:
Returns:
Completion logger handler.
- Type
- function
belongsToComponent(element, root) → {boolean}
Checks if a given DOM element belongs to the component defined by root. Deals with nested component boundaries and transcluded slots.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
Element | |
root |
Element |
- Source:
Returns:
- Type
- boolean
blankComments(source) → {string}
Replaces comments with spaces, preserving length and line structure.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
- Source:
Returns:
The source with comments blanked.
- Type
- string
bridge(definition) → {object}
Creates a Bridge: a reactive unit of shared state and behaviour that components consume by importing it.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
definition |
object | The bridge definition. Properties
|
- Source:
Returns:
The bridge instance to export from the module.
- Type
- object
bridgeBindingName(name) → {string}
Returns the identifier the compiled bundle uses for a bridge instance.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The bridge name. |
- Source:
Returns:
A valid JavaScript identifier.
- Type
- string
bridgeNameFromFile(filePath) → {string}
Derives a bridge's name from its file name.
user-prefs.bridge.js becomes userPrefs.
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to the bridge module. |
- Source:
Returns:
The bridge name.
- Type
- string
buildAstScope(scope, thisArg) → {object}
Presents the scope and the this context as one lookup surface.
with(this) used to merge them. The AST evaluator resolves names against a
single object instead, so the two are layered here: the scope wins, and the
this context -- a component's reactive state -- fills in behind it, which
is what makes count = 1 inside an action reach state rather than creating a
scope-local name.
Parameters:
| Name | Type | Description |
|---|---|---|
scope |
object | The evaluation scope. |
thisArg |
object | The |
- Source:
Returns:
A combined lookup surface.
- Type
- object
buildAtomicSpec(modifiers, methods) → {Object:.<string:, object:>|null}
Builds the atomic descriptor the generated constructor carries.
Only the runtime-relevant half of a modifier reaches the bundle. The write set, the boundedness flag and the irreversible-effect list are compile-time findings: they exist to be reported before the application ships, and the journal does not need them because it observes the reactive proxies rather than a prediction of what they will do.
A modifier naming an action the component does not declare is dropped. The
generated code would otherwise reference a method that is not there, and a
typo in name= is already reported by the action itself being missing.
Parameters:
| Name | Type | Description |
|---|---|---|
modifiers |
Object:.<string:, {atomic:: boolean:, onConflict:: string:=}> | Parsed modifiers. |
methods |
Object:.<string:, string:> | The component's action bodies. |
- Source:
Returns:
The descriptor, or null when there is nothing to emit.
buildEventNode(source, event) → {object}
Builds the trace node for a dispatched event.
The handler source is recorded verbatim. Avenx keeps template expressions as source text right through to evaluation, so the trace can name the exact code that ran rather than a compiled closure with no identity.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The handler source from the template. |
event |
Event | null | The dispatched event. |
- Source:
Returns:
The event node fields.
- Type
- object
buildModel(cli) → {AppModel}
Builds the application model, keeping compiler chatter out of query output.
A query is a question about the code, not a build, so the progress lines the compiler normally prints would be noise around the answer. Warnings and errors still reach the terminal.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The AvenxCLI instance. |
- Source:
Returns:
The model.
- Type
- AppModel
buildProject(cli) → {object}
Runs the compiler build along with optional prebuild and postbuild lifecycle hooks.
Throws on any failure. The caller turns that into an exit code; nothing here may report success for a build that did not complete.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | AvenxCLI instance containing config and baseDir. |
- Source:
Throws:
-
When a hook or the compilation fails.
- Type
- BuildError
Returns:
The compiler's build result.
- Type
- object
byJobId(a, b) → {number}
Orders jobs by their id ascending so parent components (lower uid) update
before their children.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
function | |
b |
function |
- Source:
Returns:
- Type
- number
checkGitStatus() → {boolean|Promise:.<boolean:>}
Checks if git status is clean or prompts user if there are unstaged changes.
- Source:
Returns:
checkProject(cli, argsopt) → {object|fs.FSWatcher|undefined}
Validates template files without building. Supports --watch / -w for continuous watching and template linting.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | AvenxCLI instance containing config and baseDir. |
|
args |
Array:.<string:> |
<optional> |
Additional command line arguments. |
- Source:
Returns:
Diagnostic report or watcher instance.
- Type
- object | fs.FSWatcher | undefined
classTokensEqual(a, b) → {boolean}
Compares two class attribute strings as unordered token sets, ignoring extra whitespace and token order, so redundant DOM mutations are skipped when the effective class list is unchanged.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
string | null | |
b |
string | null |
- Source:
Returns:
- Type
- boolean
cleanProject(cli)
Cleans the project by deleting the build output directory.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | AvenxCLI instance containing config and baseDir. |
- Source:
cleanupParentMap(value, seenopt)
Recursively cleans up parentMap entries for a detached reactive target and its nested properties.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
any | ||
seen |
Set:.<any:> |
<optional> |
clearCausationTrace()
Clears the causation trace log.
- Source:
cloneInitial(value) → {any}
Deep-copies plain objects and arrays so a bridge never mutates the literal
that was passed to bridge(). Everything else (class instances, Dates,
functions, Maps) is intentionally shared by reference: those values are not
made reactive either, so copying them would only be surprising.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value to copy. |
- Source:
Returns:
A copy for plain containers, or the original value.
- Type
- any
collectImportBindings(source, bridgeLocals) → {Array:.<string:>}
The local names a component's own imports bind, excluding bridges and the runtime entry.
A bridge already reaches the template through the bridges argument, and the runtime import binds the base class the generated module extends. Everything else -- an npm package, a local helper -- is a value the developer expects to be able to name, so it becomes part of the component's evaluation scope.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The component source. |
bridgeLocals |
Array:.<string:> | Local names already bound as bridges. |
- Source:
Returns:
Local binding names, in source order.
collectLoopBindings(node, declared)
Adds every name a <@for> header binds to the declared set.
index is included for every loop, named or not, because that is how the
loop index has always been reached -- and reporting it as undeclared was a
warning on correct code, which is worse than no warning at all.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
object | A parsed template node. |
declared |
Set:.<string:> | The set to add to. |
- Source:
collectSemantics(cli) → {Object}
Reads what each unit declares from the compiler's semantic model.
Keyed by file path rather than by name: stats derives a display name from
whatever class X a file contains, while the compiler names a unit after
its file. Those disagree often enough that matching on them would silently
report zero. The path is the same fact on both sides.
Falls back to per-file parsing when the model cannot be built — stats is a
footprint report and should still produce byte sizes for a project that does
not currently compile.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The AvenxCLI instance. |
- Source:
Returns:
Declared state counts by root-relative file path.
- Type
- Object
collectUnknownKeys(obj, allowed, prefix) → {Array:.<string:>}
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object | |
allowed |
Array:.<string:> | |
prefix |
string |
- Source:
Returns:
compareVersions(current, required) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
current |
Array:.<number:> | |
required |
Array:.<number:> |
- Source:
Returns:
- Type
- boolean
componentNameFromFile(fileName) → {string}
Converts an Avenx component filename into its canonical PascalCase name.
Parameters:
| Name | Type | Description |
|---|---|---|
fileName |
string |
Returns:
- Type
- string
composeBundleSourceMap(bundleFileName, totalBundleLines, sections, optionsopt) → {object}
Builds a bundle-level v3 source map given file sections and their position in the final bundle.
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
bundleFileName |
string | e.g. 'bundle.js' |
|||||||||
totalBundleLines |
number | Total lines in bundle.js |
|||||||||
sections |
Array:.<{filePath:: string:, originalCode:: string:, startLine:: number:, lineCount:: number:}> | ||||||||||
options |
object |
<optional> |
Properties
|
- Source:
Returns:
Source Map v3 object.
- Type
- object
containsSlot(node) → {boolean}
Recursively checks whether a node is a
Parameters:
| Name | Type | Description |
|---|---|---|
node |
HTMLNode |
- Source:
Returns:
- Type
- boolean
createDeepMockProxy(target, path, options) → {object}
Creates a deep proxy to track calls and state modifications.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | Target object to proxy. |
path |
Array:.<string:> | Key path of the object being proxied. |
options |
object | State change and calls tracking options. |
- Source:
Returns:
Proxied target.
- Type
- object
createInterpolationRegex() → {RegExp}
Creates a fresh regex matching template interpolations — both the raw triple-brace form and the escaped double-brace form.
Expressions may span multiple lines (a long ternary or object literal wraps naturally, and formatters will wrap them), so the pattern must not stop at a newline. The compiler and the runtime share this single definition: when the two sides used different patterns, a wrapped expression passed compile-time validation and then rendered as literal braces at runtime with no diagnostic.
A new instance is returned on every call because the regex is global and
callers rely on their own lastIndex.
- Source:
Returns:
A fresh global interpolation regex.
- Type
- RegExp
createNavigationDelegate(optionsopt) → {object}
Creates an appropriate navigation delegate based on configuration options and environment.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
object |
<optional> |
Returns:
- Type
- object
createRecursiveWatcherFallback(rootPath, callback) → {Object}
Fallback recursive watcher for platforms/Node versions lacking native recursive watch. Walks directory tree and registers individual fs.watch instances.
Parameters:
| Name | Type | Description |
|---|---|---|
rootPath |
string | Root directory to watch. |
callback |
function | Event callback. |
- Source:
Returns:
- Type
- Object
createSeverityFormatter() → {function}
Creates an AvenxLogger formatter that tints diagnostics by severity: warnings yellow and errors red, leaving informational build output untouched.
The formatter returns the original argument list (no [Avenx level] prefix),
matching the compiler's existing CLI output format, and only styles string
arguments so Error objects and structured context keep their shape.
- Source:
Returns:
A formatter for logger.configure.
- Type
- function
declaredMembers(descriptor) → {Array:.<string:>}
Every member a consumer may legitimately read from a bridge instance.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
object | A bridge descriptor. |
- Source:
Returns:
The declared member names.
defaultFormatter(level, args) → {Array:.<any:>}
Default formatter for browser runtime. Prefixes messages with [Avenx level] and formats component context metadata if present. Preserves interactive object logs by prepending to string or prepending as separate arg.
Parameters:
| Name | Type | Description |
|---|---|---|
level |
string | Log level name. |
args |
Array:.<any:> | Array of raw arguments. |
- Source:
Returns:
Array of formatted arguments.
defineBridgeName(name, instance) → {object}
Assigns a bridge its diagnostic name. Emitted by the compiler alongside each bridge definition so error messages and devtools can identify it.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The bridge name, derived from its file name. |
instance |
object | The bridge instance. |
- Source:
Returns:
The same instance, for convenient chaining.
- Type
- object
describe(error) → {string}
Formats a failure for display, without the stack for diagnosed errors.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
Error | any | The failure. |
- Source:
Returns:
The text to print.
- Type
- string
destroyBridge(cli, name, dryRunopt)
Destroys a Bridge class file.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean |
<optional> |
- Source:
destroyComponent(cli, name, dryRunopt)
Destroys a component folder and template files, and unregisters it from main.app.js.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean |
<optional> |
- Source:
destroyGuard(cli, name, dryRunopt)
Destroys a Guard class file.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean |
<optional> |
- Source:
destroyPage(cli, name, dryRunopt)
Destroys a page class and template files, and unregisters it from main.app.js.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean |
<optional> |
- Source:
detectColorSupport() → {boolean}
Determines whether ANSI escape codes should be emitted for this process.
- Source:
Returns:
True when the current stdout stream can render colors.
- Type
- boolean
edgeLabel(kind) → {string}
Colours an edge kind so reads and writes are distinguishable at a glance.
Parameters:
| Name | Type | Description |
|---|---|---|
kind |
string | The edge kind. |
- Source:
Returns:
The rendered label.
- Type
- string
encodeMapping(genCol, sourceIdx, sourceLine, sourceCol, state) → {string}
Encodes a 4-tuple change using previous encoder state.
Parameters:
| Name | Type | Description |
|---|---|---|
genCol |
number | |
sourceIdx |
number | |
sourceLine |
number | |
sourceCol |
number | |
state |
object |
- Source:
Returns:
- Type
- string
encodeVLQ(value) → {string}
Encodes a single integer into Base64 VLQ.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number |
- Source:
Returns:
- Type
- string
encodeVLQ(value) → {string}
Encodes an integer value to a VLQ Base64 string.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number |
- Source:
Returns:
- Type
- string
escapeAttrValue(str) → {string}
Escapes double quotes and special characters in an attribute value.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string | The attribute value to escape. |
- Source:
Returns:
The escaped attribute value.
- Type
- string
escapeTemplateMarkers(text) → {string}
Hides one level of interpolation markers from the current render pass.
A <@for> body is rendered once per item, so its {{ }} must survive the
component's own render untouched and be resolved later, per row. The compiler
therefore rewrites the body's markers to {% %} and the list manager restores
them when it renders each row.
The depth matters. A list nested inside a list is rendered twice, once as
part of the outer row and once per inner item, so its markers have to survive
two passes. Escaping deepens an existing marker rather than leaving it alone,
so each nesting level adds one % and each render removes one. Before this,
the inner body was escaped once and unescaped by the outer row, which meant
{{ row.id }} was evaluated in the group's scope, where row does not
exist, and every nested list rendered empty.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Template text to escape one level. |
- Source:
Returns:
The escaped text.
- Type
- string
escapeText(str) → {string}
Escapes special HTML characters in a text node value.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string | The text to escape. |
- Source:
Returns:
The escaped text.
- Type
- string
explainDiagnostic(cli, rawCode, asJsonopt)
Executes the avenx explain <CODE> command.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
rawCode |
string | ||
asJson |
boolean |
<optional> |
- Source:
extractCycleChain(recurringId) → {string}
Reconstructs the circular dependency chain from the execution history.
Parameters:
| Name | Type | Description |
|---|---|---|
recurringId |
any | The job ID that repeated excessively. |
- Source:
Returns:
Formatted cycle string (e.g. "Counter -> Stats -> Counter").
- Type
- string
extractEmittedEvents(source) → {Array:.<string:>}
Extracts every event name emitted with a literal string, e.g. this.emit('login').
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
- Source:
Returns:
Unique event names in source order.
extractLintableTemplate(source) → {string}
Removes Avenx metadata blocks that are not part of the template.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string |
Returns:
- Type
- string
extractRawTemplate(content) → {string}
Extracts raw template content from component source code.
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string |
- Source:
Returns:
- Type
- string
extractSubscriptions(source) → {Array:.<{target:: string:, event:: string:}>}
Extracts <identifier>.on('event', ...) subscriptions from source.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source to scan. |
- Source:
Returns:
The subscriptions found.
fail(message)
Reports a CLI error and marks the process as failed.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string |
- Source:
failProcess(codeopt)
Marks the process as failed.
process.exitCode is set rather than calling process.exit(), because
process.exit() tears the process down immediately and can truncate stdout
and stderr that have not flushed yet — which in CI means a build that failed
without printing the reason. Setting the code lets Node exit normally once
the output has drained.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
code |
number |
<optional> |
The exit code to fail with. |
- Source:
findBridgeImports(filePath, source) → {Array:.<{local:: string:, specifier:: string:, resolved:: string:}>}
Collects the bridge imports of any module (component, page, bridge or main).
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Absolute path to the importing file. |
source |
string | Its source text. |
- Source:
Returns:
One entry per default-imported bridge.
findComponentSource(srcDir, componentName) → {string|null}
Finds the source file for a component name, so an exported test can mount it.
Parameters:
| Name | Type | Description |
|---|---|---|
srcDir |
string | The project source directory. |
componentName |
string | The PascalCase class name. |
- Source:
Returns:
An absolute path, or null when not found.
- Type
- string | null
findDefinitionBrace(source) → {number}
Finds the bridge( call that produces the module's default export.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
- Source:
Returns:
Index of the { opening the definition object, or -1.
- Type
- number
findInvalidComponentTags(source, registeredComponents) → {Array:.<{tagName:: string:, expectedName:: string:, index:: number:}>}
Finds registered component tags that are not written in PascalCase.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | |
registeredComponents |
Set:.<string:> |
Returns:
findProjectRoot(startDir) → {string}
Find the project root directory by scanning upwards from startDir. Looks for package.json or index.html.
Parameters:
| Name | Type | Description |
|---|---|---|
startDir |
string |
- Source:
Returns:
- Type
- string
findProjectRoot(filePath, fallbackRoot) → {string}
Finds the nearest package root.
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | |
fallbackRoot |
string |
Returns:
- Type
- string
findRegisteredComponents(projectRoot, componentsDiropt) → {Set:.<string:>}
Finds components registered by the Avenx compiler. Avenx registers components by scanning src/components for .component.js files and normalizing their filenames.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
projectRoot |
string | ||
componentsDir |
string |
<optional> |
Returns:
fireEvent(element, eventType, detailopt) → {Promise:.<void:>}
Helper to dispatch DOM events synchronously and flush the microtask scheduler.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
Element | Target element to fire event on. |
|
eventType |
string | Type of event (e.g. 'click', 'input', 'change'). |
|
detail |
object |
<optional> |
Event detail or options (e.g. { value: 'foo' }). |
- Source:
Returns:
flushJobs()
Flushes all queued jobs in a loop until the queue is completely empty.
Jobs are strictly ordered by their id property ascending (e.g. component uid)
to ensure parent components update before their child components.
After jobs are flushed, all queued flush callbacks (e.g. nextTick) are executed.
- Source:
flushPromises() → {Promise:.<void:>}
Settles the event loop so pending Promises and timers can complete.
Prefer this over ad-hoc setTimeout chains in unit tests.
- Source:
Returns:
formatBytes(bytes) → {string}
Formats byte counts into human readable strings (e.g. 500 B, 1.25 KB, 2.10 MB).
Parameters:
| Name | Type | Description |
|---|---|---|
bytes |
number | Size in bytes. |
- Source:
Returns:
Formatted size string.
- Type
- string
formatCodeFrame(source, line, column, optionsopt) → {string}
Formats a code frame snippet highlighting an error location with carets (^).
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source |
string | The source code or template content. |
|||||||||||||||||
line |
number | 1-based line number of the error. |
|||||||||||||||||
column |
number | 1-based column offset of the error. |
|||||||||||||||||
options |
object |
<optional> |
Properties
|
Returns:
The formatted visual code frame string.
- Type
- string
formatContextTag(context) → {string}
Formats component context metadata (componentName, fileName) into a diagnostic tag.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
object | Context object or component instance. |
- Source:
Returns:
Formatted context tag string or empty string.
- Type
- string
formatHtmlStringFallback(html) → {string}
Normalizes tag attribute ordering in raw HTML strings without full DOM parsing.
Parameters:
| Name | Type | Description |
|---|---|---|
html |
string |
- Source:
Returns:
- Type
- string
formatMessage(code, …args) → {string}
Formats a message template with arguments for safe non-throwing console reporting.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
code |
string | The AvenxErrorCode identifier. |
|
args |
any |
<repeatable> |
Arguments to format within the template message. |
- Source:
Returns:
The formatted warning message containing the error code and content.
- Type
- string
formatNode(node, depth) → {string}
Formats a DOM node with indentation based on depth.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
Node | |
depth |
number |
- Source:
Returns:
- Type
- string
formatRequestLog(method, url, statusCode, durationMs, dateopt) → {string}
Formats a log line for an incoming HTTP request.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
method |
string | HTTP method (GET, POST, etc.) |
|
url |
string | Request URL path. |
|
statusCode |
number | string | Response HTTP status code. |
|
durationMs |
number | Execution time in milliseconds. |
|
date |
Date |
<optional> |
Timestamp date object. |
- Source:
Returns:
The formatted log string.
- Type
- string
formatStatusCode(status) → {string}
Formats an HTTP response status code with ANSI colors.
Parameters:
| Name | Type | Description |
|---|---|---|
status |
number | string |
- Source:
Returns:
- Type
- string
formatValue(val) → {string}
Formats a value for debug logging output.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
any |
- Source:
Returns:
- Type
- string
generateBridge(cli, name, dryRunopt, forceopt, templateNameopt)
Generates a new Bridge class and template file.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean | object |
<optional> |
|
force |
boolean |
<optional> |
|
templateName |
string | null |
<optional> |
- Source:
generateComponent(cli, name, dryRunopt, forceopt, templateNameopt, withTestopt, noTestopt)
Generates a new component folder and template files, and registers it in main.app.js.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean | object |
<optional> |
|
force |
boolean |
<optional> |
|
templateName |
string | null |
<optional> |
|
withTest |
boolean |
<optional> |
|
noTest |
boolean |
<optional> |
- Source:
generateDiff(expected, received) → {string}
Computes a readable line-by-line diff between expected and received strings.
Parameters:
| Name | Type | Description |
|---|---|---|
expected |
string | |
received |
string |
- Source:
Returns:
- Type
- string
generateGuard(cli, name, dryRunopt, forceopt, templateNameopt)
Generates a new Guard class and template file.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean | object |
<optional> |
|
force |
boolean |
<optional> |
|
templateName |
string | null |
<optional> |
- Source:
generatePage(cli, name, dryRunopt, forceopt, templateNameopt)
Generates a new Page class and template files.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
name |
string | ||
dryRun |
boolean | object |
<optional> |
|
force |
boolean |
<optional> |
|
templateName |
string | null |
<optional> |
- Source:
generateTemplateSourceMap(filePath, originalCode, compiledCode, optionsopt) → {object}
Generates a Source Map v3 object mapping compiled JavaScript lines to original template source lines.
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
filePath |
string | File path of the source template (.html, .avx, .component.js, .page.js). |
|||||||||
originalCode |
string | Raw template source code. |
|||||||||
compiledCode |
string | Compiled and wrapped ES module JavaScript code. |
|||||||||
options |
object |
<optional> |
Properties
|
- Source:
Returns:
Source Map v3 compliant object.
- Type
- object
get(target, key) → {any}
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The scope. |
key |
string | symbol | The name to read. |
- Source:
Returns:
The bound value.
- Type
- any
get(t, key) → {any}
Intercepts property retrieval.
Parameters:
| Name | Type | Description |
|---|---|---|
t |
object | The target object. |
key |
string | symbol | The property name. |
- Source:
Returns:
- Type
- any
getActiveCausationTrace() → {Array:.<string:>}
Returns the current active causation trace for diagnostics.
- Source:
Returns:
getAllFiles(dir) → {Array:.<string:>}
Recursively gets all files in a directory.
Parameters:
| Name | Type | Description |
|---|---|---|
dir |
string |
- Source:
Returns:
getClosestKey(key, allowedKeys) → {string|null}
Returns the closest match from allowedKeys based on Levenshtein distance, if it is within a threshold.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | |
allowedKeys |
Array:.<string:> |
- Source:
Returns:
- Type
- string | null
getComponentProfilingInfo(element) → {Object}
Searches the DOM tree upwards from an element to find the nearest Avenx component. Returns profiling status and the component name.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
Element | null | The DOM element. |
- Source:
Returns:
- Type
- Object
getCustomVoidTags(filePathopt) → {Array:.<string:>}
Resolves the list of project-specific void tags declared in
avenx.config.json (via a voidTags array) for the given component
file, e.g.:
{ "voidTags": ["my-video", "my-icon"] }
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
filePath |
string |
<optional> |
Absolute path of the component file being compiled. |
- Source:
Returns:
Lowercased, trimmed custom void tag names. Empty if none configured.
getDiagnostic(code) → {object|null}
Looks up an entry from the catalogue.
Parameters:
| Name | Type | Description |
|---|---|---|
code |
string |
Returns:
- Type
- object | null
getFieldName(el) → {string}
Extracts field name from an HTML element.
Parameters:
| Name | Type | Description |
|---|---|---|
el |
Element |
- Source:
Returns:
- Type
- string
getHTML(el) → {string}
Recursively serializes a DOM element to HTML.
Parameters:
| Name | Type | Description |
|---|---|---|
el |
Element | object | Element to serialize. |
- Source:
Returns:
Serialized HTML string.
- Type
- string
getInitialHtml(cli) → {string}
Generates the default index.html template content.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object |
- Source:
Returns:
The initial HTML template string.
- Type
- string
getInspectorData(app) → {object}
Collects all active component instances and application registration metadata.
Parameters:
| Name | Type | Description |
|---|---|---|
app |
object | The AvenxApp instance. |
- Source:
Returns:
Inspector data payload.
- Type
- object
getInspectorHtml(cli) → {string}
Generates the Dev Server Inspection Dashboard HTML page.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object |
- Source:
Returns:
The dashboard HTML content.
- Type
- string
getLineAndColumn(source, index) → {Object}
Computes 1-based line and column coordinates from a character index in a source string.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source code or template string. |
index |
number | Character offset. |
Returns:
- Type
- Object
getObsoleteSnapshots(testFile) → {Array:.<string:>}
Returns any snapshots found in the file that were not executed during the test suite.
Parameters:
| Name | Type | Description |
|---|---|---|
testFile |
string |
- Source:
Returns:
getOrCreateLiveRegion() → {HTMLElement|null}
Creates or retrieves the singleton visually hidden aria-live region.
Returns:
- Type
- HTMLElement | null
getOwnPropertyDescriptor(t, key) → {object}
Intercepts getOwnPropertyDescriptor check.
Parameters:
| Name | Type | Description |
|---|---|---|
t |
object | The target. |
key |
string | symbol | The property. |
- Source:
Returns:
- Type
- object
getPropertyPath(target, key) → {string}
Constructs the full property path from a target object and key using parentMap.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | |
key |
string | symbol |
- Source:
Returns:
- Type
- string
getPrototypeOf() → {object}
Intercepts getPrototypeOf check.
- Source:
Returns:
- Type
- object
getSchedulerMaxFlushCount() → {number}
Returns the currently configured maximum flush cycle count.
- Source:
Returns:
- Type
- number
getScope() → {DisposalScope|null}
Returns the scope that currently owns new teardown callbacks.
- Source:
Returns:
The active scope, or null outside of one.
- Type
- DisposalScope | null
getSequence(arr) → {Array:.<number:>}
Calculates the Longest Increasing Subsequence (LIS) of an array of numbers.
Returns an array of indices of the LIS in arr.
Uses binary search + parent tracking for O(N log N) complexity.
Parameters:
| Name | Type | Description |
|---|---|---|
arr |
Array:.<number:> |
- Source:
Returns:
Array of indices in arr that form the LIS.
getTimestamp() → {string}
Helper to get formatted local time string for timestamps (HH:MM:SS format).
- Source:
Returns:
- Type
- string
getTransitionDuration(el) → {number}
Helper to compute transition/animation duration from element computed styles.
Parameters:
| Name | Type | Description |
|---|---|---|
el |
Element |
- Source:
Returns:
duration in ms
- Type
- number
handleDeadlock(triggeringJobIdopt)
Handles a detected reactive deadlock: logs diagnostics, notifies handlers, and purges the queue.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
triggeringJobId |
any |
<optional> |
The job ID that triggered the cycle. |
- Source:
has(slotNameopt) → {boolean}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
slotName |
string |
<optional> |
Named slot, or |
Returns:
- Type
- boolean
has(target, key) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The scope. |
key |
string | symbol | The name to test. |
- Source:
Returns:
Whether either layer binds it.
- Type
- boolean
has(t, key) → {boolean}
Intercepts has check, claiming to have all properties to capture lookups in with.
Parameters:
| Name | Type | Description |
|---|---|---|
t |
object | The target object. |
key |
string | symbol | The property checked. |
- Source:
Returns:
- Type
- boolean
hasDependentOnPath(target, key) → {boolean}
Whether anything depends on a key, or on the path that reaches it.
A dependency may be recorded at any level: a template reading cart.items
registers against items on the root target, while a write to
cart.items[0].qty lands on the element object. Walking up parentMap is
what connects the two.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The raw target that changed. |
key |
string | symbol | Array:.<(string:|symbol:)> | The key or keys that changed. |
Returns:
True when some watcher depends on the change.
- Type
- boolean
hasDirectivesHelper(el) → {boolean}
Helper to check if an element or its descendants have custom directives.
Parameters:
| Name | Type | Description |
|---|---|---|
el |
Element |
- Source:
Returns:
- Type
- boolean
html(strings, …values) → {SafeHtml}
Creates a SafeHtml wrapper for raw HTML insertion. Can be used as a standard function: html('
unsafe
') or as a tagged template literal: html<p>${unsafe}</p>
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
strings |
string | TemplateStringsArray | ||
values |
any |
<repeatable> |
- Source:
Returns:
- Type
- SafeHtml
initInspector(app)
Initializes the inspector for an AvenxApp.
Parameters:
| Name | Type | Description |
|---|---|---|
app |
object | The AvenxApp instance. |
- Source:
initProject(cli, argsopt)
Initializes a new Avenx project structure.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | AvenxCLI instance. |
|
args |
Array:.<string:> |
<optional> |
CLI arguments. |
- Source:
interpolateEnv(val) → {*}
Recursively traverses string values in an object/array/value and replaces $VAR_NAME or ${VAR_NAME} placeholders with process.env.VAR_NAME values.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
* |
- Source:
Returns:
- Type
- *
isBooleanAttribute(name) → {boolean}
Checks if a given attribute name is a standard HTML boolean attribute.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The attribute name. |
- Source:
Returns:
True if it is a boolean attribute.
- Type
- boolean
isBridge(value) → {boolean}
Reports whether a value is a bridge instance created by bridge.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value to test. |
- Source:
Returns:
True when the value is a bridge instance.
- Type
- boolean
isColorEnabled() → {boolean}
Reports whether styling helpers currently emit ANSI escape codes.
- Source:
Returns:
- Type
- boolean
isDebugReactivityEnabled() → {boolean}
Returns whether debug reactivity logging is currently enabled.
- Source:
Returns:
- Type
- boolean
isDeniedProjectPath(root, filePath) → {boolean}
Returns true when a resolved path should not be served from the project root. Dot segments, node_modules, and package manifests are refused after containment.
Parameters:
| Name | Type | Description |
|---|---|---|
root |
string | |
filePath |
string |
- Source:
Returns:
- Type
- boolean
isInsideRoot(root, target) → {boolean}
Checks whether a resolved path is the project root itself or sits beneath it.
Parameters:
| Name | Type | Description |
|---|---|---|
root |
string | Absolute, resolved project root. |
target |
string | Absolute, resolved candidate path. |
- Source:
Returns:
- Type
- boolean
isReactive(value) → {boolean}
Returns true when value is an Avenx reactive proxy.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any |
- Source:
Returns:
- Type
- boolean
isReactiveTarget(value) → {boolean}
Checks if the value is a candidate for reactive wrapping. We restrict this to plain objects and arrays to avoid issues with built-in classes (Date, RegExp, Map, Set, Promise) and custom class instances that may contain private fields or internal slots.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value to check. |
- Source:
Returns:
True if the value should be reactive, false otherwise.
- Type
- boolean
isRestrictedGlobal(key) → {boolean}
Determines whether a property key refers to a restricted global object.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | symbol | Property key to check. |
- Source:
Returns:
- Type
- boolean
isSafeUrl(url, tagName, allowDataUrlsopt) → {boolean}
Validates whether a URL attribute contains safe content.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
url |
string | The URL string. |
||
tagName |
string | The name of the HTML tag containing the URL. |
||
allowDataUrls |
boolean |
<optional> |
true | Whether data: URLs are allowed for img tags. |
- Source:
Returns:
True if the URL is safe.
- Type
- boolean
isStaticNode(node) → {boolean}
Recursively determines if a node (and all its descendants) are completely static.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
HTMLNode |
- Source:
Returns:
- Type
- boolean
isUnused(model, node) → {boolean}
Whether anything in the application renders or imports a component.
A page is never reported unused: it is reached by a route, or it is an entry point the router has simply not been pointed at yet.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
node |
object | A component node. |
- Source:
Returns:
True when nothing reaches it.
- Type
- boolean
levenshtein(a, b) → {number}
Computes the Levenshtein distance between two strings.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
string | |
b |
string |
- Source:
Returns:
- Type
- number
listenWithPortFallback(server, requestedPort, host, onListening)
Listens on the requested port, incrementing it when the address is occupied.
Parameters:
| Name | Type | Description |
|---|---|---|
server |
object | |
requestedPort |
number | string | |
host |
string | |
onListening |
function |
- Source:
loadAvenxConfig(startDir) → {object|null}
Walks up the directory tree from startDir looking for an
avenx.config.json file, and returns its parsed contents (or null if
none is found, or if it fails to parse).
Parameters:
| Name | Type | Description |
|---|---|---|
startDir |
string | Absolute directory to start searching from. |
- Source:
Returns:
- Type
- object | null
loadConfig(baseDiropt)
Load the Avenx configuration from avenx.config.json file.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
baseDir |
string |
<optional> |
The base directory of the project. |
- Source:
loadEnv(rootDir)
Loads environment variables from the .env file in rootDir into process.env.
Does not overwrite existing environment variables.
Parameters:
| Name | Type | Description |
|---|---|---|
rootDir |
string |
- Source:
loadSidecar(cli) → {object|null}
Loads the build's source-location sidecar, when one has been produced.
Annotation happens on read rather than on record: a trace stays a record of what happened, and the mapping from an action name to a file and a line is a property of the build it came from, not of the session.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
- Source:
Returns:
The sidecar, or null when the project has not been built.
- Type
- object | null
manageFocus(container, focusTargetSelectoropt)
Moves focus to the new page container or configured target. Applies tabindex="-1" if needed so non-focusable elements can receive focus.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
container |
HTMLElement | null | The mounted page root element. |
|
focusTargetSelector |
string |
<optional> |
Optional custom selector. |
markRaw(target) → {T}
Marks an object so it will not be wrapped by reactive proxies.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
T |
- Source:
Returns:
- Type
- T
mask(value) → {string}
Masks text while preserving line positions.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string |
Returns:
- Type
- string
maskSecret(value) → {string}
Masks a secret value for display (e.g. secr****).
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string |
- Source:
Returns:
- Type
- string
memberBodySpan(source, valueStart) → {Object|null}
Locates the body of a member declared as a function.
An action (addQty(id, n) { ... }) and a getter (get total() { ... })
both put their code between the brace that follows their parameter list and
its match. Atlas reads those bodies to record what a bridge action writes
and what a getter reads; without a span it would have to re-parse the module.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
valueStart |
number | Offset of the member's name. |
- Source:
Returns:
The body's inner span, exclusive of the braces, or null when the member has no function body.
- Type
- Object | null
memberParams(source, bodyStart) → {string}
Reads a member's parameter list.
Slicing from the member name to the body and taking everything between the
first ( and the last ) works for addQty(id, n) {, and breaks the
moment a wrapper puts a paren in front of it: for
addQty: atomic(function (id, n) { it yields function (id, n. Scanning
backwards from the body brace instead finds the same parameter list in
every shape, wrapper or not, including an arrow's.
Parameters matter more than they look. addBridgeUnit hands them to the
analyser as locals; without them every parameter reads as an unknown
identifier, and an unknown identifier blocks a diagnostic.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
bodyStart |
number | Offset just inside the body's |
- Source:
Returns:
The parameter text, without its parentheses. Empty when the member takes no parameters.
- Type
- string
mountTestComponent(ComponentClass, optionsopt) → {Promise:.<{instance:: object:, element:: Element:, container:: Element:, unmount:: function(), html:: string:}>}
Instantiates, mounts, and returns the component instance and target DOM element for testing.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ComponentClass |
function | Component class to mount. |
|||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Mounting options. Properties
|
- Source:
Returns:
- Type
- Promise:.<{instance:: object:, element:: Element:, container:: Element:, unmount:: function(), html:: string:}>
nextTick(callbackopt) → {Promise:.<void:>|void}
Executes a callback (or resolves a Promise) after all currently queued jobs in the scheduler queue have finished flushing.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
function |
<optional> |
Optional callback to invoke after the flush. |
- Source:
Returns:
A promise resolving after the flush, if no callback was given.
normalizeCode(code) → {string}
Normalizes input code string to standard format (e.g. 'c01', 'avx_c01' -> 'AVX_C01').
Parameters:
| Name | Type | Description |
|---|---|---|
code |
string |
Returns:
- Type
- string
numericFlag(args, name, fallback) → {number}
Reads a numeric flag such as --depth=4 or --depth 4.
Parameters:
| Name | Type | Description |
|---|---|---|
args |
Array:.<string:> | CLI arguments. |
name |
string | The flag name, without dashes. |
fallback |
number | The value to use when absent. |
- Source:
Returns:
The parsed value.
- Type
- number
onSchedulerDeadlock(handler) → {function}
Registers a global callback for scheduler deadlock events.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
- Source:
Returns:
Unsubscribe function.
- Type
- function
onScopeDispose(disposer) → {function}
Registers a teardown callback with the active scope, if there is one.
Parameters:
| Name | Type | Description |
|---|---|---|
disposer |
function | The teardown callback. |
- Source:
Returns:
A release function that runs the teardown at most once.
- Type
- function
openBrowser(url)
Opens the browser to the specified URL.
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string |
- Source:
pad(value, width) → {string}
Pads a string to a fixed width for table-like output.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | |
width |
number |
- Source:
Returns:
- Type
- string
pad(value, width) → {string}
Pads a cell to a column width.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | The cell text. |
width |
number | Target width. |
- Source:
Returns:
The padded cell.
- Type
- string
parseDiagnostic(severity, args) → {object}
Parses raw diagnostic inputs into a structured object.
Parameters:
| Name | Type | Description |
|---|---|---|
severity |
string | 'warning' or 'error' |
args |
Array:.<any:> | Log or error arguments |
- Source:
Returns:
Diagnostic object
- Type
- object
parseEnv(src) → {Object}
Parses the content of a .env file and returns an object of key-value pairs. Matches dotenv behavior including single/double quotes and inline comments.
Parameters:
| Name | Type | Description |
|---|---|---|
src |
string | Buffer |
- Source:
Returns:
- Type
- Object
parseImports(source) → {Array:.<{statement:: string:, specifier:: string:, defaultName:: (string:|null:), named:: Array:.<string:>}>}
Parses the import statements of a module.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
- Source:
Returns:
One entry per import statement.
- Type
- Array:.<{statement:: string:, specifier:: string:, defaultName:: (string:|null:), named:: Array:.<string:>}>
parseMember(segment) → {Object|null}
Reads the member name that starts a top-level object-literal entry.
Parameters:
| Name | Type | Description |
|---|---|---|
segment |
string | Source of one entry, starting after |
- Source:
Returns:
The parsed member, or null when the segment is not a recognisable declaration.
- Type
- Object | null
parseName(inputName) → {Object}
Helper to parse input names into PascalCase and kebab-case. Supports camelCase, kebab-case, snake_case, and PascalCase.
Parameters:
| Name | Type | Description |
|---|---|---|
inputName |
string | The input name from CLI. |
- Source:
Returns:
- Type
- Object
parseObjectMembers(source, openIndex) → {Object}
Splits the top level of an object literal into member declarations.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The full source text. |
openIndex |
number | Index of the literal's opening |
- Source:
Returns:
The declared members and the index of the closing brace.
- Type
- Object
parseValidationRules(ruleString) → {Array:.<{name:: string:, arg:: (string:|null:), customMsg:: (string:|null:)}>}
Parses a data-ax-validate rule string (e.g. "required|email|min:8").
Parameters:
| Name | Type | Description |
|---|---|---|
ruleString |
string | Raw directive value. |
- Source:
Returns:
popWatcher()
Pops the active watcher context from the stack.
- Source:
positional(args) → {string|null}
The first positional argument, ignoring flags and their values.
Parameters:
| Name | Type | Description |
|---|---|---|
args |
Array:.<string:> | CLI arguments. |
- Source:
Returns:
The symbol, or null.
- Type
- string | null
printCheck(status, message, hintopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
status |
'pass' | 'warn' | 'fail' | ||
message |
string | ||
hint |
string |
<optional> |
- Source:
printHelp()
Prints the help message with available commands to the console.
- Source:
printNoTraces()
Prints the message shown when a project has no traces yet.
- Source:
printTree(model, entry, prefix) → {void}
Renders a traversal as an indented tree.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
entry |
object | A tree entry from |
prefix |
string | The accumulated indent. |
- Source:
Returns:
- Type
- void
printUnresolved(entries) → {void}
Prints the unresolved entries that bear on a query's answer.
Always printed, even when empty, because "0 unresolved" is the part of the answer that says how much of it to trust.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array:.<object:> | Relevant unresolved entries. |
- Source:
Returns:
- Type
- void
processBindDirectives(template) → {string}
Processes data-ax-bind attributes on input, textarea, and select elements. Converts data-ax-bind="expr" to value="{{ expr }}" and event listener.
Parameters:
| Name | Type | Description |
|---|---|---|
template |
string | The template string. |
- Source:
Returns:
The processed template.
- Type
- string
profile(enableProfiling, componentName, phase, fn) → {any}
Wraps an execution block with performance marks and measures.
Parameters:
| Name | Type | Description |
|---|---|---|
enableProfiling |
boolean | Whether profiling is enabled. |
componentName |
string | Name of the component. |
phase |
string | The phase being profiled (e.g. 'mount', 'patch', 'render', 'onMount'). |
fn |
function | The function/callback to execute. |
- Source:
Returns:
The result of the callback.
- Type
- any
promptQuestion(query, defaultValueopt, validatoropt) → {Promise:.<string:>}
Prompts the user with a question on the command line.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
query |
string | The question query. |
|
defaultValue |
string |
<optional> |
The default response. |
validator |
function |
<optional> |
Optional function validating input. |
- Source:
Returns:
pushWatcher(watcher)
Pushes a watcher onto the active evaluation context stack.
Parameters:
| Name | Type | Description |
|---|---|---|
watcher |
AvenxWatcher | The watcher instance to run. |
- Source:
queueFlush()
Schedules a flush cycle in a deferred microtask.
- Source:
queueFlushCallback(cb)
Queues a callback to run after the current flush cycle has finished.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
function | The callback to run. |
- Source:
queueJob(job)
Queues a job (update callback) to be executed in the next microtask. Deduplicates multiple calls to the same job.
Parameters:
| Name | Type | Description |
|---|---|---|
job |
function | The callback to run. |
- Source:
readDeclarations(content) → {DeclarationSet}
Returns the declaration set for a source, scanning it at most once.
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | The component source. |
- Source:
Returns:
The declarations.
- Type
- DeclarationSet
readEnvFileMeta(rootDir) → {Object}
Reads .env keys that were defined in the project file (if present).
Parameters:
| Name | Type | Description |
|---|---|---|
rootDir |
string |
- Source:
Returns:
- Type
- Object
readTemplate(baseDir, config, frameworkDir, subfolder, filename, templateNameopt) → {string}
Reads a template, checking custom template overrides in templatesDir and templates/ folder first.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
baseDir |
string | ||
config |
object | ||
frameworkDir |
string | ||
subfolder |
string | ||
filename |
string | ||
templateName |
string | null |
<optional> |
- Source:
Returns:
- Type
- string
registerInMainApp(cli, className, folderName)
Automatically adds import and registration for a component in src/main.app.js.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | |
className |
string | |
folderName |
string |
- Source:
replaceEnvVariables(content) → {string}
Replaces process.env.AVX_PUBLIC_... occurrences in the content with their stringified values from process.env.
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string |
- Source:
Returns:
- Type
- string
reportAmbiguous(model, query, matches) → {void}
Prints the candidates for an ambiguous or unknown symbol.
Guessing would be worse than asking: impact items on a project with three
of them should say which three, not silently pick one.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
query |
string | What was typed. |
matches |
Array:.<object:> | The candidates. |
- Source:
Returns:
- Type
- void
reportFatal(error, actionopt)
Reports a fatal error and marks the process as failed.
Errors carrying an Avenx code (AVX_C03, AVX_W03 and friends) are diagnosed conditions: the message already names the file, explains the problem and often carries a code frame, so it is printed on its own. A stack trace there would only point at the line of the compiler that raised it.
Anything else is a bug rather than a diagnosis, so the stack is printed — that is the only useful information such an error carries.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
error |
Error | any | The failure. |
|
action |
string |
<optional> |
What was being attempted, for the headline. |
- Source:
reportRebuildFailure(error)
Reports a failed rebuild inside a watch loop.
A watch session is interactive and long-running: the next save usually fixes the problem. So the error is shown and watching continues, and crucially the process exit code is left alone — a typo at 11am must not make the eventual Ctrl-C report failure.
This is the one place a build error does not fail the process, and it is
safe precisely because avenx serve and avenx watch never gate a
deployment. avenx build is unaffected.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
Error | any | The failure. |
- Source:
reportWarning(code, errOrMessage, configopt, locationopt)
Reports a compiler warning according to configured warning severities.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
code |
string | Avenx error/warning code (e.g. 'AVX_W03'). |
|
errOrMessage |
string | Error | An Error object or formatted warning message string. |
|
config |
object |
<optional> |
The application configuration object containing |
location |
object |
<optional> |
Location metadata { line, column, source, filename, index, length }. |
resetScheduler()
Resets the scheduler state (primarily used in testing).
- Source:
resolveBridgeSpecifier(fromFile, specifier) → {string|null}
Resolves a relative import specifier to a bridge module path, if it is one.
Parameters:
| Name | Type | Description |
|---|---|---|
fromFile |
string | The importing file. |
specifier |
string | The import specifier. |
- Source:
Returns:
Absolute path to the .bridge.js file, or null.
- Type
- string | null
resolveCallingTestFile() → {string|null}
Resolves the caller test file path using stack traces.
- Source:
Returns:
- Type
- string | null
resolveComponentsDir(projectRoot, componentsDiropt) → {string}
Resolves the configured Avenx components directory.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
projectRoot |
string | ||
componentsDir |
string |
<optional> |
Returns:
- Type
- string
resolveDoctorRoot(cli) → {string}
Prefer an explicit app/framework root over findProjectRoot skipping avenx-core.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object |
- Source:
Returns:
- Type
- string
resolveMode(config) → {'production'|'development'}
Resolves the build mode from configuration and environment.
Production is the default so that a plain avenx build — what a deploy
script runs — produces optimised output. Development has to be asked for,
by avenx build --dev, by mode/dev in avenx.config.json, or by
NODE_ENV.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
object | The resolved compiler configuration. |
- Source:
Returns:
The active mode.
- Type
- 'production' | 'development'
resolvePathAlias(importPath, configopt, rootDiropt) → {string}
Resolves a path alias (e.g., "@/components/Header") to its absolute or root-relative path.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
importPath |
string | The import string to resolve. |
|
config |
object |
<optional> |
The parsed Avenx config object. |
rootDir |
string |
<optional> |
The root project directory. |
- Source:
Returns:
The resolved file path or original string if no alias matched.
- Type
- string
resolveRequestPath(baseDir, requestUrl) → {string|null}
Resolves an incoming request URL to a file path inside the project directory.
The request target is parsed as a URL so query strings and fragments never
leak into the filesystem path, percent-encoding is decoded before the
containment check, and the resolved path is required to stay within the
project root. Node does not normalize req.url, so .. segments would
otherwise be resolved by path.join and escape the project directory.
Parameters:
| Name | Type | Description |
|---|---|---|
baseDir |
string | The project root directory. |
requestUrl |
string | The raw request target from |
- Source:
Returns:
An absolute path inside the project, or null when the request is malformed or attempts to escape the root.
- Type
- string | null
resourceBodies(resources) → {Object:.<string:, string:>}
The executable source of each declared resource, keyed by name.
A resource is emitted either as a bare handler string or as
{ handler, pollInterval }, and the runtime prefixes a bare expression with
return. Both shapes are normalised here so the generator sees exactly the
text the runtime will execute -- otherwise a polling resource would compile
against a string that is not what runs, and quietly miss.
Parameters:
| Name | Type | Description |
|---|---|---|
resources |
object | The parsed resource declarations. |
- Source:
Returns:
Handler sources by resource name.
runAtlas(cli, argsopt) → {void}
Executes avenx atlas — an overview of the application model.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | The AvenxCLI instance. |
|
args |
Array:.<string:> |
<optional> |
CLI arguments. |
- Source:
Returns:
- Type
- void
runCheckPass(cli, argsopt) → {Object}
Runs a single template check pass and returns structured results.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | AvenxCLI instance containing config and baseDir. |
|
args |
Array:.<string:> |
<optional> |
Command line arguments. |
- Source:
Returns:
- Type
- Object
runDoctor(cli)
Runs environment and project health diagnostics.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object |
- Source:
runEnv(cli)
Prints active environment configuration (public vs private).
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
Object |
- Source:
runHook(phase, command, baseDir)
Runs a configured lifecycle hook.
A hook is part of the build, so a non-zero exit from one fails the build. execSync throws a generic "Command failed" error; it is re-thrown as a coded BuildError so the reason is legible and the CLI can render it like any other build failure.
Parameters:
| Name | Type | Description |
|---|---|---|
phase |
string | 'prebuild' or 'postbuild'. |
command |
string | The shell command to run. |
baseDir |
string | Working directory for the hook. |
- Source:
Throws:
-
When the hook exits non-zero.
- Type
- BuildError
runInScope(scope, fn) → {T}
Runs a function with the given scope active, restoring the previous scope
afterwards. Passing null deliberately detaches ownership, which is how
long-lived work (such as a bridge setup()) avoids being torn down by
whichever component happened to touch it first.
Parameters:
| Name | Type | Description |
|---|---|---|
scope |
DisposalScope | null | The scope to activate. |
fn |
function | The function to run. |
- Source:
Returns:
Whatever fn returned.
- Type
- T
runInspect(cli) → {void}
Prints the project's page, component and bridge hierarchy.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The AvenxCLI instance. |
- Source:
Returns:
- Type
- void
runQuery(cli, args, direction) → {void}
Executes avenx impact <symbol> and avenx why <symbol>.
One implementation because they are one traversal in opposite directions: impact follows edges into a node, why follows edges out of it.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The AvenxCLI instance. |
args |
Array:.<string:> | CLI arguments. |
direction |
'in' | 'out' | Which way to walk. |
- Source:
Returns:
- Type
- void
runStats(cli, argsopt)
Runs the avenx stats CLI command to output footprint metrics in text or JSON format.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | AvenxCLI instance. |
|
args |
Array:.<string:> |
<optional> |
Command arguments. |
- Source:
runTrace(cli, args)
Dispatches an avenx trace <sub> invocation.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
args |
Array:.<string:> | Everything after |
- Source:
runWizard(argsopt) → {Promise:.<{stylePreprocessor:: string:, layoutTemplate:: string:, isInteractive:: boolean:}>}
Runs the interactive project wizard prompts if interactive mode is enabled.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
Array:.<string:> |
<optional> |
CLI arguments. |
- Source:
Returns:
sanitizeUrlsIn(root)
Applies the URL policy to every URL-bearing attribute in a parsed tree.
Parameters:
| Name | Type | Description |
|---|---|---|
root |
Element | The root of the freshly parsed render output. |
- Source:
scanObjectLiteral(source, openIndex) → {Object}
Walks source from an opening brace to its match, ignoring braces that appear inside strings, template literals or comments.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text. |
openIndex |
number | Index of the opening |
- Source:
Returns:
The index of the matching
} (or -1) and the offsets of commas at depth 1.
- Type
- Object
scopeCustomProperties(cssContent, hash) → {string}
Scopes custom CSS properties (variables) defined within a component's stylesheet.
Rewrites custom property declarations (e.g. --primary: red;) and usages (e.g. var(--primary))
by appending the component's unique hash (e.g. --ax-
Parameters:
| Name | Type | Description |
|---|---|---|
cssContent |
string | The CSS content (with comments stripped). |
hash |
string | The component scope hash (e.g. 'avenx-12345678'). |
- Source:
Returns:
The CSS content with scoped custom properties.
- Type
- string
scopeSelectorList(selectorList, hash) → {string}
Applies a component hash to each selector in a selector list. Commas inside functions, attribute selectors, strings, and escapes are not selector delimiters and must be preserved.
Parameters:
| Name | Type | Description |
|---|---|---|
selectorList |
string | The CSS selector list. |
hash |
string | The component scope hash. |
- Source:
Returns:
The scoped selector list.
- Type
- string
serializeSafe(val, seenopt) → {*}
Recursively clones an object and strips non-cloneable elements (like functions, circular references, and DOM nodes).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
val |
* | The value to sanitize. |
|
seen |
WeakSet:.<object:> |
<optional> |
WeakSet tracking visited objects to prevent circular loops. |
- Source:
Returns:
The safe clone.
- Type
- *
serializeSnapshot(input, optionsopt) → {string}
Normalizes and formats DOM nodes or raw HTML strings into stable, deterministic markup. Sorts attributes alphabetically, trims whitespace, and applies mask rules for volatile data.
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
input |
Element | string | any | ||||||||||
options |
object |
<optional> |
Properties
|
- Source:
Returns:
- Type
- string
serveProject(cli, port, hostopt, openopt)
Starts a local development server and watches for changes.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
port |
number | string | ||
host |
string |
<optional> |
|
open |
boolean |
<optional> |
- Source:
set(target, key, value) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The scope. |
key |
string | symbol | The name to write. |
value |
any | The value to assign. |
- Source:
Returns:
Always true.
- Type
- boolean
set(t, key, value) → {boolean}
Intercepts property assignment.
Parameters:
| Name | Type | Description |
|---|---|---|
t |
object | The target object. |
key |
string | symbol | The property name. |
value |
any | The new value. |
- Source:
Returns:
- Type
- boolean
setColorEnabled(valueopt) → {boolean}
Overrides color support, mainly for tests and explicit CLI flags. Call without arguments to re-run the automatic detection.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
boolean |
<optional> |
Force enable (true) or disable (false). |
- Source:
Returns:
The resolved state.
- Type
- boolean
setDebugReactivity(enabled)
Programmatically enables or disables debug reactivity logging.
Parameters:
| Name | Type | Description |
|---|---|---|
enabled |
boolean |
- Source:
setSchedulerMaxFlushCount(count)
Configures the maximum allowed flush cycle count.
Parameters:
| Name | Type | Description |
|---|---|---|
count |
number | Maximum flush iterations. |
- Source:
sharedParser() → {DOMParser}
Returns the shared DOMParser, creating it on first use.
- Source:
Returns:
The parser.
- Type
- DOMParser
shouldGenerateTest(cli, withTestFlagopt, noTestFlagopt) → {boolean}
Checks if test generation is enabled via CLI flag or avenx config.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cli |
object | ||
withTestFlag |
boolean |
<optional> |
|
noTestFlag |
boolean |
<optional> |
- Source:
Returns:
- Type
- boolean
stripAnsi(str) → {string}
Strips ANSI color escape codes from a message string.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string |
- Source:
Returns:
- Type
- string
stripCssComments(css) → {string}
Strips CSS comments (/* ... */) from a CSS string, taking care not to touch comments within quoted strings.
Parameters:
| Name | Type | Description |
|---|---|---|
css |
string | The CSS string. |
- Source:
Returns:
The CSS string without comments.
- Type
- string
style(open, close) → {function}
Builds a styling function for an ANSI open/close code pair.
Closing with the attribute-specific reset (instead of a full reset) keeps
nested styles such as bold(cyan('text')) intact.
Parameters:
| Name | Type | Description |
|---|---|---|
open |
number | The ANSI code that enables the style. |
close |
number | The ANSI code that disables just that style. |
- Source:
Returns:
The styling function.
- Type
- function
suggestCodes(inputCode) → {Array:.<string:>}
Suggests near matches for an unknown code.
Parameters:
| Name | Type | Description |
|---|---|---|
inputCode |
string |
Returns:
suggestName(name, known) → {string}
Suggests the closest known name for a mistyped one, using edit distance.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The unknown name. |
known |
Array:.<string:> | Candidate names. |
- Source:
Returns:
A " Did you mean ...?" fragment, or an empty string.
- Type
- string
toPascalCase(str) → {string}
Converts a string to PascalCase.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string |
- Source:
Returns:
- Type
- string
toRaw(target) → {any}
Returns the underlying raw object for a reactive proxy.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
any |
- Source:
Returns:
- Type
- any
traceExport(cli, id, args)
avenx trace export — writes a runnable regression test for a trace.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
id |
string | The trace id, or |
args |
Array:.<string:> | Command arguments. |
- Source:
traceList(cli, args)
avenx trace list — shows stored traces, newest first.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
args |
Array:.<string:> | Command arguments. |
- Source:
tracePrune(cli, args)
avenx trace prune — removes stored traces.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
args |
Array:.<string:> | Command arguments. |
- Source:
traceView(cli, id, args)
avenx trace view — prints one trace as a causal tree.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | The CLI instance. |
id |
string | The trace id, or |
args |
Array:.<string:> | Command arguments. |
- Source:
track(target, key)
Tracks a property access on a target, establishing a dependency relationship.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The raw reactive target object. |
key |
string | The property key accessed. |
- Source:
transformDeepSelectors(selector) → {string}
Transforms deep CSS pseudo-selectors (:deep(...) / ::v-deep(...) / ::v-deep / :deep) into standard scoped selectors by removing the deep pseudo-selector wrappers/keywords.
Parameters:
| Name | Type | Description |
|---|---|---|
selector |
string | The CSS selector string. |
- Source:
Returns:
The transformed selector string.
- Type
- string
traverse(value, seenopt)
Recursively traverses a reactive value to register deep dependencies.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
any | ||
seen |
Set:.<any:> |
<optional> |
- Source:
trigger(target, key, oldValueopt, newValueopt)
Triggers all watchers registered to a mutated property, and propagates to parent nodes.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
target |
object | The raw target where mutation occurred. |
|
key |
string | The property key mutated. |
|
oldValue |
any |
<optional> |
Previous value before mutation. |
newValue |
any |
<optional> |
New value after mutation. |
- Source:
unescapeHtml(value) → {string}
Reverses HTML entity encoding for strings containing entities like &, <, >, ", and '.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value to unescape. |
- Source:
Returns:
The unescaped string.
- Type
- string
unescapeTemplate(html) → {string}
Restores escaped template expressions from {% %} back to {{ }}.
Parameters:
| Name | Type | Description |
|---|---|---|
html |
string |
Returns:
- Type
- string
unescapeTemplateMarkers(text) → {string}
Restores one level of interpolation markers before rendering.
The inverse of escapeTemplateMarkers: {% becomes {{ and {%%
becomes {%, so a nested body keeps exactly the levels its own nesting
requires.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Template text to unescape one level. |
- Source:
Returns:
The unescaped text.
- Type
- string
unregisterFromMainApp(cli, className, folderName)
Automatically removes imports, registrations, and mount statements for a class from src/main.app.js.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object | |
className |
string | |
folderName |
string |
- Source:
untracked(fn) → {T}
Runs a function outside of any reactive watcher, so reads performed inside it are not attributed to whichever render happened to trigger it.
Parameters:
| Name | Type | Description |
|---|---|---|
fn |
function | The function to run untracked. |
- Source:
Returns:
Whatever fn returned.
- Type
- T
unwrap(val) → {any}
Unwraps a value if it's a sandbox Proxy, returning its raw target object.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
any | The value to unwrap. |
- Source:
Returns:
- Type
- any
unwrapAtomic(source, valueStart) → {number}
Skips past an atomic( wrapper following a member name.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
valueStart |
number | Offset of the member's name. |
- Source:
Returns:
The offset just inside the wrapper's (, or -1 when the
member is not wrapped.
- Type
- number
updateValidationState(state, fieldName, errors)
Initializes or updates component state.$validation structure.
Parameters:
| Name | Type | Description |
|---|---|---|
state |
object | Reactive component state. |
fieldName |
string | Target field name. |
errors |
Array:.<string:> | List of validation errors for field. |
- Source:
validateValue(value, rules, contextopt) → {Array:.<string:>}
Evaluates a field value against parsed rules.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
any | The input value. |
|
rules |
Array:.<{name:: string:, arg:: (string:|null:), customMsg:: (string:|null:)}> | Parsed rules. |
|
context |
object |
<optional> |
Additional scope/context (state, customMessages). |
- Source:
Returns:
Array of validation error messages.
wantsJson(args) → {boolean}
Whether the caller asked for machine-readable output.
Parameters:
| Name | Type | Description |
|---|---|---|
args |
Array:.<string:> | CLI arguments. |
- Source:
Returns:
True for JSON.
- Type
- boolean
warnSanitized(type, value)
Logs a warning whenever elements have their content stripped.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The type of warning ('tag' or 'attribute'). |
value |
string | The name of the tag or attribute. |
- Source:
warnSanitizedAttribute(attributeName) → {void}
Logs a warning for a sanitized HTML attribute.
Parameters:
| Name | Type | Description |
|---|---|---|
attributeName |
string | The sanitized attribute name. |
- Source:
Returns:
- Type
- void
warnSanitizedTag(tagName) → {void}
Logs a warning for a sanitized HTML tag.
Parameters:
| Name | Type | Description |
|---|---|---|
tagName |
string | The sanitized tag name. |
- Source:
Returns:
- Type
- void
watchDirectory(dirPath, callback) → {Object|object}
Cross-platform directory watcher with recursive support fallback. Node 18 on Linux does not support fs.watch(dir, { recursive: true }).
Parameters:
| Name | Type | Description |
|---|---|---|
dirPath |
string | Directory to watch. |
callback |
function | Event callback (eventType, filename). |
- Source:
Returns:
FSWatcher or compatible watcher object with close() method.
- Type
- Object | object
watchEffect(effect, optionsopt) → {function}
Creates an immediate effect watcher that automatically tracks reactive state properties accessed during execution and re-runs on mutation.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
effect |
function | The side-effect function to execute and track. |
|
options |
object |
<optional> |
Configuration options (e.g. debounce, throttle, deep, name). |
- Source:
Returns:
Stop handle function () => watcher.teardown().
- Type
- function
watchProject(cli)
Watches the src directory for changes and triggers a rebuild.
Parameters:
| Name | Type | Description |
|---|---|---|
cli |
object |
- Source:
wrapValue(val) → {any}
Wraps an object or function recursively in a Proxy that blocks prototype pollution and un-proxies arguments/context when called.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
any | The value to wrap. |
- Source:
Returns:
- Type
- any
wrappedFunctionBodySpan(source, from) → {Object|null}
Locates the body brace of a function expression that begins at an offset.
The wrapper accepts every shape a bridge action is written in — function (a, b) {, async function (a) {, (a, b) => {, a => { — so the brace is
found by depth rather than by matching each form. Parentheses and brackets
opened by the parameter list raise the depth, so the first { seen at depth
zero is the body.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The module source. |
from |
number | Where to start scanning. |
- Source:
Returns:
The body's inner span, exclusive of the braces, or null when no body could be located.
- Type
- Object | null
Type Definitions
AvenxErrorCodesType
Registry of unique Avenx error/warning codes.
Type:
- object
Properties:
| Name | Type | Description |
|---|---|---|
COMPILER_DIST_CREATION_FAILED |
string | AVX_C01: Failed to create the build output directory. |
COMPILER_SRC_DIR_MISSING |
string | AVX_C02: The source directory ('src') does not exist. |
MOUNT_TARGET_NOT_FOUND |
string | AVX_R01: The specified target container element was not found in the DOM. |
PAGE_NOT_FOUND |
string | AVX_R02: The requested page class was not registered with the application. |
COMPONENT_NOT_FOUND |
string | AVX_R03: The requested component class was not registered with the application. |
COMPUTED_CIRCULAR_DEPENDENCY |
string | AVX_R04: Circular references/loops detected in active computed property evaluations. |
COMPUTED_EVALUTION_FAILED |
string | AVX_R05: An error occurred during evaluation of a computed property. |
ROUTER_GUARD_DENIED |
string | AVX_R06: A navigation guard explicitly rejected the route transition. |
ROUTER_GUARD_ERROR |
string | AVX_R07: An unhandled exception occurred within a route guard's canActivate method. |
TEMPLATE_RENDER_ERROR |
string | AVX_R08: Failed to interpolate expression values within component template. |
EVENT_HANDLER_ERROR |
string | AVX_R09: Executing an event action callback statement failed. |
ROUTER_GUARD_TIMEOUT |
string | AVX_R14: A navigation guard execution timed out. |
ROUTER_GUARD_UNDEFINED_RETURN |
string | AVX_W27: A navigation guard returned undefined. |
COMPILER_MULTIPLE_STATE_TAGS |
string | AVX_W28: Multiple |
SANDBOX_VIOLATION |
string | AVX_R15: A sandbox security violation occurred. |
STATE_DIRECT_REASSIGNMENT |
string | AVX_R16: Component state was reassigned directly instead of mutated. |
REACTIVE_DEADLOCK_DETECTED |
string | AVX_R18: Circular reactive update chain or deadlock detected. |
COMPILER_DEADLOCK_PARSE_FAILED |
string | AVX_W35: Failed to parse <@deadlock> tags or attributes in template. |
BRIDGE_INVALID_DEFINITION |
string | AVX_R19: bridge() received something other than a definition object. |
BRIDGE_RESERVED_KEY |
string | AVX_R20: A bridge definition declares a key reserved by the Bridge API. |
BRIDGE_INVALID_MEMBER |
string | AVX_R21: A bridge definition declares a top-level value outside of |
BRIDGE_READONLY_STATE |
string | AVX_R22: Bridge state was assigned from outside the bridge. |
BRIDGE_INVALID_EVENT |
string | AVX_R23: A bridge event name or listener has an unusable type. |
BRIDGE_LISTENER_ERROR |
string | AVX_W36: A bridge event listener threw while handling an event. |
BRIDGE_SETUP_FAILED |
string | AVX_R24: A bridge setup() hook threw during lazy initialization. |
TRACE_UNREADABLE |
string | AVX_R25: A trace could not be read by this build. |
TRACE_NOT_DETERMINISTIC |
string | AVX_R26: A best-effort trace was replayed without opting in. |
TRACE_REPLAY_DIVERGED |
string | AVX_R27: Replay did not reproduce the recorded session. |
TRACE_REPLAY_FAILED |
string | AVX_R28: A replay could not be set up. |
TRANSACTION_REWIND_FAILED |
string | AVX_R29: A rewind could not restore every path it journaled. |
COMPONENT_INVALID_NAME |
string | AVX_R30: A component registration received an invalid component name. |
COMPONENT_INVALID_CLASS |
string | AVX_R31: A component registration received an invalid component class. |
EXPRESSION_UNSUPPORTED |
string | AVX_R32: A template expression is outside the supported expression language. |
COMPILER_BRIDGE_NOT_FOUND |
string | AVX_C07: A component imports a bridge module that does not exist. |
COMPILER_BRIDGE_DUPLICATE_NAME |
string | AVX_C08: Two bridge files resolve to the same bridge name. |
COMPILER_BRIDGE_UNSUPPORTED_IMPORT |
string | AVX_C09: Retired. A bridge may import any module the bundler can resolve; an unresolvable one is AVX_C17. |
COMPILER_BRIDGE_ISOLATED_IMPORT |
string | AVX_C10: An isolated component imports a bridge. |
COMPILER_BRIDGE_CIRCULAR_IMPORT |
string | AVX_C11: Bridge modules import each other in a cycle. |
COMPILER_BRIDGE_INVALID_MODULE |
string | AVX_C12: A *.bridge.js file is not built on the bridge() factory. |
COMPILER_RUNTIME_MISSING |
string | AVX_C13: Retired. There is no prebuilt runtime; a missing install surfaces as AVX_C17. |
COMPILER_HOOK_FAILED |
string | AVX_C14: A configured build lifecycle hook exited non-zero. |
COMPILER_INVALID_OUTPUT |
string | AVX_C15: The compiler produced JavaScript that does not parse. |
COMPILER_DUPLICATE_BUNDLE_BINDING |
string | AVX_C16: Two modules publish the same bundle-scope name. |
COMPILER_UNRESOLVED_IMPORT |
string | AVX_C17: An import names a module that cannot be found. |
COMPILER_MISSING_EXPORT |
string | AVX_C18: An import names something a module does not export. |
COMPILER_MODULE_UNREADABLE |
string | AVX_C19: A module's import or export declarations could not be read. |
COMPILER_BUNDLE_CYCLE |
string | AVX_C20: A module cycle carries a binding that cannot cross it. |
COMPILER_MISSING_RUNTIME_CAPABILITY |
string | AVX_C23: The build linked a runtime capability the emitted bundle does not carry. |
COMPONENT_RENDER_ABORTED |
string | AVX_R33: A component failed to render and no handler claimed the error. |
RENDERER_UNAVAILABLE |
string | AVX_R34: A component needs a rendering engine this bundle does not carry. |
COMPILER_BRIDGE_UNKNOWN_MEMBER |
string | AVX_W37: A template reads a member that the bridge does not declare. |
COMPILER_BRIDGE_UNKNOWN_EVENT |
string | AVX_W38: Code subscribes to an event the bridge never emits. |
ATLAS_UNREAD_STATE |
string | AVX_W40: Declared state that nothing in the application reads. |
ATLAS_UNREACHABLE_ACTION |
string | AVX_W41: An action no supported invocation surface can reach. |
RENDER_LIST_INVALID_SOURCE |
string | AVX_W39: A list expression evaluates to a non-iterable value. |
COMPILER_TRANSACTION_UNBOUNDED |
string | AVX_W42: An atomic action's write set could not be resolved completely. |
COMPILER_TRANSACTION_IRREVERSIBLE |
string | AVX_W43: An atomic action performs an effect a rewind cannot undo. |
COMPILER_TRANSACTION_OVERLAP |
string | AVX_W44: Two atomic actions write the same state. |
COMPILER_UNRESOLVED_COMPONENT_REFERENCE |
string | AVX_W46: A PascalCase template tag resolves to no registered component, built-in, or known HTML/SVG element. |
COMPILER_RENDER_NOT_COMPILED |
string | AVX_W47: A template could not be compiled to a render program and falls back to the string renderer. |
COMPILER_EXPRESSION_NOT_COMPILED |
string | AVX_W48: An expression could not be compiled to a closure and will be interpreted at runtime. |
COMPILER_EXPRESSION_REFUSED |
string | AVX_C21: An expression names something the sandbox forbids. |
COMPILER_COMPILED_ONLY_CONSTRUCT |
string | AVX_C22: A template that cannot compile uses a construct only the compiled renderer implements. |
- Source:
LoggingConfig
Type:
- Object
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level |
'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' |
<optional> |
'info' | The minimum severity level to output. |
silent |
boolean |
<optional> |
false | Global silence setting. If true, suppresses all logging. |
formatter |
function |
<optional> |
defaultFormatter | Custom formatting callback function. Receives (level, args). |
transports |
Array:.<(Object:|function())> |
<optional> |
[consoleTransport] | Collection of transport targets. |
- Source:
TemplateSegment
Segment structure for parsed template AST:
Type:
- object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
isExpression |
boolean | True if this segment is an interpolation expression. |
|
value |
string |
<optional> |
Static text content when isExpression is false. |
expression |
string |
<optional> |
Expression source code when isExpression is true. |
isRaw |
boolean |
<optional> |
True if raw interpolation {{{ ... }}} was used. |