Skip to content

Plugin structure

Partas.Solid ships as two NuGet packages that always share a version. Partas.Solid, in src/Partas.Solid/, is the DSL: tags, attributes and the Solid bindings, almost all of it erased or imported. Partas.Solid.FablePlugin, in src/Partas.Solid.FablePlugin/, rewrites the F# AST into JSX, and is where the behaviour lives. Nothing of it runs at runtime, so the JSX it writes is the specification: a change in behaviour shows as a change in the snapshot tests.

Files

The plugin project targets net6.0 and references Fable.AST 5.0. Its files compile in this order, and each one depends only on the ones before it:

Partas.Solid.FablePlugin
|-- Utils.fs       # string and AST active patterns, AST and JSX constructors
|-- Types.fs       # PluginContext, ComponentFlag, IdentType and the other plugin types
|-- Spec.fs        # what input is legal, prebaked expressions, recognisers for AST nodes
|-- Plugin.fs      # the transformation tree and the two public attributes
|__ Storybook.fs   # a separate attribute that writes Storybook CSF output
FilePage
Utils.fsUtilities
Types.fsTypes
Spec.fsSpec
Plugin.fsPatterns and Transformation

Storybook.fs holds PartasStorybookAttribute, which turns a story definition into a Storybook CSF module. It has its own recursion over the story type, and is covered in Storybook.

The repository's conventions apply: an inexhaustive match fails the build, and Plugin.fs is never formatted.

Edit this page