rspress-plugin-api-extractor 0.4.0 → 0.6.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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/api-extracted-package.js +20 -8
  3. package/build-program.js +1 -2
  4. package/build-stages.js +6 -7
  5. package/config-helpers.js +5 -8
  6. package/config-utils.js +4 -4
  7. package/index.d.ts +492 -742
  8. package/layers/ConfigServiceLive.js +6 -6
  9. package/layers/ObservabilityLive.js +7 -8
  10. package/layers/SnapshotServiceLive.js +3 -5
  11. package/layers/TypeRegistryServiceLive.js +119 -116
  12. package/layers/build-metrics.js +7 -7
  13. package/llms-program.js +3 -4
  14. package/migrations/001_create_snapshots.js +1 -1
  15. package/observability/EventBus.js +1 -1
  16. package/observability/sinks/metrics-sink.js +13 -13
  17. package/package.json +16 -15
  18. package/runtime/components/EnumMembersTable/index.css +18 -18
  19. package/runtime/components/EnumMembersTable/index.module.js +3 -3
  20. package/runtime/components/ExampleBlock/index.css +2 -2
  21. package/runtime/components/ExampleBlock/index.module.js +2 -2
  22. package/runtime/components/MemberSignature/index.css +5 -5
  23. package/runtime/components/MemberSignature/index.module.js +3 -3
  24. package/runtime/components/ParametersTable/index.css +19 -19
  25. package/runtime/components/ParametersTable/index.module.js +3 -3
  26. package/runtime/components/SignatureBlock/index.css +5 -5
  27. package/runtime/components/SignatureBlock/index.module.js +3 -3
  28. package/runtime/components/SignatureCode/index.css +9 -9
  29. package/runtime/components/SignatureCode/index.module.js +3 -3
  30. package/runtime/components/SignatureToolbar/index.css +18 -18
  31. package/runtime/components/SignatureToolbar/index.module.js +7 -7
  32. package/runtime/components/buttons/index.css +5 -5
  33. package/runtime/components/buttons/index.module.js +2 -2
  34. package/schemas/config.js +63 -57
  35. package/schemas/observability.js +12 -4
  36. package/schemas/opengraph.js +5 -5
  37. package/schemas/performance.js +13 -13
  38. package/services/ConfigService.js +1 -1
  39. package/services/PathDerivationService.js +1 -1
  40. package/services/SnapshotService.js +1 -1
  41. package/services/TypeRegistryService.js +1 -1
  42. package/tsdoc-metadata.json +1 -1
package/schemas/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PerformanceConfig } from "./performance.js";
2
2
  import { ObservabilityConfig } from "./observability.js";
3
3
  import { OpenGraphImageConfig } from "./opengraph.js";
4
- import { Schema } from "effect";
4
+ import { Effect, Schema } from "effect";
5
5
  import { ApiItemKind } from "@microsoft/api-extractor-model";
6
6
 
7
7
  //#region src/schemas/config.ts
