@hia-doc/dotnetdoc-runner 0.1.1 → 0.1.2
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/README.md +2 -1
- package/package.json +5 -5
- package/src/index.mjs +30 -14
- package/src/schema.mjs +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @hia-doc/dotnetdoc-runner
|
|
2
2
|
|
|
3
3
|
Standalone runner and CLI for compiler-generated .NET XML documentation files,
|
|
4
|
-
C# source inputs
|
|
4
|
+
C# source inputs, ASP.NET endpoint surface inputs and `.sln`/`.csproj`
|
|
5
|
+
structure discovery.
|
|
5
6
|
|
|
6
7
|
```sh
|
|
7
8
|
hia-dotnetdoc --config dotnetdoc.config.json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hia-doc/dotnetdoc-runner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Standalone .NET XML documentation runner and CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"LICENSE"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@hia-doc/dotnet-source-extractor": "0.1.
|
|
40
|
-
"@hia-doc/dotnet-xml-doc-extractor": "0.1.
|
|
41
|
-
"@hia-doc/dotnetdoc-adapter": "0.1.
|
|
42
|
-
"@hia-doc/dotnetdoc-spec": "0.1.
|
|
39
|
+
"@hia-doc/dotnet-source-extractor": "0.1.2",
|
|
40
|
+
"@hia-doc/dotnet-xml-doc-extractor": "0.1.2",
|
|
41
|
+
"@hia-doc/dotnetdoc-adapter": "0.1.2",
|
|
42
|
+
"@hia-doc/dotnetdoc-spec": "0.1.2"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { readFile, mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
|
-
import { extractAspNetEndpoints, extractDotnetSourceFiles } from "@hia-doc/dotnet-source-extractor";
|
|
4
|
+
import { extractAspNetEndpoints, extractDotnetProjectDiscovery, extractDotnetSourceFiles } from "@hia-doc/dotnet-source-extractor";
|
|
5
5
|
import { extractDotnetXmlDocs } from "@hia-doc/dotnet-xml-doc-extractor";
|
|
6
|
-
import { dotnetAspNetEndpointsToHiaDocument, dotnetXmlDocsToHiaDocument } from "@hia-doc/dotnetdoc-adapter";
|
|
6
|
+
import { dotnetAspNetEndpointsToHiaDocument, dotnetProjectDiscoveryToHiaDocument, dotnetXmlDocsToHiaDocument } from "@hia-doc/dotnetdoc-adapter";
|
|
7
7
|
import {
|
|
8
8
|
DOTNETDOC_ASPNET_ENDPOINT_EXTRACTION_CONTRACT,
|
|
9
9
|
DOTNETDOC_CSHARP_SOURCE_EXTRACTION_CONTRACT,
|
|
10
|
+
DOTNETDOC_PROJECT_DISCOVERY_CONTRACT,
|
|
10
11
|
DOTNETDOC_SOURCE_RELATION_CONTRACT,
|
|
11
12
|
DOTNETDOC_SOURCE_RELATION_CONTRACT_VERSION,
|
|
12
13
|
DOTNETDOC_XML_DOC_EXTRACTION_CONTRACT
|
|
@@ -19,9 +20,9 @@ export {
|
|
|
19
20
|
} from "./schema.mjs";
|
|
20
21
|
import { DOTNETDOC_CONFIG_SCHEMA_ID, DOTNETDOC_CONFIG_SCHEMA_VERSION } from "./schema.mjs";
|
|
21
22
|
|
|
22
|
-
export const DOTNETDOC_RUNNER_VERSION = "0.1.
|
|
23
|
-
export const DOTNETDOC_INPUT_KINDS = Object.freeze(["dotnet-xml-doc", "dotnet-csharp-source", "dotnet-aspnet-surface"]);
|
|
24
|
-
export const DOTNETDOC_OUTPUT_KINDS = Object.freeze(["dotnetdoc-extraction", "hia-document", "dotnetdoc-source-relation", "dotnetdoc-aspnet-endpoint-extraction"]);
|
|
23
|
+
export const DOTNETDOC_RUNNER_VERSION = "0.1.2";
|
|
24
|
+
export const DOTNETDOC_INPUT_KINDS = Object.freeze(["dotnet-xml-doc", "dotnet-csharp-source", "dotnet-aspnet-surface", "dotnet-project"]);
|
|
25
|
+
export const DOTNETDOC_OUTPUT_KINDS = Object.freeze(["dotnetdoc-extraction", "hia-document", "dotnetdoc-source-relation", "dotnetdoc-aspnet-endpoint-extraction", "dotnetdoc-project-discovery"]);
|
|
25
26
|
|
|
26
27
|
const RESULT_CONTRACT = "documentation-producer-result";
|
|
27
28
|
const RESULT_CONTRACT_VERSION = "0.1.0-draft";
|
|
@@ -184,7 +185,7 @@ function normalizeInput(input, index) {
|
|
|
184
185
|
const inputPath = normalizeSafeRelativePath(input.path, `inputs[${index}].path`);
|
|
185
186
|
const artifactBasePath = input.artifactBasePath
|
|
186
187
|
? normalizeSafeRelativePath(input.artifactBasePath, `inputs[${index}].artifactBasePath`)
|
|
187
|
-
:
|
|
188
|
+
: stripKnownInputExtension(inputPath);
|
|
188
189
|
|
|
189
190
|
return {
|
|
190
191
|
kind: input.kind,
|
|
@@ -201,16 +202,23 @@ async function processInput(input, request) {
|
|
|
201
202
|
? await processXmlDocInput(input, request)
|
|
202
203
|
: input.kind === "dotnet-csharp-source"
|
|
203
204
|
? await processCSharpSourceInput(input, request)
|
|
204
|
-
:
|
|
205
|
+
: input.kind === "dotnet-aspnet-surface"
|
|
206
|
+
? await processAspNetEndpointInput(input, request)
|
|
207
|
+
: await processProjectDiscoveryInput(input, request);
|
|
205
208
|
const hiaDocument = dotnetdoc.contract === DOTNETDOC_ASPNET_ENDPOINT_EXTRACTION_CONTRACT
|
|
206
209
|
? dotnetAspNetEndpointsToHiaDocument(dotnetdoc, {
|
|
207
210
|
id: input.hiaDocumentId,
|
|
208
211
|
title: input.title
|
|
209
212
|
})
|
|
210
|
-
:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
: dotnetdoc.contract === DOTNETDOC_PROJECT_DISCOVERY_CONTRACT
|
|
214
|
+
? dotnetProjectDiscoveryToHiaDocument(dotnetdoc, {
|
|
215
|
+
id: input.hiaDocumentId,
|
|
216
|
+
title: input.title
|
|
217
|
+
})
|
|
218
|
+
: dotnetXmlDocsToHiaDocument(dotnetdoc, {
|
|
219
|
+
id: input.hiaDocumentId,
|
|
220
|
+
title: input.title
|
|
221
|
+
});
|
|
214
222
|
|
|
215
223
|
const dotnetdocPath = `${input.artifactBasePath}.dotnetdoc.json`;
|
|
216
224
|
const hiaPath = `${input.artifactBasePath}.hia.json`;
|
|
@@ -349,7 +357,8 @@ function createSourceRelation(xmlRecord, xmlMember, sourceRecord, sourceMember,
|
|
|
349
357
|
language: sourceMember.source?.language ?? "csharp",
|
|
350
358
|
range: sourceMember.source?.range ?? null,
|
|
351
359
|
rangeSource: sourceMember.source?.rangeSource ?? "roslyn-syntax",
|
|
352
|
-
confidence: sourceMember.source?.confidence ?? "medium"
|
|
360
|
+
confidence: sourceMember.source?.confidence ?? "medium",
|
|
361
|
+
semantic: sourceMember.semantic ?? null
|
|
353
362
|
}
|
|
354
363
|
};
|
|
355
364
|
}
|
|
@@ -418,6 +427,13 @@ async function processAspNetEndpointInput(input, request) {
|
|
|
418
427
|
});
|
|
419
428
|
}
|
|
420
429
|
|
|
430
|
+
async function processProjectDiscoveryInput(input, request) {
|
|
431
|
+
return extractDotnetProjectDiscovery({
|
|
432
|
+
workspaceRoot: request.workspaceRoot,
|
|
433
|
+
path: input.path
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
421
437
|
function artifact(id, kind, artifactPath, profileIds) {
|
|
422
438
|
return {
|
|
423
439
|
id,
|
|
@@ -456,8 +472,8 @@ function normalizeSafeRelativePath(value, label) {
|
|
|
456
472
|
return normalized;
|
|
457
473
|
}
|
|
458
474
|
|
|
459
|
-
function
|
|
460
|
-
return value.replace(/\.xml$/i, "");
|
|
475
|
+
function stripKnownInputExtension(value) {
|
|
476
|
+
return value.replace(/\.(?:xml|cs|csproj|sln)$/i, "");
|
|
461
477
|
}
|
|
462
478
|
|
|
463
479
|
function safeArtifactId(value) {
|
package/src/schema.mjs
CHANGED
|
@@ -32,7 +32,7 @@ export const DOTNETDOC_CONFIG_JSON_SCHEMA = Object.freeze({
|
|
|
32
32
|
additionalProperties: false,
|
|
33
33
|
required: ["kind", "path"],
|
|
34
34
|
properties: {
|
|
35
|
-
kind: { enum: ["dotnet-xml-doc", "dotnet-csharp-source", "dotnet-aspnet-surface"] },
|
|
35
|
+
kind: { enum: ["dotnet-xml-doc", "dotnet-csharp-source", "dotnet-aspnet-surface", "dotnet-project"] },
|
|
36
36
|
path: relativePath,
|
|
37
37
|
applicationRoot: relativePath,
|
|
38
38
|
artifactBasePath: relativePath,
|