@riebeckite/core 0.0.1
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/LICENSE +201 -0
- package/README.md +94 -0
- package/README_ja.md +75 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +3040 -0
- package/dist/src/config.d.ts +8 -0
- package/dist/src/config_validation.d.ts +7 -0
- package/dist/src/content/affected_content.d.ts +7 -0
- package/dist/src/content/attachment.d.ts +7 -0
- package/dist/src/content/content_build_coordinator.d.ts +25 -0
- package/dist/src/content/content_build_state.d.ts +22 -0
- package/dist/src/content/content_build_state_store.d.ts +20 -0
- package/dist/src/content/content_change_set.d.ts +10 -0
- package/dist/src/content/content_collection.d.ts +78 -0
- package/dist/src/content/content_entry_reader.d.ts +12 -0
- package/dist/src/content/content_fingerprint.d.ts +3 -0
- package/dist/src/content/content_graph.d.ts +23 -0
- package/dist/src/content/content_index_builder.d.ts +7 -0
- package/dist/src/content/content_links.d.ts +2 -0
- package/dist/src/content/content_location.d.ts +2 -0
- package/dist/src/content/content_location_resolver.d.ts +18 -0
- package/dist/src/content/content_manager.d.ts +59 -0
- package/dist/src/content/content_metadata.d.ts +3 -0
- package/dist/src/content/content_query.d.ts +76 -0
- package/dist/src/content/content_source.d.ts +17 -0
- package/dist/src/content/file_system_content_source.d.ts +11 -0
- package/dist/src/content/graph_layout.d.ts +24 -0
- package/dist/src/content/image_extensions.d.ts +1 -0
- package/dist/src/content/manifest_builder.d.ts +6 -0
- package/dist/src/content/read_only_content_graph.d.ts +4 -0
- package/dist/src/observability.d.ts +70 -0
- package/dist/src/pipeline.d.ts +25 -0
- package/dist/src/plugin/plugin_cache.d.ts +22 -0
- package/dist/src/plugin/plugin_dependency.d.ts +2 -0
- package/dist/src/plugin/plugin_dependency_error.d.ts +20 -0
- package/dist/src/plugin/plugin_lifecycle.d.ts +11 -0
- package/dist/src/plugin/plugin_memo.d.ts +20 -0
- package/dist/src/plugin/plugin_runtime.d.ts +59 -0
- package/dist/src/types/config_validation.d.ts +7 -0
- package/dist/src/types/content_manifest.d.ts +87 -0
- package/dist/src/types/diagnostic.d.ts +15 -0
- package/dist/src/types/generated_output.d.ts +28 -0
- package/dist/src/types/plugin.d.ts +71 -0
- package/dist/src/types/plugin_asset.d.ts +13 -0
- package/dist/src/types/plugin_context.d.ts +85 -0
- package/dist/src/types/plugin_diagnostic.d.ts +5 -0
- package/dist/src/types/plugin_endpoint.d.ts +22 -0
- package/dist/src/types/plugin_head.d.ts +18 -0
- package/dist/src/types/plugin_pipeline.d.ts +20 -0
- package/dist/src/types/plugin_seo.d.ts +40 -0
- package/dist/src/types/post_content.d.ts +20 -0
- package/dist/src/types/publish_strategy.d.ts +19 -0
- package/dist/src/types/resolved_riebeckite_config.d.ts +26 -0
- package/dist/src/types/riebeckite_config.d.ts +23 -0
- package/dist/src/types/site_config.d.ts +14 -0
- package/dist/src/types/theme_config.d.ts +55 -0
- package/dist/src/utils/collections.d.ts +1 -0
- package/dist/src/utils/html.d.ts +2 -0
- package/dist/src/utils/tags.d.ts +1 -0
- package/dist/src/utils/text.d.ts +2 -0
- package/package.json +71 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PostFrontmatter } from "./types/post_content.js";
|
|
2
|
+
import type { ResolvedRiebeckiteConfig } from "./types/resolved_riebeckite_config.js";
|
|
3
|
+
import type { RiebeckiteConfig } from "./types/riebeckite_config.js";
|
|
4
|
+
export declare function defineConfig(config: RiebeckiteConfig): RiebeckiteConfig;
|
|
5
|
+
export declare function resolveConfigModule(configModule: unknown): ResolvedRiebeckiteConfig;
|
|
6
|
+
export declare function resolveConfig(config: RiebeckiteConfig): ResolvedRiebeckiteConfig;
|
|
7
|
+
export declare function isPublished(config: ResolvedRiebeckiteConfig, frontmatter: PostFrontmatter | undefined): boolean;
|
|
8
|
+
export declare function isExcluded(patterns: readonly string[], relativePath: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConfigValidationIssue } from "./types/config_validation.js";
|
|
2
|
+
import type { RiebeckiteConfig } from "./types/riebeckite_config.js";
|
|
3
|
+
export declare class ConfigValidationError extends Error {
|
|
4
|
+
readonly issues: readonly ConfigValidationIssue[];
|
|
5
|
+
constructor(issues: readonly ConfigValidationIssue[]);
|
|
6
|
+
}
|
|
7
|
+
export declare function validateConfig(config: RiebeckiteConfig): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentBuildState } from "./content_build_state.js";
|
|
2
|
+
import type { ContentChangeSet } from "./content_change_set.js";
|
|
3
|
+
export type AffectedContent = {
|
|
4
|
+
readonly direct: ReadonlySet<string>;
|
|
5
|
+
readonly dependent: ReadonlySet<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare function determineAffectedContent(changeSet: ContentChangeSet, previousState: ContentBuildState | undefined, currentPaths: readonly string[]): AffectedContent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ATTACHMENTS_BASE_PATH = "/assets/attachments";
|
|
2
|
+
export declare function isMarkdownPath(filePath: string): boolean;
|
|
3
|
+
export declare function isImagePath(filePath: string): boolean;
|
|
4
|
+
export declare function isAttachmentPath(filePath: string): boolean;
|
|
5
|
+
export declare function getExtension(filePath: string): string;
|
|
6
|
+
export declare function attachmentUrl(filePath: string): string;
|
|
7
|
+
export declare function normalizeContentPath(filePath: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Observability } from "../observability.js";
|
|
2
|
+
import type { ContentManifest } from "../types/content_manifest.js";
|
|
3
|
+
import { type ContentBuildState, type FingerprintedContentEntry } from "./content_build_state.js";
|
|
4
|
+
import { type ContentChangeSet } from "./content_change_set.js";
|
|
5
|
+
import type { ContentSourceEntry } from "./content_source.js";
|
|
6
|
+
export type ContentBuildPreparation = {
|
|
7
|
+
readonly previousState: ContentBuildState | undefined;
|
|
8
|
+
readonly currentEntries: readonly FingerprintedContentEntry[];
|
|
9
|
+
readonly changeSet: ContentChangeSet;
|
|
10
|
+
};
|
|
11
|
+
type ContentBuildCoordinatorDependencies = {
|
|
12
|
+
readonly buildStatePath: string;
|
|
13
|
+
readonly getEntries: () => Promise<readonly ContentSourceEntry[]>;
|
|
14
|
+
readonly readEntry: (entry: ContentSourceEntry) => Promise<string>;
|
|
15
|
+
readonly observability: Observability;
|
|
16
|
+
};
|
|
17
|
+
export declare class ContentBuildCoordinator {
|
|
18
|
+
private readonly dependencies;
|
|
19
|
+
private preparation;
|
|
20
|
+
constructor(dependencies: ContentBuildCoordinatorDependencies);
|
|
21
|
+
getPreparation(incremental: boolean | undefined): Promise<ContentBuildPreparation>;
|
|
22
|
+
commit(preparation: ContentBuildPreparation, manifest: ContentManifest): Promise<void>;
|
|
23
|
+
private prepare;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ContentSourceEntry } from "./content_source.js";
|
|
2
|
+
export declare const CONTENT_BUILD_STATE_VERSION = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Build state lives under `<content directory>/.riebeckite`. That directory is
|
|
5
|
+
* build-time state, not content, so content sources must exclude it from scans
|
|
6
|
+
* to avoid treating the state file itself as a changed content entry.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CONTENT_BUILD_STATE_DIRECTORY = ".riebeckite";
|
|
9
|
+
export declare const CONTENT_BUILD_STATE_EXCLUDE = ".riebeckite/**";
|
|
10
|
+
export type ContentBuildEntry = {
|
|
11
|
+
readonly fingerprint: string;
|
|
12
|
+
readonly dependencies: readonly string[];
|
|
13
|
+
};
|
|
14
|
+
export type ContentBuildState = {
|
|
15
|
+
readonly version: number;
|
|
16
|
+
readonly entries: Readonly<Record<string, ContentBuildEntry>>;
|
|
17
|
+
readonly contentIndex: Readonly<Record<string, string>>;
|
|
18
|
+
};
|
|
19
|
+
export type FingerprintedContentEntry = {
|
|
20
|
+
readonly entry: ContentSourceEntry;
|
|
21
|
+
readonly fingerprint: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResolvedRiebeckiteConfig } from "../types/resolved_riebeckite_config.js";
|
|
2
|
+
import { type ContentBuildState } from "./content_build_state.js";
|
|
3
|
+
export declare function loadContentBuildState(statePath: string): Promise<ContentBuildState | undefined>;
|
|
4
|
+
export type ContentBuildStateInvalidReason = "malformed-json" | "unsupported-version" | "invalid-shape";
|
|
5
|
+
export type ContentBuildStateStatus = {
|
|
6
|
+
kind: "missing";
|
|
7
|
+
path: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "valid";
|
|
10
|
+
path: string;
|
|
11
|
+
version: number;
|
|
12
|
+
entryCount: number;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "invalid";
|
|
15
|
+
path: string;
|
|
16
|
+
reason: ContentBuildStateInvalidReason;
|
|
17
|
+
};
|
|
18
|
+
export declare function readContentBuildStateStatus(statePath: string): Promise<ContentBuildStateStatus>;
|
|
19
|
+
export declare function saveContentBuildState(statePath: string, state: ContentBuildState): Promise<void>;
|
|
20
|
+
export declare function resolveContentBuildStatePath(config: ResolvedRiebeckiteConfig | undefined, contentDirectory: string | undefined): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ContentBuildState, FingerprintedContentEntry } from "./content_build_state.js";
|
|
2
|
+
export type ContentChangeSet = {
|
|
3
|
+
readonly added: readonly string[];
|
|
4
|
+
readonly changed: readonly string[];
|
|
5
|
+
readonly removed: readonly string[];
|
|
6
|
+
readonly unchanged: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function diffContentEntries(previous: ContentBuildState, current: readonly FingerprintedContentEntry[]): ContentChangeSet;
|
|
9
|
+
export declare function allContentChanged(entries: readonly FingerprintedContentEntry[]): ContentChangeSet;
|
|
10
|
+
export declare function hasContentChanges(changeSet: ContentChangeSet): boolean;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ContentManifestEntry } from "../types/content_manifest.js";
|
|
2
|
+
import { type ContentQueryFilter, type ContentQueryGroupBy, type ContentQuerySort, type ContentQuerySortOrder } from "./content_query.js";
|
|
3
|
+
/**
|
|
4
|
+
* Context passed to the optional title/path builders of a collection
|
|
5
|
+
* definition. `value` is the raw group key (for example `Log/Article` or
|
|
6
|
+
* `2025-12`), not a URL.
|
|
7
|
+
*/
|
|
8
|
+
export type ContentCollectionContext = {
|
|
9
|
+
kind: string;
|
|
10
|
+
value: string;
|
|
11
|
+
basePath: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Declarative definition of a taxonomy or archive. A definition groups
|
|
15
|
+
* resolved manifest entries, maps every group to a site-local listing path,
|
|
16
|
+
* and optionally names the collection.
|
|
17
|
+
*/
|
|
18
|
+
export type ContentCollectionDefinition = {
|
|
19
|
+
/** Stable identifier copied onto every generated collection. */
|
|
20
|
+
kind: string;
|
|
21
|
+
/** How entries are grouped (tags, folder, date, or a frontmatter field). */
|
|
22
|
+
groupBy: ContentQueryGroupBy;
|
|
23
|
+
/** Site-local path prefix for the listing pages, for example `/tags`. */
|
|
24
|
+
basePath: string;
|
|
25
|
+
/** Optional filter applied before grouping. */
|
|
26
|
+
filter?: ContentQueryFilter;
|
|
27
|
+
/** Optional sort applied before grouping and inside each listing. */
|
|
28
|
+
sort?: ContentQuerySort | readonly ContentQuerySort[];
|
|
29
|
+
/** Optional ordering of the generated group keys. Defaults to ascending. */
|
|
30
|
+
order?: ContentQuerySortOrder;
|
|
31
|
+
/** Entries per listing page. Omitted or `0` keeps a single page. */
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional display title. Defaults to the raw group value.
|
|
35
|
+
*/
|
|
36
|
+
resolveTitle?: (context: ContentCollectionContext) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional site-local path builder. Defaults to `basePath` plus a slugified
|
|
39
|
+
* group value, so `Log/Article` under `/tags` becomes `/tags/log/article`.
|
|
40
|
+
*/
|
|
41
|
+
resolvePath?: (context: ContentCollectionContext) => string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Pagination state of a generated listing page. When `size` is `0`,
|
|
45
|
+
* pagination is disabled and the single page contains every entry.
|
|
46
|
+
*/
|
|
47
|
+
export type ContentCollectionPage = {
|
|
48
|
+
/** 1-based page number. */
|
|
49
|
+
current: number;
|
|
50
|
+
/** Total number of pages in the collection. */
|
|
51
|
+
count: number;
|
|
52
|
+
/** Entries per page; `0` when pagination is disabled. */
|
|
53
|
+
size: number;
|
|
54
|
+
/** Total number of entries in the collection. */
|
|
55
|
+
total: number;
|
|
56
|
+
/** Site-local path of the previous page, or `null`. */
|
|
57
|
+
previousPath: string | null;
|
|
58
|
+
/** Site-local path of the next page, or `null`. */
|
|
59
|
+
nextPath: string | null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A single generated listing page: one taxonomy value, archive period, or
|
|
63
|
+
* folder, together with the entries it lists in resolved query order.
|
|
64
|
+
*/
|
|
65
|
+
export type ContentCollection = {
|
|
66
|
+
kind: string;
|
|
67
|
+
value: string;
|
|
68
|
+
title: string;
|
|
69
|
+
path: string;
|
|
70
|
+
page: ContentCollectionPage;
|
|
71
|
+
entries: ContentManifestEntry[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Builds listing collections from resolved manifest entries and declarative
|
|
75
|
+
* definitions. It applies the same query engine as `queryContentEntries`, so
|
|
76
|
+
* links inside a listing use the resolved `permalink`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildContentCollections(entries: readonly ContentManifestEntry[], definitions: readonly ContentCollectionDefinition[]): ContentCollection[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observability } from "../observability.js";
|
|
2
|
+
import type { ContentSource, ContentSourceEntry } from "./content_source.js";
|
|
3
|
+
export declare class ContentEntryReader {
|
|
4
|
+
private readonly source;
|
|
5
|
+
private readonly observability;
|
|
6
|
+
private entries;
|
|
7
|
+
private texts;
|
|
8
|
+
constructor(source: ContentSource, observability: Observability);
|
|
9
|
+
getEntries(): Promise<readonly ContentSourceEntry[]>;
|
|
10
|
+
readText(logicalPath: string): Promise<string>;
|
|
11
|
+
read(entry: ContentSourceEntry): Promise<string>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { FingerprintedContentEntry } from "./content_build_state.js";
|
|
2
|
+
import type { ContentSourceContent, ContentSourceEntry } from "./content_source.js";
|
|
3
|
+
export declare function fingerprintContentEntries(entries: readonly ContentSourceEntry[], read: (entry: ContentSourceEntry) => Promise<ContentSourceContent>): Promise<readonly FingerprintedContentEntry[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContentLink, ContentManifestEntry } from "../types/content_manifest.js";
|
|
2
|
+
export type ContentGraphSource = {
|
|
3
|
+
entries: ContentManifestEntry[];
|
|
4
|
+
bySlug: Map<string, ContentManifestEntry>;
|
|
5
|
+
outgoingLinks: Map<string, ContentLink[]>;
|
|
6
|
+
incomingLinks: Map<string, string[]>;
|
|
7
|
+
};
|
|
8
|
+
export type ContentGraph = {
|
|
9
|
+
nodes(): ContentManifestEntry[];
|
|
10
|
+
get(slug: string): ContentManifestEntry | null;
|
|
11
|
+
outgoing(slug: string): ContentManifestEntry[];
|
|
12
|
+
incoming(slug: string): ContentManifestEntry[];
|
|
13
|
+
neighbors(slug: string): ContentManifestEntry[];
|
|
14
|
+
outgoingSlugs(slug: string): string[];
|
|
15
|
+
incomingSlugs(slug: string): string[];
|
|
16
|
+
neighborSlugs(slug: string): string[];
|
|
17
|
+
filterNeighbors(slug: string, include: (neighborSlug: string) => boolean): ContentGraphNeighbors;
|
|
18
|
+
};
|
|
19
|
+
export type ContentGraphNeighbors = {
|
|
20
|
+
outgoingSlugs: string[];
|
|
21
|
+
incomingSlugs: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare function createContentGraph(manifest: ContentGraphSource): ContentGraph;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentSource, ContentSourceEntry } from "./content_source.js";
|
|
2
|
+
export declare class ContentIndexBuilder {
|
|
3
|
+
private source;
|
|
4
|
+
constructor(source: ContentSource);
|
|
5
|
+
build(contentEntries: readonly ContentSourceEntry[], read?: (entry: ContentSourceEntry) => Promise<import("./content_source.js").ContentSourceContent>): Promise<Map<string, string>>;
|
|
6
|
+
private indexContentEntry;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PluginRuntime } from "../plugin/plugin_runtime.js";
|
|
2
|
+
import type { ContentManifest, ContentPublicLocation } from "../types/content_manifest.js";
|
|
3
|
+
import type { ContentSourceEntry } from "./content_source.js";
|
|
4
|
+
type ContentLocationResolverDependencies = {
|
|
5
|
+
readonly getEntries: () => Promise<readonly ContentSourceEntry[]>;
|
|
6
|
+
readonly readEntry: (entry: ContentSourceEntry) => Promise<string>;
|
|
7
|
+
readonly getContentIndex: () => Promise<Map<string, string>>;
|
|
8
|
+
readonly pluginRuntime: PluginRuntime;
|
|
9
|
+
};
|
|
10
|
+
export declare class ContentLocationResolver {
|
|
11
|
+
private readonly dependencies;
|
|
12
|
+
private locations;
|
|
13
|
+
constructor(dependencies: ContentLocationResolverDependencies);
|
|
14
|
+
getLocations(): Promise<ReadonlyMap<string, ContentPublicLocation>>;
|
|
15
|
+
getPermalinks(): Promise<Map<string, string>>;
|
|
16
|
+
populateRedirects(manifest: ContentManifest, locations: ReadonlyMap<string, ContentPublicLocation>): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PipelineOptions } from "../pipeline.js";
|
|
2
|
+
import type { ContentManifest, ContentPublicLocation } from "../types/content_manifest.js";
|
|
3
|
+
import type { Diagnostic } from "../types/diagnostic.js";
|
|
4
|
+
import type { PostContent } from "../types/post_content.js";
|
|
5
|
+
import type { ResolvedRiebeckiteConfig } from "../types/resolved_riebeckite_config.js";
|
|
6
|
+
import { type ContentBuildPreparation } from "./content_build_coordinator.js";
|
|
7
|
+
import type { ContentGraph } from "./content_graph.js";
|
|
8
|
+
import type { ContentSource, ContentSourceEntry } from "./content_source.js";
|
|
9
|
+
export type Backlink = {
|
|
10
|
+
slug: string;
|
|
11
|
+
};
|
|
12
|
+
export type ContentPostReference = {
|
|
13
|
+
slug: string;
|
|
14
|
+
};
|
|
15
|
+
export type ContentBuildOptions = {
|
|
16
|
+
incremental?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ContentInspection = {
|
|
19
|
+
readonly entries: readonly ContentSourceEntry[];
|
|
20
|
+
readonly contentIndex: ReadonlyMap<string, string>;
|
|
21
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
22
|
+
};
|
|
23
|
+
export declare class ContentManager {
|
|
24
|
+
private pipelineOptions;
|
|
25
|
+
private source;
|
|
26
|
+
private contentIndexBuilder;
|
|
27
|
+
private manifestBuilder;
|
|
28
|
+
private pluginRuntime;
|
|
29
|
+
private contentIndex;
|
|
30
|
+
private contentCache;
|
|
31
|
+
private manifest;
|
|
32
|
+
private pipeline;
|
|
33
|
+
private entryReader;
|
|
34
|
+
private locationResolver;
|
|
35
|
+
private buildCoordinator;
|
|
36
|
+
private isBuildTime;
|
|
37
|
+
constructor(content: string | ContentSource, exclude?: string[], pipelineOptions?: PipelineOptions);
|
|
38
|
+
getAllPosts(): Promise<ContentPostReference[]>;
|
|
39
|
+
scan(): Promise<readonly ContentSourceEntry[]>;
|
|
40
|
+
getPost(slug: string): Promise<string>;
|
|
41
|
+
getContentIndex(preparation?: ContentBuildPreparation): Promise<Map<string, string>>;
|
|
42
|
+
getProcessedContent(slug: string): Promise<PostContent>;
|
|
43
|
+
getManifest(options?: ContentBuildOptions): Promise<ContentManifest>;
|
|
44
|
+
build(options?: ContentBuildOptions): Promise<ContentManifest>;
|
|
45
|
+
getBacklinks(targetSlug: string): Promise<Backlink[]>;
|
|
46
|
+
getContentGraph(): Promise<ContentGraph>;
|
|
47
|
+
getDiagnostics(): Promise<Diagnostic[]>;
|
|
48
|
+
inspect(): Promise<ContentInspection>;
|
|
49
|
+
dispose(): Promise<void>;
|
|
50
|
+
getContentLocations(): Promise<ReadonlyMap<string, ContentPublicLocation>>;
|
|
51
|
+
private applyPublicView;
|
|
52
|
+
private enableBuildTime;
|
|
53
|
+
private observability;
|
|
54
|
+
}
|
|
55
|
+
declare module "../pipeline" {
|
|
56
|
+
interface PipelineOptions {
|
|
57
|
+
config?: ResolvedRiebeckiteConfig;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ContentManifestEntry } from "../types/content_manifest.js";
|
|
2
|
+
export type ContentQueryScalar = string | number | boolean;
|
|
3
|
+
export type ContentQueryTagFilter = {
|
|
4
|
+
any?: readonly string[];
|
|
5
|
+
all?: readonly string[];
|
|
6
|
+
none?: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
export type ContentQueryFrontmatterFilter = Record<string, ContentQueryScalar | readonly ContentQueryScalar[]>;
|
|
9
|
+
export type ContentQueryDateFilter = {
|
|
10
|
+
field?: string;
|
|
11
|
+
from?: string;
|
|
12
|
+
to?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ContentQueryFilter = {
|
|
15
|
+
tags?: ContentQueryTagFilter;
|
|
16
|
+
folder?: string | readonly string[];
|
|
17
|
+
frontmatter?: ContentQueryFrontmatterFilter;
|
|
18
|
+
date?: ContentQueryDateFilter;
|
|
19
|
+
};
|
|
20
|
+
export type ContentQuerySortOrder = "asc" | "desc";
|
|
21
|
+
export type ContentQuerySort = {
|
|
22
|
+
field?: string;
|
|
23
|
+
order?: ContentQuerySortOrder;
|
|
24
|
+
};
|
|
25
|
+
export type ContentQuerySpec = {
|
|
26
|
+
filter?: ContentQueryFilter;
|
|
27
|
+
sort?: ContentQuerySort | readonly ContentQuerySort[];
|
|
28
|
+
limit?: number;
|
|
29
|
+
offset?: number;
|
|
30
|
+
};
|
|
31
|
+
export type ContentQueryPagination = {
|
|
32
|
+
/** Number of entries skipped from the start. */
|
|
33
|
+
offset: number;
|
|
34
|
+
/** Entries per page; `0` means pagination is disabled. */
|
|
35
|
+
limit: number;
|
|
36
|
+
/** Total number of entries before pagination. */
|
|
37
|
+
total: number;
|
|
38
|
+
/** 1-based page number for the resolved offset. */
|
|
39
|
+
page: number;
|
|
40
|
+
/** Total number of pages (`0` when there are no entries). */
|
|
41
|
+
pageCount: number;
|
|
42
|
+
hasPrevious: boolean;
|
|
43
|
+
hasNext: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type ContentQueryPage = {
|
|
46
|
+
entries: ContentManifestEntry[];
|
|
47
|
+
page: ContentQueryPagination;
|
|
48
|
+
};
|
|
49
|
+
export type ContentQueryDateGranularity = "year" | "month" | "day";
|
|
50
|
+
export type ContentQueryGroupBy = {
|
|
51
|
+
by: "tags";
|
|
52
|
+
} | {
|
|
53
|
+
by: "folder";
|
|
54
|
+
depth?: number;
|
|
55
|
+
} | {
|
|
56
|
+
by: "date";
|
|
57
|
+
field?: string;
|
|
58
|
+
fields?: readonly string[];
|
|
59
|
+
granularity?: ContentQueryDateGranularity;
|
|
60
|
+
} | {
|
|
61
|
+
by: "frontmatter";
|
|
62
|
+
field: string;
|
|
63
|
+
};
|
|
64
|
+
export type ContentQueryGroup = {
|
|
65
|
+
key: string;
|
|
66
|
+
entries: ContentManifestEntry[];
|
|
67
|
+
};
|
|
68
|
+
export type ContentQueryGroupOptions = {
|
|
69
|
+
filter?: ContentQueryFilter;
|
|
70
|
+
sort?: ContentQuerySort | readonly ContentQuerySort[];
|
|
71
|
+
order?: ContentQuerySortOrder;
|
|
72
|
+
};
|
|
73
|
+
export declare function queryContentEntries(entries: readonly ContentManifestEntry[], spec?: ContentQuerySpec): ContentManifestEntry[];
|
|
74
|
+
export declare function queryContentPage(entries: readonly ContentManifestEntry[], spec?: ContentQuerySpec): ContentQueryPage;
|
|
75
|
+
export declare function resolveContentQueryPagination(total: number, spec?: Pick<ContentQuerySpec, "offset" | "limit">): ContentQueryPagination;
|
|
76
|
+
export declare function groupContentEntries(entries: readonly ContentManifestEntry[], groupBy: ContentQueryGroupBy, options?: ContentQueryGroupOptions): ContentQueryGroup[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ContentSourceMetadata = {
|
|
2
|
+
readonly modifiedAt?: number;
|
|
3
|
+
readonly size?: number;
|
|
4
|
+
readonly etag?: string;
|
|
5
|
+
readonly hash?: string;
|
|
6
|
+
};
|
|
7
|
+
export type ContentSourceEntry = {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly metadata?: ContentSourceMetadata;
|
|
10
|
+
};
|
|
11
|
+
export type ContentSourceContent = string | Uint8Array;
|
|
12
|
+
export interface ContentSource {
|
|
13
|
+
scan(): Promise<readonly ContentSourceEntry[]>;
|
|
14
|
+
read(entry: ContentSourceEntry): Promise<ContentSourceContent>;
|
|
15
|
+
}
|
|
16
|
+
export declare function readContentSourceEntry(source: ContentSource, logicalPath: string): Promise<ContentSourceContent | null>;
|
|
17
|
+
export declare function getContentSourceEntry(source: ContentSource, logicalPath: string): Promise<ContentSourceEntry | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentSource, ContentSourceContent, ContentSourceEntry } from "./content_source.js";
|
|
2
|
+
export declare class FileSystemContentSource implements ContentSource {
|
|
3
|
+
private contentDirectory;
|
|
4
|
+
private exclude;
|
|
5
|
+
constructor(contentDirectory: string, exclude?: readonly string[]);
|
|
6
|
+
scan(): Promise<readonly ContentSourceEntry[]>;
|
|
7
|
+
read(entry: ContentSourceEntry): Promise<ContentSourceContent>;
|
|
8
|
+
private scanDirectory;
|
|
9
|
+
private isExcluded;
|
|
10
|
+
private resolveFilePath;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type GraphEdge = {
|
|
2
|
+
source: string;
|
|
3
|
+
target: string;
|
|
4
|
+
};
|
|
5
|
+
export type LinkableGraphNode = {
|
|
6
|
+
slug: string;
|
|
7
|
+
outgoing: string[];
|
|
8
|
+
backlinks: string[];
|
|
9
|
+
};
|
|
10
|
+
export type GraphLayoutNode = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
radius: number;
|
|
14
|
+
};
|
|
15
|
+
export type RadialGraphLayoutOptions = {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
centerSlug: string;
|
|
19
|
+
radiusRatio?: number;
|
|
20
|
+
minNodeRadius?: number;
|
|
21
|
+
maxNodeRadius?: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function buildGraphEdges<T extends LinkableGraphNode>(nodes: T[], visibleSlugs?: Set<string>): GraphEdge[];
|
|
24
|
+
export declare function layoutRadialGraph<T extends LinkableGraphNode>(nodes: T[], options: RadialGraphLayoutOptions): Map<string, GraphLayoutNode>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IMAGE_EXTENSIONS: string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentManifest, ContentManifestEntry, ContentPublicLocation } from "../types/content_manifest.js";
|
|
2
|
+
import type { PostContent } from "../types/post_content.js";
|
|
3
|
+
export declare class ManifestBuilder {
|
|
4
|
+
createEntry(slug: string, markdown: string, processed: PostContent, contentIndex: Map<string, string>, location: ContentPublicLocation): ContentManifestEntry;
|
|
5
|
+
build(entries: ContentManifestEntry[], contentIndex: Map<string, string>): ContentManifest;
|
|
6
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContentPublicLocation } from "../types/content_manifest.js";
|
|
2
|
+
import type { ContentGraph } from "./content_graph.js";
|
|
3
|
+
import type { ContentSource } from "./content_source.js";
|
|
4
|
+
export declare function readOnlyContentGraph(source: ContentSource, locations: ReadonlyMap<string, ContentPublicLocation>): Promise<ContentGraph>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type ObservabilityValue = string | number | boolean | null;
|
|
2
|
+
export type LogContext = Readonly<Record<string, ObservabilityValue>>;
|
|
3
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
4
|
+
export interface Logger {
|
|
5
|
+
debug(message: string, context?: LogContext): void;
|
|
6
|
+
info(message: string, context?: LogContext): void;
|
|
7
|
+
warn(message: string, context?: LogContext): void;
|
|
8
|
+
error(message: string, context?: LogContext, cause?: Error): void;
|
|
9
|
+
child(context: LogContext): Logger;
|
|
10
|
+
}
|
|
11
|
+
export type TraceAttributes = Readonly<Record<string, ObservabilityValue>>;
|
|
12
|
+
export type TraceSpan = Readonly<{
|
|
13
|
+
name: string;
|
|
14
|
+
startTime: number;
|
|
15
|
+
durationMs: number;
|
|
16
|
+
status: "ok" | "error";
|
|
17
|
+
attributes: TraceAttributes;
|
|
18
|
+
}>;
|
|
19
|
+
export type TraceEvent = Readonly<{
|
|
20
|
+
name: string;
|
|
21
|
+
time: number;
|
|
22
|
+
attributes: TraceAttributes;
|
|
23
|
+
}>;
|
|
24
|
+
export interface TraceSink {
|
|
25
|
+
onSpan(span: TraceSpan): void;
|
|
26
|
+
onEvent(event: TraceEvent): void;
|
|
27
|
+
}
|
|
28
|
+
export interface Tracer {
|
|
29
|
+
span<T>(name: string, attributes: TraceAttributes, fn: () => T | Promise<T>): Promise<T>;
|
|
30
|
+
event(name: string, attributes?: TraceAttributes): void;
|
|
31
|
+
}
|
|
32
|
+
export type Observability = Readonly<{
|
|
33
|
+
logger: Logger;
|
|
34
|
+
tracer: Tracer;
|
|
35
|
+
}>;
|
|
36
|
+
export declare class NoopLogger implements Logger {
|
|
37
|
+
debug(): void;
|
|
38
|
+
info(): void;
|
|
39
|
+
warn(): void;
|
|
40
|
+
error(): void;
|
|
41
|
+
child(): Logger;
|
|
42
|
+
}
|
|
43
|
+
export declare class ConsoleLogger implements Logger {
|
|
44
|
+
private readonly context;
|
|
45
|
+
constructor(context?: LogContext);
|
|
46
|
+
debug(message: string, context?: LogContext): void;
|
|
47
|
+
info(message: string, context?: LogContext): void;
|
|
48
|
+
warn(message: string, context?: LogContext): void;
|
|
49
|
+
error(message: string, context?: LogContext, cause?: Error): void;
|
|
50
|
+
child(context: LogContext): Logger;
|
|
51
|
+
private write;
|
|
52
|
+
}
|
|
53
|
+
export declare class NoopTracer implements Tracer {
|
|
54
|
+
span<T>(_name: string, _attributes: TraceAttributes, fn: () => T | Promise<T>): Promise<T>;
|
|
55
|
+
event(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare class SinkTracer implements Tracer {
|
|
58
|
+
private readonly sink;
|
|
59
|
+
constructor(sink: TraceSink);
|
|
60
|
+
span<T>(name: string, attributes: TraceAttributes, fn: () => T | Promise<T>): Promise<T>;
|
|
61
|
+
event(name: string, attributes?: TraceAttributes): void;
|
|
62
|
+
private emitSpan;
|
|
63
|
+
}
|
|
64
|
+
export declare class CompositeTraceSink implements TraceSink {
|
|
65
|
+
private readonly sinks;
|
|
66
|
+
constructor(sinks: readonly TraceSink[]);
|
|
67
|
+
onSpan(span: TraceSpan): void;
|
|
68
|
+
onEvent(event: TraceEvent): void;
|
|
69
|
+
}
|
|
70
|
+
export declare const noopObservability: Observability;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ContentSource } from "./content/content_source.js";
|
|
2
|
+
import type { Observability } from "./observability.js";
|
|
3
|
+
import type { RiebeckitePlugin } from "./types/plugin.js";
|
|
4
|
+
import type { PostContent } from "./types/post_content.js";
|
|
5
|
+
export interface PipelineOptions {
|
|
6
|
+
plugins?: RiebeckitePlugin[];
|
|
7
|
+
observability?: Observability;
|
|
8
|
+
config?: import("./types/resolved_riebeckite_config.js").ResolvedRiebeckiteConfig;
|
|
9
|
+
contentSource?: ContentSource;
|
|
10
|
+
}
|
|
11
|
+
export declare class Pipeline {
|
|
12
|
+
private contentIndex;
|
|
13
|
+
private permalinks;
|
|
14
|
+
private getMarkdownBySlug?;
|
|
15
|
+
private options;
|
|
16
|
+
private isBuildTime;
|
|
17
|
+
private pluginCaches;
|
|
18
|
+
constructor(contentIndex: Map<string, string>, permalinks: ReadonlyMap<string, string>, getMarkdownBySlug?: (slug: string) => Promise<string>, options?: PipelineOptions, isBuildTime?: boolean);
|
|
19
|
+
execute(markDownContent: string, embedDepth?: number, embedTrail?: Set<string>): Promise<PostContent>;
|
|
20
|
+
private getPermalink;
|
|
21
|
+
private use;
|
|
22
|
+
private createNoteEmbedRenderer;
|
|
23
|
+
private createContentRenderer;
|
|
24
|
+
private cacheFor;
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Logger, Tracer } from "../observability.js";
|
|
2
|
+
import type { ResolvedRiebeckiteConfig } from "../types/resolved_riebeckite_config.js";
|
|
3
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type PluginCache = {
|
|
7
|
+
get<T extends JsonValue>(key: string): Promise<T | undefined>;
|
|
8
|
+
set<T extends JsonValue>(key: string, value: T): Promise<void>;
|
|
9
|
+
delete(key: string): Promise<void>;
|
|
10
|
+
clear(): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export declare function createUnavailablePluginCache(): PluginCache;
|
|
13
|
+
type CreatePluginCacheOptions = {
|
|
14
|
+
pluginName: string;
|
|
15
|
+
cacheVersion?: string;
|
|
16
|
+
cacheDirectory: string;
|
|
17
|
+
logger?: Logger;
|
|
18
|
+
tracer?: Tracer;
|
|
19
|
+
};
|
|
20
|
+
export declare function createPluginCache(options: CreatePluginCacheOptions): PluginCache;
|
|
21
|
+
export declare function resolvePluginCacheDirectory(config: ResolvedRiebeckiteConfig | undefined): string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type PluginDependencyErrorKind = "missing-capability" | "duplicate-provider" | "self-dependency" | "invalid-capability" | "cycle";
|
|
2
|
+
export type CapabilityDeclaration = "provides" | "requires" | "optional";
|
|
3
|
+
export declare class PluginDependencyError extends Error {
|
|
4
|
+
readonly kind: PluginDependencyErrorKind;
|
|
5
|
+
readonly pluginName?: string;
|
|
6
|
+
readonly capability?: string;
|
|
7
|
+
readonly declaration?: CapabilityDeclaration;
|
|
8
|
+
readonly pluginNames: readonly string[];
|
|
9
|
+
readonly chain: readonly string[];
|
|
10
|
+
readonly availableCapabilities: readonly string[];
|
|
11
|
+
constructor(input: {
|
|
12
|
+
kind: PluginDependencyErrorKind;
|
|
13
|
+
pluginName?: string;
|
|
14
|
+
capability?: string;
|
|
15
|
+
declaration?: CapabilityDeclaration;
|
|
16
|
+
pluginNames?: readonly string[];
|
|
17
|
+
chain?: readonly string[];
|
|
18
|
+
availableCapabilities?: readonly string[];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RiebeckitePlugin } from "../types/plugin.js";
|
|
2
|
+
import type { PluginLifecycleContext, PluginManifestContext } from "../types/plugin_context.js";
|
|
3
|
+
type LifecycleHookName = "setup" | "buildStart" | "buildEnd" | "dispose";
|
|
4
|
+
export declare class PluginLifecycleError extends Error {
|
|
5
|
+
constructor(pluginName: string, hookName: LifecycleHookName, cause: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare function runSetup(plugins: readonly RiebeckitePlugin[], createContext: (plugin: RiebeckitePlugin) => PluginLifecycleContext): Promise<void>;
|
|
8
|
+
export declare function runBuildStart(plugins: readonly RiebeckitePlugin[], createContext: (plugin: RiebeckitePlugin) => PluginLifecycleContext): Promise<void>;
|
|
9
|
+
export declare function runBuildEnd(plugins: readonly RiebeckitePlugin[], createContext: (plugin: RiebeckitePlugin) => PluginManifestContext): Promise<void>;
|
|
10
|
+
export declare function runDispose(plugins: readonly RiebeckitePlugin[], createContext: (plugin: RiebeckitePlugin) => PluginLifecycleContext): Promise<void>;
|
|
11
|
+
export {};
|