@@ -15,40 +15,51 @@ const ModelInput = Schema.declare((input) => typeof input === "string" || typeof
15
15
  *
16
16
  * @public
17
17
  */
18
- const LogLevel$1 = Schema.Literal("none", "info", "verbose", "debug", "warn", "error");
19
- const ExternalPackageSpec = Schema.mutable(Schema.Struct({
18
+ const LogLevel = Schema.Literals([
19
+ "none",
20
+ "info",
21
+ "verbose",
22
+ "debug",
23
+ "warn",
24
+ "error"
25
+ ]);
26
+ const ExternalPackageSpec = Schema.Struct({
20
27
  name: Schema.String,
21
28
  version: Schema.String,
22
29
  tsconfig: Schema.optional(ModelInput),
23
30
  compilerOptions: Schema.optional(Schema.Unknown)
24
- }));
25
- const AutoDetectDependencies = Schema.mutable(Schema.Struct({
26
- dependencies: Schema.optionalWith(Schema.Boolean, { default: () => true }),
27
- devDependencies: Schema.optionalWith(Schema.Boolean, { default: () => false }),
28
- peerDependencies: Schema.optionalWith(Schema.Boolean, { default: () => true }),
29
- autoDependencies: Schema.optionalWith(Schema.Boolean, { default: () => true })
30
- }));
31
- const ErrorConfig = Schema.mutable(Schema.Struct({ example: Schema.optional(Schema.Literal("suppress", "show")) }));
32
- const LlmsPlugin = Schema.mutable(Schema.Struct({
33
- enabled: Schema.optionalWith(Schema.Boolean, { default: () => true }),
34
- scopes: Schema.optionalWith(Schema.Boolean, { default: () => true }),
35
- apiTxt: Schema.optionalWith(Schema.Boolean, { default: () => true }),
36
- showCopyButton: Schema.optionalWith(Schema.Boolean, { default: () => true }),
37
- showViewOptions: Schema.optionalWith(Schema.Boolean, { default: () => true }),
38
- copyButtonText: Schema.optionalWith(Schema.String, { default: () => "Copy Markdown" }),
39
- viewOptions: Schema.optionalWith(Schema.mutable(Schema.Array(Schema.Literal("markdownLink", "chatgpt", "claude"))), { default: () => [
31
+ });
32
+ const AutoDetectDependencies = Schema.Struct({
33
+ dependencies: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
34
+ devDependencies: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
35
+ peerDependencies: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
36
+ autoDependencies: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true)))
37
+ });
38
+ const ErrorConfig = Schema.Struct({ example: Schema.optional(Schema.Literals(["suppress", "show"])) });
39
+ const LlmsPlugin = Schema.Struct({
40
+ enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
41
+ scopes: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
42
+ apiTxt: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
43
+ showCopyButton: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
44
+ showViewOptions: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
45
+ copyButtonText: Schema.String.pipe(Schema.withDecodingDefault(Effect.succeed("Copy Markdown"))),
46
+ viewOptions: Schema.mutable(Schema.Array(Schema.Literals([
40
47
  "markdownLink",
41
48
  "chatgpt",
42
49
  "claude"
43
- ] })
44
- }));
50
+ ]))).pipe(Schema.withDecodingDefault(Effect.succeed([
51
+ "markdownLink",
52
+ "chatgpt",
53
+ "claude"
54
+ ])))
55
+ });
45
56
  const ApiItemKindSchema = Schema.declare((input) => typeof input === "number");
46
57
  /**
47
58
  * Configuration for a single documentation category (e.g. Classes, Functions).
48
59
  *
49
60
  * @public
50
61
  */
