npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

prettier-plugin-fusion

v0.2.0

Published

Prettier plugin for Neos Fusion/AFX files

Readme

Prettier plugin for Neos CMS Fusion/AFX files

ALPHA SOFTWARE – HANDLE WITH CARE! OUTPUT FORMAT NOT STABLE YET!

This is a Prettier plugin that understands Neos Fusion/AFX syntax through the ts-fusion-parser. The parser is production proven (it powers the Neos Fusion VS Code extension) and can parse Fusion code, embedded AFX markup, and inline (unparsed) Eel expressions.

The printer mirrors the parser’s object model and emits Prettier docs, which means Fusion statements, nested blocks, embedded AFX templates, and inline Eel expressions are formatted consistently.

Usage

npm install --save-dev prettier-plugin-fusion
yarn add--dev prettier-plugin-fusion
pnpm install --save-dev prettier-plugin-fusion
bun add --development prettier-plugin-fusion

Add to your .prettierrc.js:

module.exports = {
  plugins: [require.resolve("prettier-plugin-fusion")]
}

...and run:

# Format Fusion files in-place
prettier --write "src/**/*.fusion"

The plugin registers a fusion parser and handles .fusion files automatically. It ships a couple of parser options that mirror the ts-fusion-parser configuration:

| Option | Default | Description | | --------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------- | | fusionContextPath | undefined | Optional context path forwarded to the parser (defaults to Prettier's filepath). | | fusionIgnoreParserErrors | false | Set to true to keep formatting resilient while typing by collecting parser errors instead of throwing. | | fusionAllowIncompleteObjectStatements | false | Set to true when you want to allow unfinished Fusion object statements while editing. | | fusionAllowIncompleteEelPaths | true | Allows incomplete Eel object paths. | | fusionAllowUnclosedAfxTags | true | Lets the AFX parser auto-close tags the way the VS Code tooling does. |

Funktionsweise

  • Fusion: The plugin registers a fusion parser backed by ts-fusion-parser, which returns a strongly typed AST of statements, object paths, blocks, and comments. The printer in src/printer/index.ts walks that AST and rebuilds it following an algorithm.

  • AFX/HTML: When a DSL expression is marked as afx, the embed hook normalises leading/trailing whitespace, masks embedded Eel placeholders, and lets Prettier’s html parser format the inner markup. The result is restored and wrapped back into the afx`...` fence.

  • Eel: ${...} is treated as a string value (that’s what ts-fusion-parser gives us). We keep the original text as the source of truth, normalise whitespace, split logical operators onto continuation lines when they spill past the print width, and break long function-call arguments heuristically. There is no dedicated Eel AST here, so formatting falls back to these best-effort string transforms rather than semantic reprinting.

Development

pnpm install
pnpm test:lib

pnpm test:lib builds the TypeScript sources and runs Vitest over the fixtures in ./fixtures/fusion. Each fixture directory contains an input.fusion and output.fusion file – the former stays intentionally unformatted while the latter acts as the golden copy for regression testing.

Need to inspect the parser output for a particular file? Run the helper script:

ts-node scripts/inspect-ast.ts fixtures/fusion/Card/input.fusion

src/index.ts wires up Prettier with the ts-fusion-parser, while src/printer/ hosts the printer logic and doc builder helpers.