Replies: 1 comment
-
|
I don't think anyone is ever going to be upset by sending PR's with more docs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Because this plugin is quite complex, maybe is worth it to have more pictures/diagrams on how this plugin actually works, an example
A)
sequenceDiagram participant npm participant vite participant dotnet participant FableDaemon participant vite-plugin-fable %% Installation phase npm->>vite-plugin-fable: Download npm package (with Fable.Daemon .fs src) npm->>vite-plugin-fable: Run postinstall script dotnet->>npm: dotnet publish Fable.Daemon to /bin folder %% Runtime phase: Vite startup vite->>vite-plugin-fable: Load plugin (Rollup hook) vite-plugin-fable->>FableDaemon: Spawn Fable.Daemon from /bin (exposing JSON-RPC endpoints) vite-plugin-fable->>FableDaemon: (Config hook) Request Fsharp compiler options FableDaemon-->>vite-plugin-fable: Return Fsharp options %% Runtime phase: File changes and transformation vite-plugin-fable->>FableDaemon: On file change, send .fs source for transformation FableDaemon-->>vite-plugin-fable: Return transformed .js code vite-plugin-fable->>vite: Provide transformed .js files to bundleranother example
B)
flowchart TB subgraph InstallTimePhase[Install-Time Phase] A[npm install vite-plugin-fable] --> B[Package downloaded with\nFable.Daemon F# source code] end subgraph PostInstallPhase[Post-Install Phase] C[postinstall script executes] --> D["dotnet publish compiles\nFable.Daemon source to binary"] D --> E["Binary stored in\nnode_modules/.../bin/Fable.Daemon"] end subgraph RuntimePhase[Runtime Phase] F["Vite loads vite-plugin-fable\n(Rollup plugin)"] --> G["Plugin spawns\nFable.Daemon binary"] G --> H["Daemon exposes JSON-RPC endpoints"] subgraph JSONRPCServices[JSON-RPC Services] I["Provide F# compiler options\nduring configuration"] J["Transform F# source files\nto JavaScript on changes"] end H --> I H --> J J --> K["Transformed JS code returned to Vite"] K --> L["Vite bundles and applies\nHot Module Replacement"] end B --> C E --> For
C) also sequence diagram
sequenceDiagram participant NPM as npm participant Package as vite-plugin-fable Package participant PostInstall as PostInstall Script participant DotNet as dotnet CLI participant Fable as Fable.Daemon Binary participant Vite as Vite participant FSFiles as fs Source Files participant JSOutput as JavaScript Output %% Install-Time Phase rect rgb(76, 175, 80, 0.3) Note over NPM,Package: Install-Time Phase NPM->>Package: npm install vite-plugin-fable Package->>Package: Package contains Fable.Daemon .fs source end %% Post-Install Phase rect rgb(255, 152, 0, 0.3) Note over Package,DotNet: Post-Install Phase Package->>PostInstall: Trigger postinstall script PostInstall->>DotNet: Execute dotnet publish DotNet->>Fable: Compile Fable.Daemon to binary Fable->>Package: Store binary in node_modules/.../bin end %% Runtime Phase rect rgb(33, 150, 243, 0.3) Note over Vite,JSOutput: Runtime Phase Vite->>Package: Load vite-plugin-fable Package->>Fable: Spawn Fable.Daemon binary Fable-->>Package: Expose JSON-RPC endpoints FSFiles->>Fable: fs file changes detected Fable->>Fable: Transform .fs to .js Fable-->>Package: Return transformed .js Package-->>Vite: Pass .js to Vite Vite-->>JSOutput: Bundle and apply HMR endbut maybe it can be further improved ofc, source code is provided (mermaidjs). it is possible to include mermaid in fsdocs as well, thanks @nojaf !
Beta Was this translation helpful? Give feedback.
All reactions