51
- const CategoryConfig = Schema.mutable(Schema.Struct({
62
+ const CategoryConfig = Schema.Struct({
52
63
  /** Human-readable plural display name shown in the sidebar. */
53
64
  displayName: Schema.String,
54
65
  /** Human-readable singular name used in page titles. */
@@ -60,30 +71,31 @@ const CategoryConfig = Schema.mutable(Schema.Struct({
60
71
  /** TSDoc modifier tag that marks items for this category. */
61
72
  tsdocModifier: Schema.optional(Schema.String),
62
73
  /** Whether the sidebar section is collapsible. Defaults to `true`. */
63
- collapsible: Schema.optionalWith(Schema.Boolean, { default: () => true }),
74
+ collapsible: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
64
75
  /** Whether the sidebar section starts collapsed. Defaults to `true`. */
65
- collapsed: Schema.optionalWith(Schema.Boolean, { default: () => true }),
76
+ collapsed: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
66
77
  /** Heading levels shown in the overview. Defaults to `[2]`. */
67
- overviewHeaders: Schema.optionalWith(Schema.mutable(Schema.Array(Schema.Number)), { default: () => [2] })
68
- }));
78
+ overviewHeaders: Schema.mutable(Schema.Array(Schema.Number)).pipe(Schema.withDecodingDefault(Effect.succeed([2])))
79
+ });
69
80
  /**
70
81
  * Source repository link configuration for an API.
71
82
  *
72
83
  * @public
73
84
  */
74
- const SourceConfig = Schema.mutable(Schema.Struct({
85
+ const SourceConfig = Schema.Struct({
75
86
  /** Base URL of the source repository (e.g. `"https://github.com/org/repo/blob/main/src"`). */
76
87
  url: Schema.String,
77
88
  /** Optional git ref (branch, tag, or commit SHA) appended to source links. */
78
89
  ref: Schema.optional(Schema.String)
79
- }));
80
- const ThemeConfig = Schema.Union(Schema.String, Schema.mutable(Schema.Struct({
81
- light: Schema.String,
82
- dark: Schema.String
83
- })), Schema.mutable(Schema.Record({
84
- key: Schema.String,
85
- value: Schema.Unknown
86
- })));
90
+ });
91
+ const ThemeConfig = Schema.Union([
92
+ Schema.String,
93
+ Schema.Struct({
94
+ light: Schema.String,
95
+ dark: Schema.String
96
+ }),
97
+ Schema.Record(Schema.String, Schema.Unknown)
98
+ ]);
87
99
  /**
88
100
  * Built-in default category definitions covering Classes, Interfaces, Functions,
89
101
  * Types, Enums, Variables, and Namespaces.
@@ -156,16 +168,13 @@ const DEFAULT_CATEGORIES = {
156
168
  }
157
169
  };
158
170
  /** Reusable categories record (internal helper) */
159
- const CategoriesRecord = Schema.mutable(Schema.Record({
160
- key: Schema.String,
161
- value: CategoryConfig
162
- }));
171
+ const CategoriesRecord = Schema.Record(Schema.String, CategoryConfig);
163
172
  /**
164
173
  * Configuration for a single version of an API within a multi-version setup.
165
174
  *
166
175
  * @public
167
176
  */
168
- const VersionConfig = Schema.mutable(Schema.Struct({
177
+ const VersionConfig = Schema.Struct({
169
178
  /** Path or loader for the `.api.json` model file for this version. */
170
179
  model: ModelInput,
171
180
  /** Path or loader for the `package.json` for this version. */
@@ -186,15 +195,15 @@ const VersionConfig = Schema.mutable(Schema.Struct({
186
195
  tsconfig: Schema.optional(ModelInput),
187
196
  /** TypeScript compiler options for Twoslash. */
188
197
  compilerOptions: Schema.optional(Schema.Unknown)
189
- }));
198
+ });
190
199
  /** Union for the versions record value: can be a path/function OR a full VersionConfig */
191
- const VersionValue = Schema.Union(ModelInput, VersionConfig);
200
+ const VersionValue = Schema.Union([ModelInput, VersionConfig]);
192
201
  /**
193
202
  * Configuration for a single-package API documentation site (the `api:` option).
194
203
  *
195
204
  * @public
196
205
  */
197
- const SingleApiConfig = Schema.mutable(Schema.Struct({
206
+ const SingleApiConfig = Schema.Struct({
198
207
  /** npm package name of the documented package. */
199
208
  packageName: Schema.String,
200
209
  /** Optional display name shown in the sidebar and page titles. */
@@ -202,16 +211,13 @@ const SingleApiConfig = Schema.mutable(Schema.Struct({
202
211
  /** Base URL route for API pages (defaults to `/api`). */
203
212
  baseRoute: Schema.optional(Schema.String),
204
213
  /** Subfolder name under `baseRoute` for API pages, or `null` to omit. */
205
- apiFolder: Schema.optional(Schema.Union(Schema.String, Schema.Null)),
214
+ apiFolder: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
206
215
  /** Path or loader for the `.api.json` model file. */
207
216
  model: Schema.optional(ModelInput),
208
217
  /** Path or loader for the `package.json`. */
209
218
  packageJson: Schema.optional(ModelInput),
210
219
  /** Versioned models keyed by version label. */
211
- versions: Schema.optional(Schema.mutable(Schema.Record({
212
- key: Schema.String,
213
- value: VersionValue
214
- }))),
220
+ versions: Schema.optional(Schema.Record(Schema.String, VersionValue)),
215
221
  /** Shiki syntax-highlighting theme. */
216
222
  theme: Schema.optional(ThemeConfig),
217
223
  /** Category definitions (defaults to {@link DEFAULT_CATEGORIES}). */
@@ -230,13 +236,13 @@ const SingleApiConfig = Schema.mutable(Schema.Struct({
230
236
  tsconfig: Schema.optional(ModelInput),
231
237
  /** TypeScript compiler options for Twoslash. */
232
238
  compilerOptions: Schema.optional(Schema.Unknown)
233
- }));
239
+ });
234
240
  /**
235
241
  * Configuration for one package in a multi-API portal (each element of the `apis:` array).
236
242
  *
237
243
  * @public
238
244
  */
239
- const MultiApiConfig = Schema.mutable(Schema.Struct({
245
+ const MultiApiConfig = Schema.Struct({
240
246
  /** npm package name of the documented package. */
241
247
  packageName: Schema.String,
242
248
  /** Optional display name shown in the sidebar and page titles. */
@@ -244,7 +250,7 @@ const MultiApiConfig = Schema.mutable(Schema.Struct({
244
250
  /** Base URL route for this package's API pages. */
245
251
  baseRoute: Schema.optional(Schema.String),
246
252
  /** Subfolder name under `baseRoute` for API pages, or `null` to omit. */
247
- apiFolder: Schema.optional(Schema.Union(Schema.String, Schema.Null)),
253
+ apiFolder: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
248
254
  /** Path or loader for the `.api.json` model file (required). */
249
255
  model: ModelInput,
250
256
  /** Path or loader for the `package.json`. */
@@ -267,13 +273,13 @@ const MultiApiConfig = Schema.mutable(Schema.Struct({
267
273
  tsconfig: Schema.optional(ModelInput),
268
274
  /** TypeScript compiler options for Twoslash. */
269
275
  compilerOptions: Schema.optional(Schema.Unknown)
270
- }));
276
+ });
271
277
  /**
272
278
  * Top-level options passed to {@link ApiExtractorPlugin}.
273
279
  *
274
280
  * @public
275
281
  */
276
- const PluginOptions = Schema.mutable(Schema.Struct({
282
+ const PluginOptions = Schema.Struct({
277
283
  /** Single-API configuration (mutually exclusive with `apis`). */
278
284
  api: Schema.optional(SingleApiConfig),
279
285
  /** Multi-API portal configuration (mutually exclusive with `api`). */
@@ -287,14 +293,14 @@ const PluginOptions = Schema.mutable(Schema.Struct({
287
293
  /** Error display options for code examples. */
288
294
  errors: Schema.optional(ErrorConfig),
289
295
  /** LLMs integration options, or `false` to disable. */
290
- llmsPlugin: Schema.optional(Schema.Union(Schema.Boolean, LlmsPlugin)),
296
+ llmsPlugin: Schema.optional(Schema.Union([Schema.Boolean, LlmsPlugin])),
291
297
  /** Verbosity level for plugin build output. @deprecated Use `observability.logLevel`. */
292
- logLevel: Schema.optional(LogLevel$1),
298
+ logLevel: Schema.optional(LogLevel),
293
299
  /** Performance tuning options. @deprecated Use `observability.thresholds`. */
294
300
  performance: Schema.optional(PerformanceConfig),
295
301
  /** Unified observability configuration (logLevel, trace artifact, thresholds). */
296
302
  observability: Schema.optional(ObservabilityConfig)
297
- }));
303
+ });
298
304
 
299
305
  //#endregion
300
- export { AutoDetectDependencies, CategoryConfig, DEFAULT_CATEGORIES, ErrorConfig, ExternalPackageSpec, LlmsPlugin, LogLevel$1 as LogLevel, ModelInput, MultiApiConfig, PluginOptions, SingleApiConfig, SourceConfig, ThemeConfig, VersionConfig };
306
+ export { AutoDetectDependencies, CategoryConfig, DEFAULT_CATEGORIES, ErrorConfig, ExternalPackageSpec, LlmsPlugin, LogLevel, ModelInput, MultiApiConfig, PluginOptions, SingleApiConfig, SourceConfig, ThemeConfig, VersionConfig };
@@ -2,12 +2,20 @@ import { PerformanceThresholds } from "./performance.js";
2
2
  import { Schema } from "effect";
3
3
 
4
4
  //#region src/schemas/observability.ts
5
- const EventLevelSchema = Schema.Literal("none", "error", "warn", "info", "debug", "trace", "verbose");
6
- const ObservabilityConfig = Schema.mutable(Schema.Struct({
5
+ const EventLevelSchema = Schema.Literals([
6
+ "none",
7
+ "error",
8
+ "warn",
9
+ "info",
10
+ "debug",
11
+ "trace",
12
+ "verbose"
13
+ ]);
14
+ const ObservabilityConfig = Schema.Struct({
7
15
  logLevel: Schema.optional(EventLevelSchema),
8
- trace: Schema.optional(Schema.Union(Schema.Boolean, Schema.String)),
16
+ trace: Schema.optional(Schema.Union([Schema.Boolean, Schema.String])),
9
17
  thresholds: Schema.optional(PerformanceThresholds)
10
- }));
18
+ });
11
19
  const DEFAULT_THRESHOLDS = {
12
20
  slowCodeBlock: 500,
13
21
  slowPageGeneration: 500,
@@ -6,7 +6,7 @@ import { Schema } from "effect";
6
6
  *
7
7
  * @public
8
8
  */
9
- const OpenGraphImageMetadata = Schema.mutable(Schema.Struct({
9
+ const OpenGraphImageMetadata = Schema.Struct({
10
10
  /** Absolute URL of the image. */
11
11
  url: Schema.String,
12
12
  /** HTTPS URL of the image (for secure contexts). */
@@ -19,19 +19,19 @@ const OpenGraphImageMetadata = Schema.mutable(Schema.Struct({
19
19
  height: Schema.optional(Schema.Number),
20
20
  /** Alt text for the image. */
21
21
  alt: Schema.optional(Schema.String)
22
- }));
22
+ });
23
23
  /**
24
24
  * Open Graph image: either a plain URL string or structured `OpenGraphImageMetadata`.
25
25
  *
26
26
  * @public
27
27
  */
28
- const OpenGraphImageConfig = Schema.Union(Schema.String, OpenGraphImageMetadata);
28
+ const OpenGraphImageConfig = Schema.Union([Schema.String, OpenGraphImageMetadata]);
29
29
  /**
30
30
  * Resolved Open Graph metadata emitted into each generated page's frontmatter.
31
31
  *
32
32
  * @public
33
33
  */
34
- const OpenGraphMetadata = Schema.mutable(Schema.Struct({
34
+ const OpenGraphMetadata = Schema.Struct({
35
35
  /** Canonical site base URL. */
36
36
  siteUrl: Schema.String,
37
37
  /** Page route path (e.g. `/api/classes/myclass`). */
@@ -50,7 +50,7 @@ const OpenGraphMetadata = Schema.mutable(Schema.Struct({
50
50
  ogImage: Schema.optional(OpenGraphImageMetadata),
51
51
  /** Open Graph object type (e.g. `"article"`). */
52
52
  ogType: Schema.String
53
- }));
53
+ });
54
54
 
55
55
  //#endregion
56
56
  export { OpenGraphImageConfig, OpenGraphImageMetadata };
@@ -1,19 +1,19 @@
1
- import { Schema } from "effect";
1
+ import { Effect, Schema } from "effect";
2
2
 
3
3
  //#region src/schemas/performance.ts
4
- const PerformanceThresholds = Schema.mutable(Schema.Struct({
5
- slowCodeBlock: Schema.optionalWith(Schema.Number, { default: () => 500 }),
6
- slowPageGeneration: Schema.optionalWith(Schema.Number, { default: () => 500 }),
7
- slowApiLoad: Schema.optionalWith(Schema.Number, { default: () => 1e3 }),
8
- slowFileOperation: Schema.optionalWith(Schema.Number, { default: () => 50 }),
9
- slowHttpRequest: Schema.optionalWith(Schema.Number, { default: () => 2e3 }),
10
- slowDbOperation: Schema.optionalWith(Schema.Number, { default: () => 100 })
11
- }));
12
- const PerformanceConfig = Schema.mutable(Schema.Struct({
4
+ const PerformanceThresholds = Schema.Struct({
5
+ slowCodeBlock: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(500))),
6
+ slowPageGeneration: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(500))),
7
+ slowApiLoad: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(1e3))),
8
+ slowFileOperation: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(50))),
9
+ slowHttpRequest: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(2e3))),
10
+ slowDbOperation: Schema.Number.pipe(Schema.withDecodingDefault(Effect.succeed(100)))
11
+ });
12
+ const PerformanceConfig = Schema.Struct({
13
13
  thresholds: Schema.optional(PerformanceThresholds),
14
- showInsights: Schema.optionalWith(Schema.Boolean, { default: () => true }),
15
- trackDetailedMetrics: Schema.optionalWith(Schema.Boolean, { default: () => false })
16
- }));
14
+ showInsights: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
15
+ trackDetailedMetrics: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false)))
16
+ });
17
17
 
18
18
  //#endregion
19
19
  export { PerformanceConfig, PerformanceThresholds };
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
 
3
3
  //#region src/services/ConfigService.ts
4
- var ConfigService = class extends Context.Tag("rspress-plugin-api-extractor/ConfigService")() {};
4
+ var ConfigService = class extends Context.Service()("rspress-plugin-api-extractor/ConfigService") {};
5
5
 
6
6
  //#endregion
7
7
  export { ConfigService };
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
 
3
3
  //#region src/services/PathDerivationService.ts
4
- var PathDerivationService = class extends Context.Tag("rspress-plugin-api-extractor/PathDerivationService")() {};
4
+ var PathDerivationService = class extends Context.Service()("rspress-plugin-api-extractor/PathDerivationService") {};
5
5
 
6
6
  //#endregion
7
7
  export { PathDerivationService };
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
 
3
3
  //#region src/services/SnapshotService.ts
4
- var SnapshotService = class extends Context.Tag("rspress-plugin-api-extractor/SnapshotService")() {};
4
+ var SnapshotService = class extends Context.Service()("rspress-plugin-api-extractor/SnapshotService") {};
5
5
 
6
6
  //#endregion
7
7
  export { SnapshotService };
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
 
3
3
  //#region src/services/TypeRegistryService.ts
4
- var TypeRegistryService = class extends Context.Tag("rspress-plugin-api-extractor/TypeRegistryService")() {};
4
+ var TypeRegistryService = class extends Context.Service()("rspress-plugin-api-extractor/TypeRegistryService") {};
5
5
 
6
6
  //#endregion
7
7
  export { TypeRegistryService };
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.9"
8
+ "packageVersion": "7.58.11"
9
9
  }
10
10
  ]
11
11
  }