rspress-plugin-api-extractor 0.10.0 → 0.12.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/BuildEnv.js +58 -0
- package/build-program.js +34 -33
- package/build-stages.js +48 -42
- package/config-helpers.js +7 -7
- package/errors.js +1 -6
- package/index.d.ts +84 -86
- package/layers/AppLayer.js +67 -0
- package/layers/api-results.js +83 -0
- package/layers/build-metrics.js +1 -1
- package/layers/config-resolution.js +407 -0
- package/layers/external-types.js +74 -0
- package/layers/{ObservabilityLive.js → observability.js} +3 -3
- package/layers/type-environment.js +109 -0
- package/layers/xdg.js +44 -0
- package/markdown/helpers.js +9 -55
- package/markdown/page-generators/class-page.js +8 -31
- package/markdown/page-generators/index-pages.js +6 -8
- package/markdown/page-generators/interface-page.js +7 -7
- package/markdown/shiki-utils.js +65 -10
- package/model-loader.js +3 -3
- package/observability/EventBus.js +29 -7
- package/observability/heartbeat.js +1 -1
- package/observability/sinks/metrics-sink.js +1 -1
- package/observability/sinks/trace-sink.js +4 -4
- package/observability/spans.js +3 -1
- package/observability/sync-emitter.js +78 -0
- package/og-resolver.js +74 -284
- package/package.json +3 -4
- package/path-derivation.js +19 -1
- package/plugin.js +63 -91
- package/prettier-formatter.js +5 -11
- package/remark-api-codeblocks.js +11 -19
- package/remark-with-api.js +11 -21
- package/schemas/config.js +0 -2
- package/services/ConfigService.js +37 -2
- package/services/HighlighterService.js +75 -0
- package/services/OgService.js +190 -0
- package/services/PluginConfig.js +26 -0
- package/services/TwoslashCacheService.js +128 -2
- package/services/TwoslashEnvironments.js +35 -0
- package/services/TypeRegistryService.js +178 -2
- package/shiki-transformer.js +53 -234
- package/sync-node-fs.js +6 -6
- package/tsconfig-parser.js +77 -95
- package/twoslash-access.js +48 -0
- package/twoslash-transformer.js +106 -83
- package/vfs-registry.js +1 -31
- package/layers/ConfigServiceLive.js +0 -600
- package/layers/PathDerivationServiceLive.js +0 -16
- package/layers/TwoslashCacheServiceLive.js +0 -53
- package/layers/TypeRegistryServiceLive.js +0 -155
- package/markdown/index.js +0 -11
- package/schemas/index.js +0 -6
- package/services/PathDerivationService.js +0 -7
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { PluginEvent } from "../observability/events.js";
|
|
2
|
-
import { emit } from "../observability/EventBus.js";
|
|
3
|
-
import { resolveExternalPackageVersions } from "../config-utils.js";
|
|
4
|
-
import { TypeRegistryError } from "../errors.js";
|
|
5
|
-
import { TypeRegistryService } from "../services/TypeRegistryService.js";
|
|
6
|
-
import { NodeFileSystem, NodeHttpClient } from "@effect/platform-node";
|
|
7
|
-
import { Duration, Effect, Layer, Path } from "effect";
|
|
8
|
-
import { PackageFetcher, PackageSpec, RegistryObserver, TypeCache, TypeRegistry } from "@tsdoctor/registry";
|
|
9
|
-
import { Cache } from "@effected/store";
|
|
10
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
11
|
-
|
|
12
|
-
//#region src/layers/TypeRegistryServiceLive.ts
|
|
13
|
-
/**
|
|
14
|
-
* Forward @tsdoctor/registry's typed `RegistryEvent`s to the plugin's Effect
|
|
15
|
-
* logger. Since v1 the library emits no logs of its own — observers are the only
|
|
16
|
-
* diagnostic surface — so this restores the build output and routes it through
|
|
17
|
-
* the plugin's configured log level/format (a single source, no duplication).
|
|
18
|
-
*
|
|
19
|
-
* The summary (`BatchComplete`) and failures are surfaced at info/warning;
|
|
20
|
-
* per-package detail stays at debug so a normal build is quiet.
|
|
21
|
-
*/
|
|
22
|
-
const RegistryObserverLayer = Layer.succeed(RegistryObserver, { emit: (event) => {
|
|
23
|
-
switch (event._tag) {
|
|
24
|
-
case "VersionResolved": return emit(PluginEvent.TypeRegistryEvent({
|
|
25
|
-
ctx: {
|
|
26
|
-
buildId: "",
|
|
27
|
-
packageName: event.package
|
|
28
|
-
},
|
|
29
|
-
level: "debug",
|
|
30
|
-
kind: "VersionResolved",
|
|
31
|
-
detail: `${event.requested} -> ${event.resolved}`
|
|
32
|
-
}));
|
|
33
|
-
case "VersionResolveFailed": return emit(PluginEvent.TypeRegistryEvent({
|
|
34
|
-
ctx: {
|
|
35
|
-
buildId: "",
|
|
36
|
-
packageName: event.package
|
|
37
|
-
},
|
|
38
|
-
level: "debug",
|
|
39
|
-
kind: "VersionResolveFailed",
|
|
40
|
-
detail: `${event.requested}: ${event.kind}`
|
|
41
|
-
}));
|
|
42
|
-
case "CacheHit":
|
|
43
|
-
case "CacheMiss":
|
|
44
|
-
case "FetchStart": return emit(PluginEvent.TypeRegistryEvent({
|
|
45
|
-
ctx: {
|
|
46
|
-
buildId: "",
|
|
47
|
-
packageName: event.package,
|
|
48
|
-
version: event.version
|
|
49
|
-
},
|
|
50
|
-
level: "debug",
|
|
51
|
-
kind: event._tag,
|
|
52
|
-
detail: ""
|
|
53
|
-
}));
|
|
54
|
-
case "CacheStale": return emit(PluginEvent.TypeRegistryEvent({
|
|
55
|
-
ctx: {
|
|
56
|
-
buildId: "",
|
|
57
|
-
packageName: event.package,
|
|
58
|
-
version: event.version
|
|
59
|
-
},
|
|
60
|
-
level: "debug",
|
|
61
|
-
kind: "CacheStale",
|
|
62
|
-
detail: ""
|
|
63
|
-
}));
|
|
64
|
-
case "FetchFailed": return emit(PluginEvent.TypeRegistryEvent({
|
|
65
|
-
ctx: { buildId: "" },
|
|
66
|
-
level: "debug",
|
|
67
|
-
kind: "FetchFailed",
|
|
68
|
-
detail: `HTTP ${event.status}: ${event.url}${event.bodySnippet ? ` — ${event.bodySnippet}` : ""}`
|
|
69
|
-
}));
|
|
70
|
-
case "PackageLoaded": return emit(PluginEvent.TypeRegistryEvent({
|
|
71
|
-
ctx: {
|
|
72
|
-
buildId: "",
|
|
73
|
-
packageName: event.package,
|
|
74
|
-
version: event.version
|
|
75
|
-
},
|
|
76
|
-
level: "debug",
|
|
77
|
-
kind: "PackageLoaded",
|
|
78
|
-
detail: `${event.files} files, ${event.source}`
|
|
79
|
-
}));
|
|
80
|
-
case "PackageLoadFailed": return emit(PluginEvent.TypeRegistryEvent({
|
|
81
|
-
ctx: {
|
|
82
|
-
buildId: "",
|
|
83
|
-
packageName: event.package,
|
|
84
|
-
version: event.version
|
|
85
|
-
},
|
|
86
|
-
level: "warn",
|
|
87
|
-
kind: "PackageLoadFailed",
|
|
88
|
-
detail: `[${event.kind}] ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
89
|
-
}));
|
|
90
|
-
case "BatchStart": return emit(PluginEvent.TypeRegistryEvent({
|
|
91
|
-
ctx: { buildId: "" },
|
|
92
|
-
level: "debug",
|
|
93
|
-
kind: "BatchStart",
|
|
94
|
-
detail: `${event.total} package(s)`
|
|
95
|
-
}));
|
|
96
|
-
case "BatchComplete": return emit(PluginEvent.TypeRegistryEvent({
|
|
97
|
-
ctx: { buildId: "" },
|
|
98
|
-
level: "info",
|
|
99
|
-
kind: "BatchComplete",
|
|
100
|
-
detail: `${event.loaded}/${event.total} packages, ${event.totalFiles} files, ${Math.round(Duration.toMillis(event.duration))}ms`
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
} });
|
|
104
|
-
/**
|
|
105
|
-
* @tsdoctor/registry composes at the edge: the library ships no platform
|
|
106
|
-
* layer of its own, so the plugin wires FileSystem/Path, the XDG directories,
|
|
107
|
-
* the sqlite metadata Cache and the HTTP client here.
|
|
108
|
-
*
|
|
109
|
-
* All layers are bound to module-level consts (never rebuilt per call) per the
|
|
110
|
-
* v4 layer memoization discipline.
|
|
111
|
-
*/
|
|
112
|
-
const PlatformLive = Layer.mergeAll(NodeFileSystem.layer, Path.layer);
|
|
113
|
-
/**
|
|
114
|
-
* XDG app directories under the tsdoctor-wide namespace. Renamed from the
|
|
115
|
-
* legacy "type-registry-effect" namespace in phase 2 per the resolved identity
|
|
116
|
-
* decision (see tsdoctor-package-architecture.md) — a deliberate one-time
|
|
117
|
-
* on-disk cache invalidation: existing caches go cold and refetch.
|
|
118
|
-
*/
|
|
119
|
-
const AppDirsLive = AppDirs.layer({ namespace: "tsdoctor" }).pipe(Layer.provide(Layer.mergeAll(Xdg.layer, PlatformLive)));
|
|
120
|
-
/** Metadata plane: a sqlite-backed `@effected/store` Cache rooted in the XDG cache dir. */
|
|
121
|
-
const MetadataCacheLive = Layer.unwrap(Effect.gen(function* () {
|
|
122
|
-
const appDirs = yield* AppDirs;
|
|
123
|
-
const path = yield* Path.Path;
|
|
124
|
-
const cacheDir = yield* appDirs.ensureCache;
|
|
125
|
-
return Cache.layerSqlite({ filename: path.join(cacheDir, "metadata.sqlite") });
|
|
126
|
-
})).pipe(Layer.provide(Layer.mergeAll(AppDirsLive, PlatformLive)));
|
|
127
|
-
/**
|
|
128
|
-
* The full registry runtime: TypeRegistry over an XDG-rooted TypeCache and the
|
|
129
|
-
* jsDelivr PackageFetcher, with the observer that forwards registry events to
|
|
130
|
-
* the plugin's EventBus (found ambiently via serviceOption at emit time).
|
|
131
|
-
*/
|
|
132
|
-
const RegistryLayer = TypeRegistry.layer.pipe(Layer.provideMerge(Layer.mergeAll(TypeCache.layerXdg(), PackageFetcher.layer)), Layer.provideMerge(RegistryObserverLayer), Layer.provide(Layer.mergeAll(MetadataCacheLive, AppDirsLive, PlatformLive, NodeHttpClient.layerUndici)));
|
|
133
|
-
/**
|
|
134
|
-
* TypeRegistryServiceLive: uses @tsdoctor/registry Effect programs directly.
|
|
135
|
-
*/
|
|
136
|
-
const TypeRegistryServiceLive = Layer.succeed(TypeRegistryService, {
|
|
137
|
-
resolveVersions: (packages) => Effect.gen(function* () {
|
|
138
|
-
const registry = yield* TypeRegistry;
|
|
139
|
-
return yield* resolveExternalPackageVersions(packages, (pkg) => registry.resolveVersion(pkg.name, pkg.version));
|
|
140
|
-
}).pipe(Effect.provide(RegistryLayer), Effect.catch(() => Effect.succeed([...packages]))),
|
|
141
|
-
loadPackages: (packages) => packages.length === 0 ? Effect.succeed({ vfs: /* @__PURE__ */ new Map() }) : Effect.gen(function* () {
|
|
142
|
-
const specs = packages.map((pkg) => new PackageSpec({
|
|
143
|
-
name: pkg.name,
|
|
144
|
-
version: pkg.version
|
|
145
|
-
}));
|
|
146
|
-
return { vfs: yield* (yield* TypeRegistry).getVfs(specs, { autoFetch: true }) };
|
|
147
|
-
}).pipe(Effect.provide(RegistryLayer), Effect.catch((error) => Effect.fail(new TypeRegistryError({
|
|
148
|
-
packageName: packages.map((p) => p.name).join(", "),
|
|
149
|
-
version: packages.map((p) => p.version).join(", "),
|
|
150
|
-
reason: error instanceof Error ? error.message ?? String(error) : String(error)
|
|
151
|
-
}))))
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
//#endregion
|
|
155
|
-
export { TypeRegistryServiceLive };
|
package/markdown/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { linkProse, setProseLinker } from "./prose-linker.js";
|
|
2
|
-
import { ClassPageGenerator } from "./page-generators/class-page.js";
|
|
3
|
-
import { EnumPageGenerator } from "./page-generators/enum-page.js";
|
|
4
|
-
import { FunctionPageGenerator } from "./page-generators/function-page.js";
|
|
5
|
-
import { MainIndexPageGenerator } from "./page-generators/index-pages.js";
|
|
6
|
-
import { InterfacePageGenerator } from "./page-generators/interface-page.js";
|
|
7
|
-
import { NamespacePageGenerator } from "./page-generators/namespace-page.js";
|
|
8
|
-
import { TypeAliasPageGenerator } from "./page-generators/type-alias-page.js";
|
|
9
|
-
import { VariablePageGenerator } from "./page-generators/variable-page.js";
|
|
10
|
-
|
|
11
|
-
export { ClassPageGenerator, EnumPageGenerator, FunctionPageGenerator, InterfacePageGenerator, MainIndexPageGenerator, NamespacePageGenerator, TypeAliasPageGenerator, VariablePageGenerator, setProseLinker };
|
package/schemas/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PerformanceConfig, PerformanceThresholds } from "./performance.js";
|
|
2
|
-
import { EventLevelSchema, ObservabilityConfig, resolveObservability } from "./observability.js";
|
|
3
|
-
import { OpenGraphImageConfig, OpenGraphImageMetadata } from "./opengraph.js";
|
|
4
|
-
import { AutoDetectDependencies, CategoryConfig, DEFAULT_CATEGORIES, ErrorConfig, ExternalPackageSpec, LlmsPlugin, LogLevel, ModelInput, MultiApiConfig, PluginOptions, SingleApiConfig, SourceConfig, ThemeConfig, VersionConfig } from "./config.js";
|
|
5
|
-
|
|
6
|
-
export { DEFAULT_CATEGORIES, PluginOptions };
|