Appends AST, tokens, and visitorKeys to power-assert context at runtime. Version 1.2.0 is the latest stable release. This package is part of the power-assert-runtime monorepo and is intended for use when the transpiler does not add AST metadata during compilation. It parses the assertion expression to generate the missing AST nodes, enabling power-assert's enhanced assertion messages even without a transpiler step. The package is lightweight and focused on a single responsibility within the power-assert ecosystem.
npm install power-assert-context-reducer-astNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to use appendAst to add AST, tokens, and visitorKeys to a power-assert context object.
Ensure acorn is installed as a transitive dependency; avoid directly requiring acorn from this package.
Check if context.source.ast is undefined before calling appendAst, or clone the context.
Consider using power-assert directly with a transpiler plugin that embeds AST at compile time.
Use require('power-assert-context-reducer-ast') instead.Run 'npm install acorn' or 'npm install power-assert-context-reducer-ast' to include all dependencies.
Ensure the context object has a source property with content, filepath, and line.