Vendor
module Vendor| Assembly | Nacara.Plugin.LiveExample |
| Attributes | [<RequireQualifiedAccess>] |
The compiler a live snippet runs on, and where a site gets it.
Three npm packages, fetched once per machine by Tool and copied into the site: the Fable compiler built for the browser, the assemblies it type-checks against, and - when snippets colour with tree-sitter - the browser build of tree-sitter.
Emitted into the output rather than loaded from a CDN, so a site works offline and behind a proxy.
Declared inside
Layout | Where a build of the compiler, its references and a precompiled library are served from, each relative to Directory |
Precompiled | What the build knows about a precompiled library, for the browser to be told |
Functions and values
AssemblySuffix: string
AssemblySuffix: stringThe suffix put on every assembly the type-checker downloads.
GitHub Pages compresses by content type and will not compress a .dll - 6.9 MB uncompressed to anyone who presses Run. Named .dll.txt it is compressed like text, and the worker takes the suffix through refsExtraSuffix.
Default: FableRelease
Default: FableReleaseThe pair this plugin was built and tried against.
TreeSitterPath: string
TreeSitterPath: stringWhere the highlighting plugin's browser files are, relative to this one's.
The two plugins emit side by side and the grammars are shared, so a site that colours its snippets and its blocks with tree-sitter ships one copy of each.
agrees (browser: string option) (modules: string) : Result<unit,string>
agrees (browser: string option) (modules: string) : Result<unit,string>Whether the Fable that precompiled a library is the one that will read it.
A precompiled library is only readable by the Fable that wrote it. The worker enforces that by answering CreateChecker with a bare LoadFailed, which reaches a reader as a snippet that never answers and says nothing about why - so it is worth knowing here, where there is still a build to say it in and a slower way to carry on.
| Parameter | |
|---|---|
browser | What the compiler in the browser is, when it says. |
modules | The fable_modules directory a precompile produced. |
assets (release: FableRelease) (tag: string option) : Result<(Asset list * Layout * string option),string>
assets (release: FableRelease) (tag: string option) : Result<(Asset list * Layout * string option),string>The compiler and what it checks against, as assets to emit.
Colouring is the highlighting plugin's: see browserAssetsWith for the grammars a snippet is coloured with.
| Parameter | |
|---|---|
release | Which build of the compiler to fetch. |
tag | What the precompiled library is, when the site built one. |
Returns. The assets, where all of it went, and the Fable this build of the compiler was made with - or the first reason one could not be had.
fableVersion (release: FableRelease) : string option
fableVersion (release: FableRelease) : string optionThe Fable the compiler in the browser was built from.
Read before anything is compiled, which is what lets the same Fable be fetched to do the compiling. None when the package does not say, which is every build of it before fable-standalone 3.1.0.
| Parameter | |
|---|---|
release | Which build of the compiler the site asked for. |
layout (standalone: string) (metadata: string) (tag: string option) : Layout
layout (standalone: string) (metadata: string) (tag: string option) : LayoutWhere each of those goes, for these versions and this library.
| Parameter | |
|---|---|
standalone | The version of fable-standalone in hand. |
metadata | The version of fable-metadata in hand. |
tag | What the precompiled library is, when there is one. |
metadataOf (version: string) : ToolRequestprecompileProject (projectRoot: AbsolutePath) (cli: FableCli) (project: string) : Result<string,string>
precompileProject (projectRoot: AbsolutePath) (cli: FableCli) (project: string) : Result<string,string>Precompile a project a site wrote, with everything it references.
Rebuilt when anything in it changes, and otherwise read from the last time.
| Parameter | |
|---|---|
projectRoot | The root of the site being built, where the output is kept. |
cli | Which Fable to run it with. |
project | The .fsproj to compile. |
precompileTag (modules: string) : string
precompileTag (modules: string) : stringWhat a precompile produced, as a short hash of it.
| Parameter | |
|---|---|
modules | The fable_modules directory a precompile produced. |
precompiledAssets (layout: Layout) (modules: string) : Asset list
precompiledAssets (layout: Layout) (modules: string) : Asset listThe precompiled library, as files to emit.
The assembly goes in with the ones the checker already reads, because that is where the worker looks for it. The JavaScript keeps the shape it was written in, so the relative imports inside it resolve on their own - except for the copy of fable-library it came with, which is dropped in favour of the compiler's: they are the same files, and the worker will not load a library built by a different Fable, so they cannot drift apart.
| Parameter | |
|---|---|
layout | Where this build of the compiler and library are served from. |
modules | The fable_modules directory a precompile produced. |
precompiledInfo (modules: string) : Precompiled
precompiledInfo (modules: string) : PrecompiledRead what fable precompile recorded.
OutPath is where the compiled file was written on this machine; it is kept relative to the output so the browser can be told where the site serves it. Path is left exactly as it is: Fable matches a source file on it rather than reading from it.
| Parameter | |
|---|---|
modules | The fable_modules directory a precompile produced. |
resolve (release: FableRelease) : string * string
resolve (release: FableRelease) : string * stringThe two versions to fetch, and how they were arrived at.
| Parameter | |
|---|---|
release | What the site asked for. |
standaloneOf (version: string) : ToolRequest