starlight-fsharp-oracle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +25 -0
- package/Directory.Packages.props +18 -0
- package/README.md +80 -0
- package/dist/Extensions/StringBuilder.js +28 -0
- package/dist/Extensions/TextNode.js +115 -0
- package/dist/FSharp.Oracle.Schema/Schema.js +674 -0
- package/dist/Generate.js +254 -0
- package/dist/Helpers.js +69 -0
- package/dist/Plugin.js +139 -0
- package/dist/Render/Documentation.js +87 -0
- package/dist/Render/Entries.js +148 -0
- package/dist/Render/Pages.js +292 -0
- package/dist/Render/Primitives.js +114 -0
- package/dist/Render/Types.js +30 -0
- package/dist/Render.js +12 -0
- package/dist/Themes.js +78 -0
- package/oracle-bin/FSharp.Compiler.Service.dll +0 -0
- package/oracle-bin/FSharp.Core.dll +0 -0
- package/oracle-bin/FSharp.DependencyManager.Nuget.dll +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.dll +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.pdb +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.xml +219 -0
- package/oracle-bin/Fable.Core.dll +0 -0
- package/oracle-bin/Oracle +0 -0
- package/oracle-bin/Oracle.deps.json +280 -0
- package/oracle-bin/Oracle.dll +0 -0
- package/oracle-bin/Oracle.pdb +0 -0
- package/oracle-bin/Oracle.runtimeconfig.json +13 -0
- package/oracle-bin/Oracle.xml +111 -0
- package/oracle-bin/Thoth.Json.Core.Auto.dll +0 -0
- package/oracle-bin/Thoth.Json.Core.dll +0 -0
- package/oracle-bin/Thoth.Json.System.Text.Json.dll +0 -0
- package/oracle-bin/cs/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/cs/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/cs/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/de/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/de/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/de/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/es/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/es/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/es/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/it/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/it/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/it/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/package.json +38 -0
- package/packages/FSharp.Oracle/Extractor/Assembly.fs +160 -0
- package/packages/FSharp.Oracle/Extractor/EntityExtractor.fs +608 -0
- package/packages/FSharp.Oracle/Extractor/Helpers.fs +150 -0
- package/packages/FSharp.Oracle/Extractor/MemberExtractor.fs +172 -0
- package/packages/FSharp.Oracle/Extractor/ModuleExtractor.fs +45 -0
- package/packages/FSharp.Oracle/Extractor/ParameterExtractor.fs +47 -0
- package/packages/FSharp.Oracle/Extractor/SignatureRendering.fs +464 -0
- package/packages/FSharp.Oracle/Extractor/ValueExtractor.fs +171 -0
- package/packages/FSharp.Oracle/FSharp.Oracle.fsproj +36 -0
- package/packages/FSharp.Oracle/Program.fs +66 -0
- package/packages/FSharp.Oracle/XmlDoc.fs +463 -0
- package/packages/FSharp.Oracle.Schema/FSharp.Oracle.Schema.fsproj +16 -0
- package/packages/FSharp.Oracle.Schema/Schema.fs +454 -0
- package/packages/Starlight.FSharp.Oracle/components/DocEntry.astro +256 -0
- package/packages/Starlight.FSharp.Oracle/components/FSharpDocPage.astro +121 -0
- package/packages/Starlight.FSharp.Oracle/components/fsharp-doc.css +58 -0
- package/packages/Starlight.FSharp.Oracle/layouts/FSharpDocLayout.astro +27 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<Project>
|
|
2
|
+
<!-- Make F# support Central Package Management -->
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
|
|
5
|
+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
|
|
6
|
+
</PropertyGroup>
|
|
7
|
+
<!-- Use lock files -->
|
|
8
|
+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
|
|
9
|
+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
<PropertyGroup>
|
|
12
|
+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
|
13
|
+
<RestoreLockedMode Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</RestoreLockedMode>
|
|
14
|
+
</PropertyGroup>
|
|
15
|
+
<PropertyGroup>
|
|
16
|
+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
17
|
+
<Authors>Maxime Mangel</Authors>
|
|
18
|
+
</PropertyGroup>
|
|
19
|
+
<!-- Packages common to all the projects
|
|
20
|
+
Excepts Glutinum.Build which is isolated from the others -->
|
|
21
|
+
<ItemGroup Condition="'$(PackageId)'!='EasyBuild'">
|
|
22
|
+
<!-- Depends on the same version of FSharp.Core for all the projects -->
|
|
23
|
+
<PackageReference Include="FSharp.Core" />
|
|
24
|
+
</ItemGroup>
|
|
25
|
+
</Project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<Project>
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
|
4
|
+
</PropertyGroup>
|
|
5
|
+
<ItemGroup>
|
|
6
|
+
</ItemGroup>
|
|
7
|
+
<ItemGroup>
|
|
8
|
+
<PackageVersion Include="Fable.Core" Version="5.0.0" />
|
|
9
|
+
<PackageVersion Include="Fable.Node" Version="1.6.0" />
|
|
10
|
+
<PackageVersion Include="Fable.Promise" Version="3.2.0" />
|
|
11
|
+
<PackageVersion Include="FSharp.Compiler.Service" Version="43.12.203" />
|
|
12
|
+
<PackageVersion Include="FSharp.Core" Version="10.1.203" />
|
|
13
|
+
<PackageVersion Include="Thoth.Json.Core" Version="0.9.0" />
|
|
14
|
+
<PackageVersion Include="Thoth.Json.Core.Auto" Version="0.1.0" />
|
|
15
|
+
<PackageVersion Include="Thoth.Json.JavaScript" Version="0.5.0" />
|
|
16
|
+
<PackageVersion Include="Thoth.Json.System.Text.Json" Version="0.3.0" />
|
|
17
|
+
</ItemGroup>
|
|
18
|
+
</Project>
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# FSharp.Oracle
|
|
2
|
+
|
|
3
|
+
> **Reads the binaries. Sees the truth. Writes the docs.** 🔮
|
|
4
|
+
|
|
5
|
+
FSharp.Oracle is a documentation generator for F# libraries. It inspects compiled assemblies using the F# Compiler Service (FCS) and generates rich API reference documentation as [Starlight](https://starlight.astro.build/) pages.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
Two F# components bridged by a JSON intermediate representation:
|
|
10
|
+
|
|
11
|
+
- **Oracle** — `packages/Oracle/`
|
|
12
|
+
- Uses FCS (F# Compiler Service) to inspect compiled assemblies
|
|
13
|
+
- Extracts types, functions, members, and XML documentation
|
|
14
|
+
- Emits a JSON IR
|
|
15
|
+
|
|
16
|
+
- **Starlight.FSharp.Doc** — `packages/Starlight.FSharp.Oracle/`
|
|
17
|
+
- Starlight plugin written in F# and compiled via [Fable](https://fable.io/)
|
|
18
|
+
- Reads the JSON IR and generates `.mdx` pages
|
|
19
|
+
- Injects sidebar groups and CSS theme variables
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install starlight-fsharp-doc
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You will also need the .NET Oracle tool alongside your Starlight site:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/your-org/starlight-fsharp-doc.git
|
|
31
|
+
cd packages/Oracle
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
TODO 🚨
|
|
37
|
+
|
|
38
|
+
Add the plugin to your `astro.config.mjs`:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import starlightFSharpDoc from 'starlight-fsharp-doc';
|
|
42
|
+
import { resolve } from 'node:path';
|
|
43
|
+
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
integrations: [
|
|
46
|
+
starlight({
|
|
47
|
+
plugins: [
|
|
48
|
+
starlightFSharpDoc({
|
|
49
|
+
// Paths to compiled F# assemblies
|
|
50
|
+
assemblies: [
|
|
51
|
+
resolve(__dirname, '../src/MyLibrary/bin/Debug/net10.0/MyLibrary.dll'),
|
|
52
|
+
],
|
|
53
|
+
// Output base path for generated pages
|
|
54
|
+
output: 'api',
|
|
55
|
+
// Sidebar configuration
|
|
56
|
+
sidebar: { label: 'API Reference' },
|
|
57
|
+
// Command to run Oracle (optional — defaults shown)
|
|
58
|
+
command: [
|
|
59
|
+
'dotnet',
|
|
60
|
+
'run',
|
|
61
|
+
'--project',
|
|
62
|
+
resolve(__dirname, '../packages/Oracle'),
|
|
63
|
+
'--',
|
|
64
|
+
],
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
}),
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The plugin runs during `dev`, `build`, and `sync`. It skips extraction on `preview`.
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
TODO 🚨
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { StringBuilder__AppendLine, StringBuilder__AppendLine_Z721C83C5, StringBuilder__Append_Z721C83C5 } from "../fable_modules/fable-library-js.5.0.0-rc.7/System.Text.js";
|
|
3
|
+
import { defaultArg } from "../fable_modules/fable-library-js.5.0.0-rc.7/Option.js";
|
|
4
|
+
import { replicate } from "../fable_modules/fable-library-js.5.0.0-rc.7/String.js";
|
|
5
|
+
|
|
6
|
+
export function System_Text_StringBuilder__StringBuilder_Write_Z721C83C5(this$, text) {
|
|
7
|
+
StringBuilder__Append_Z721C83C5(this$, text);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function System_Text_StringBuilder__StringBuilder_WriteLine_Z721C83C5(this$, text) {
|
|
11
|
+
StringBuilder__AppendLine_Z721C83C5(this$, text);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function System_Text_StringBuilder__StringBuilder_NewLine(this$) {
|
|
15
|
+
StringBuilder__AppendLine(this$);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function System_Text_StringBuilder__StringBuilder_Indent_71136F3F(this$, factor) {
|
|
19
|
+
const factor_1 = defaultArg(factor, 1) | 0;
|
|
20
|
+
const value = System_Text_StringBuilder__StringBuilder_Space_71136F3F(this$, factor_1 * 4);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function System_Text_StringBuilder__StringBuilder_Space_71136F3F(this$, factor) {
|
|
24
|
+
const factor_1 = defaultArg(factor, 1) | 0;
|
|
25
|
+
const text = replicate(factor_1, " ");
|
|
26
|
+
StringBuilder__Append_Z721C83C5(this$, text);
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
|
|
2
|
+
import { concat, join, replace } from "../fable_modules/fable-library-js.5.0.0-rc.7/String.js";
|
|
3
|
+
import { TextNode } from "../FSharp.Oracle.Schema/Schema.js";
|
|
4
|
+
import { map } from "../fable_modules/fable-library-js.5.0.0-rc.7/List.js";
|
|
5
|
+
import { singleton, collect, delay, toList } from "../fable_modules/fable-library-js.5.0.0-rc.7/Seq.js";
|
|
6
|
+
import { rangeDouble } from "../fable_modules/fable-library-js.5.0.0-rc.7/Range.js";
|
|
7
|
+
|
|
8
|
+
function escapeJsx(s) {
|
|
9
|
+
return replace(replace(s, "{", "{"), "}", "}");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function wrapWithClass(cls, text) {
|
|
13
|
+
return `<span class="${cls}">${escapeJsx(text)}</span>`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function wrapInKeyword(text) {
|
|
17
|
+
return wrapWithClass("fsharp-doc-kw", text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function FSharp_Oracle_Schema_TextNode__TextNode_ToHtml_Static_5FC7EAAF(node) {
|
|
21
|
+
return FSharp_Oracle_Schema_TextNode__TextNode_get_Html(node);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function FSharp_Oracle_Schema_TextNode__TextNode_ToHtml_Static_Z3A0E64B3(node) {
|
|
25
|
+
return FSharp_Oracle_Schema_TextNode__TextNode_ToHtml_Static_5FC7EAAF(new TextNode(19, [node]));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function FSharp_Oracle_Schema_TextNode__TextNode_get_Html(this$) {
|
|
29
|
+
switch (this$.tag) {
|
|
30
|
+
case 12:
|
|
31
|
+
return wrapInKeyword(":");
|
|
32
|
+
case 7:
|
|
33
|
+
return wrapInKeyword("->");
|
|
34
|
+
case 13:
|
|
35
|
+
return wrapInKeyword(".");
|
|
36
|
+
case 11:
|
|
37
|
+
return wrapInKeyword(",");
|
|
38
|
+
case 9:
|
|
39
|
+
return " ";
|
|
40
|
+
case 17:
|
|
41
|
+
return wrapInKeyword(">");
|
|
42
|
+
case 16:
|
|
43
|
+
return wrapInKeyword("<");
|
|
44
|
+
case 4:
|
|
45
|
+
return wrapInKeyword("{");
|
|
46
|
+
case 5:
|
|
47
|
+
return wrapInKeyword("}");
|
|
48
|
+
case 6:
|
|
49
|
+
return wrapInKeyword("=");
|
|
50
|
+
case 8:
|
|
51
|
+
return "'";
|
|
52
|
+
case 14:
|
|
53
|
+
return wrapInKeyword("(");
|
|
54
|
+
case 15:
|
|
55
|
+
return wrapInKeyword(")");
|
|
56
|
+
case 19: {
|
|
57
|
+
const node = this$.fields[0];
|
|
58
|
+
return join("", map(FSharp_Oracle_Schema_TextNode__TextNode_get_Html, node));
|
|
59
|
+
}
|
|
60
|
+
case 3: {
|
|
61
|
+
const text = this$.fields[0];
|
|
62
|
+
return wrapInKeyword(text);
|
|
63
|
+
}
|
|
64
|
+
case 18:
|
|
65
|
+
return wrapInKeyword("*");
|
|
66
|
+
case 1: {
|
|
67
|
+
const url = this$.fields[2];
|
|
68
|
+
const name = this$.fields[0];
|
|
69
|
+
return wrapWithClass("fsharp-doc-type", `<a href="${url}">${name}</a>`);
|
|
70
|
+
}
|
|
71
|
+
case 2: {
|
|
72
|
+
const name_1 = this$.fields[0];
|
|
73
|
+
return wrapWithClass("fsharp-doc-typevar", name_1);
|
|
74
|
+
}
|
|
75
|
+
case 20:
|
|
76
|
+
return "\n";
|
|
77
|
+
case 21: {
|
|
78
|
+
const tagName = this$.fields[0];
|
|
79
|
+
return concat("<", tagName, ...">");
|
|
80
|
+
}
|
|
81
|
+
case 23: {
|
|
82
|
+
const tagName_1 = this$.fields[0];
|
|
83
|
+
const cls = this$.fields[1];
|
|
84
|
+
return `<${tagName_1} class="${cls}">`;
|
|
85
|
+
}
|
|
86
|
+
case 22: {
|
|
87
|
+
const tagName_2 = this$.fields[0];
|
|
88
|
+
return concat("</", tagName_2, ...">");
|
|
89
|
+
}
|
|
90
|
+
case 24: {
|
|
91
|
+
const text_1 = this$.fields[0];
|
|
92
|
+
const href = this$.fields[1];
|
|
93
|
+
return `<a href="${href}">${text_1}</a>`;
|
|
94
|
+
}
|
|
95
|
+
case 25: {
|
|
96
|
+
const text_2 = this$.fields[0];
|
|
97
|
+
const href_1 = this$.fields[1];
|
|
98
|
+
return wrapWithClass("fsharp-doc-property", `<a href="${href_1}">${text_2}</a>`);
|
|
99
|
+
}
|
|
100
|
+
case 26: {
|
|
101
|
+
const text_3 = this$.fields[0];
|
|
102
|
+
const href_2 = this$.fields[1];
|
|
103
|
+
return wrapWithClass("fsharp-doc-kw", `<a href="${href_2}">${text_3}</a>`);
|
|
104
|
+
}
|
|
105
|
+
case 10: {
|
|
106
|
+
const count = this$.fields[0] | 0;
|
|
107
|
+
return FSharp_Oracle_Schema_TextNode__TextNode_ToHtml_Static_5FC7EAAF(new TextNode(19, [toList(delay(() => collect((matchValue) => singleton(new TextNode(9, [])), rangeDouble(1, 1, count))))]));
|
|
108
|
+
}
|
|
109
|
+
default: {
|
|
110
|
+
const s = this$.fields[0];
|
|
111
|
+
return escapeJsx(s);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|