@hia-doc/dotnetdoc-runner 0.1.1 → 0.1.3

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 CHANGED
@@ -1,7 +1,12 @@
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 and ASP.NET endpoint surface inputs.
4
+ C# source inputs, ASP.NET endpoint surface inputs, ASP.NET/Razor markup comment
5
+ inputs and `.sln`/`.csproj` structure discovery.
6
+
7
+ DotNetDoc 独立 runner 与 CLI,支持编译器 XML documentation、C# 源码、
8
+ ASP.NET endpoint surface、ASP.NET/Razor 标记层注释,以及 `.sln`/`.csproj`
9
+ 结构发现。
5
10
 
6
11
  ```sh
7
12
  hia-dotnetdoc --config dotnetdoc.config.json
@@ -10,3 +15,10 @@ hia-dotnetdoc --config dotnetdoc.config.json
10
15
  This package emits DotNetDoc extraction artifacts, HIA document artifacts,
11
16
  optional source relation artifacts, ASP.NET endpoint extraction artifacts and a
12
17
  documentation producer result manifest without embedding private source text.
18
+
19
+ `dotnet-markup-comments` inputs emit `dotnetdoc-markup-comment-extraction` and
20
+ matching HIA document artifacts for `.aspx`, `.ascx`, `.cshtml` and `.razor`
21
+ files.
22
+
23
+ `dotnet-markup-comments` input 会为 `.aspx`、`.ascx`、`.cshtml`、`.razor`
24
+ 文件输出 `dotnetdoc-markup-comment-extraction` 与对应 HIA document。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hia-doc/dotnetdoc-runner",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1",
40
- "@hia-doc/dotnet-xml-doc-extractor": "0.1.1",
41
- "@hia-doc/dotnetdoc-adapter": "0.1.1",
42
- "@hia-doc/dotnetdoc-spec": "0.1.1"
39
+ "@hia-doc/dotnet-source-extractor": "0.1.3",
40
+ "@hia-doc/dotnet-xml-doc-extractor": "0.1.3",
41
+ "@hia-doc/dotnetdoc-adapter": "0.1.3",
42
+ "@hia-doc/dotnetdoc-spec": "0.1.3"
43
43
  }
44
44
  }
package/src/index.mjs CHANGED
@@ -1,12 +1,14 @@
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, extractDotnetMarkupComments, 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, dotnetMarkupCommentsToHiaDocument, 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_MARKUP_COMMENT_EXTRACTION_CONTRACT,
11
+ DOTNETDOC_PROJECT_DISCOVERY_CONTRACT,
10
12
  DOTNETDOC_SOURCE_RELATION_CONTRACT,
11
13
  DOTNETDOC_SOURCE_RELATION_CONTRACT_VERSION,
12
14
  DOTNETDOC_XML_DOC_EXTRACTION_CONTRACT
@@ -19,9 +21,9 @@ export {
19
21
  } from "./schema.mjs";
20
22
  import { DOTNETDOC_CONFIG_SCHEMA_ID, DOTNETDOC_CONFIG_SCHEMA_VERSION } from "./schema.mjs";
21
23
 
22
- export const DOTNETDOC_RUNNER_VERSION = "0.1.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"]);
24
+ export const DOTNETDOC_RUNNER_VERSION = "0.1.3";
25
+ export const DOTNETDOC_INPUT_KINDS = Object.freeze(["dotnet-xml-doc", "dotnet-csharp-source", "dotnet-aspnet-surface", "dotnet-markup-comments", "dotnet-project"]);
26
+ export const DOTNETDOC_OUTPUT_KINDS = Object.freeze(["dotnetdoc-extraction", "hia-document", "dotnetdoc-source-relation", "dotnetdoc-aspnet-endpoint-extraction", "dotnetdoc-markup-comment-extraction", "dotnetdoc-project-discovery"]);
25
27
 
26
28
  const RESULT_CONTRACT = "documentation-producer-result";
27
29
  const RESULT_CONTRACT_VERSION = "0.1.0-draft";
@@ -184,7 +186,7 @@ function normalizeInput(input, index) {
184
186
  const inputPath = normalizeSafeRelativePath(input.path, `inputs[${index}].path`);
185
187
  const artifactBasePath = input.artifactBasePath
186
188
  ? normalizeSafeRelativePath(input.artifactBasePath, `inputs[${index}].artifactBasePath`)
187
- : stripXmlExtension(inputPath);
189
+ : stripKnownInputExtension(inputPath);
188
190
 
189
191
  return {
190
192
  kind: input.kind,
@@ -201,16 +203,30 @@ async function processInput(input, request) {
201
203
  ? await processXmlDocInput(input, request)
202
204
  : input.kind === "dotnet-csharp-source"
203
205
  ? await processCSharpSourceInput(input, request)
204
- : await processAspNetEndpointInput(input, request);
206
+ : input.kind === "dotnet-aspnet-surface"
207
+ ? await processAspNetEndpointInput(input, request)
208
+ : input.kind === "dotnet-markup-comments"
209
+ ? await processMarkupCommentInput(input, request)
210
+ : await processProjectDiscoveryInput(input, request);
205
211
  const hiaDocument = dotnetdoc.contract === DOTNETDOC_ASPNET_ENDPOINT_EXTRACTION_CONTRACT
206
212
  ? dotnetAspNetEndpointsToHiaDocument(dotnetdoc, {
207
213
  id: input.hiaDocumentId,
208
214
  title: input.title
209
215
  })
210
- : dotnetXmlDocsToHiaDocument(dotnetdoc, {
211
- id: input.hiaDocumentId,
212
- title: input.title
213
- });
216
+ : dotnetdoc.contract === DOTNETDOC_MARKUP_COMMENT_EXTRACTION_CONTRACT
217
+ ? dotnetMarkupCommentsToHiaDocument(dotnetdoc, {
218
+ id: input.hiaDocumentId,
219
+ title: input.title
220
+ })
221
+ : dotnetdoc.contract === DOTNETDOC_PROJECT_DISCOVERY_CONTRACT
222
+ ? dotnetProjectDiscoveryToHiaDocument(dotnetdoc, {
223
+ id: input.hiaDocumentId,
224
+ title: input.title
225
+ })
226
+ : dotnetXmlDocsToHiaDocument(dotnetdoc, {
227
+ id: input.hiaDocumentId,
228
+ title: input.title
229
+ });
214
230
 
215
231
  const dotnetdocPath = `${input.artifactBasePath}.dotnetdoc.json`;
216
232
  const hiaPath = `${input.artifactBasePath}.hia.json`;
@@ -349,7 +365,8 @@ function createSourceRelation(xmlRecord, xmlMember, sourceRecord, sourceMember,
349
365
  language: sourceMember.source?.language ?? "csharp",
350
366
  range: sourceMember.source?.range ?? null,
351
367
  rangeSource: sourceMember.source?.rangeSource ?? "roslyn-syntax",
352
- confidence: sourceMember.source?.confidence ?? "medium"
368
+ confidence: sourceMember.source?.confidence ?? "medium",
369
+ semantic: sourceMember.semantic ?? null
353
370
  }
354
371
  };
355
372
  }
@@ -418,6 +435,20 @@ async function processAspNetEndpointInput(input, request) {
418
435
  });
419
436
  }
420
437
 
438
+ async function processMarkupCommentInput(input, request) {
439
+ return extractDotnetMarkupComments({
440
+ workspaceRoot: request.workspaceRoot,
441
+ paths: [input.path]
442
+ });
443
+ }
444
+
445
+ async function processProjectDiscoveryInput(input, request) {
446
+ return extractDotnetProjectDiscovery({
447
+ workspaceRoot: request.workspaceRoot,
448
+ path: input.path
449
+ });
450
+ }
451
+
421
452
  function artifact(id, kind, artifactPath, profileIds) {
422
453
  return {
423
454
  id,
@@ -456,8 +487,8 @@ function normalizeSafeRelativePath(value, label) {
456
487
  return normalized;
457
488
  }
458
489
 
459
- function stripXmlExtension(value) {
460
- return value.replace(/\.xml$/i, "");
490
+ function stripKnownInputExtension(value) {
491
+ return value.replace(/\.(?:xml|cs|csproj|sln|aspx|ascx|master|cshtml|razor)$/i, "");
461
492
  }
462
493
 
463
494
  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-markup-comments", "dotnet-project"] },
36
36
  path: relativePath,
37
37
  applicationRoot: relativePath,
38
38
  artifactBasePath: relativePath,