@riebeckite/core 0.0.17 → 0.0.19

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.
@@ -4,5 +4,7 @@ import type { RiebeckiteConfig } from "./types/riebeckite_config.js";
4
4
  export declare function defineConfig(config: RiebeckiteConfig): RiebeckiteConfig;
5
5
  export declare function resolveConfigModule(configModule: unknown): ResolvedRiebeckiteConfig;
6
6
  export declare function resolveConfig(config: RiebeckiteConfig): ResolvedRiebeckiteConfig;
7
- export declare function isPublished(config: ResolvedRiebeckiteConfig, frontmatter: PostFrontmatter | undefined): boolean;
7
+ export declare function isPublished(config: ResolvedRiebeckiteConfig, frontmatter: PostFrontmatter | undefined, options?: {
8
+ buildTime?: Date | string;
9
+ }): boolean;
8
10
  export declare function isExcluded(patterns: readonly string[], relativePath: string): boolean;
@@ -12,6 +12,7 @@ export type ContentBuildPreparation = {
12
12
  readonly currentEntries: readonly FingerprintedContentEntry[];
13
13
  readonly currentContentAliases: ReadonlyMap<string, readonly string[]>;
14
14
  readonly currentContentIndex: Map<string, string>;
15
+ readonly currentContentIndexAmbiguities: ReadonlyMap<string, readonly string[]>;
15
16
  readonly changeSet: ContentChangeSet;
16
17
  readonly affectedContent: ReturnType<typeof determineAffectedContent>;
17
18
  };
@@ -1,7 +1,7 @@
1
1
  import type { ContentManifestEntry } from "../types/content_manifest.js";
2
2
  import type { ContentSourceEntry } from "./content_source.js";
3
3
  import type { OutputDescriptor } from "./output_dependency.js";
4
- export declare const CONTENT_BUILD_STATE_VERSION = 7;
4
+ export declare const CONTENT_BUILD_STATE_VERSION = 8;
5
5
  /**
6
6
  * Build state lives under `<content directory>/.riebeckite`. That directory is
7
7
  * build-time state, not content, so content sources must exclude it from scans
@@ -11,4 +11,5 @@ export declare class ContentEntryReader {
11
11
  getEntries(): Promise<readonly ContentSourceEntry[]>;
12
12
  readText(logicalPath: string): Promise<string>;
13
13
  read(entry: ContentSourceEntry): Promise<string>;
14
+ clearReadCache(): void;
14
15
  }
@@ -1,9 +1,13 @@
1
1
  import type { ContentSource, ContentSourceEntry } from "./content_source.js";
2
+ export type ContentIndexBuild = {
3
+ readonly index: Map<string, string>;
4
+ readonly ambiguities: ReadonlyMap<string, readonly string[]>;
5
+ };
2
6
  export declare class ContentIndexBuilder {
3
7
  private source;
4
8
  constructor(source: ContentSource);
5
- build(contentEntries: readonly ContentSourceEntry[], read?: (entry: ContentSourceEntry) => Promise<import("./content_source.js").ContentSourceContent>): Promise<Map<string, string>>;
6
- static buildFromAliases(contentEntries: readonly ContentSourceEntry[], aliasesByPath: ReadonlyMap<string, readonly string[]>): Map<string, string>;
9
+ build(contentEntries: readonly ContentSourceEntry[], read?: (entry: ContentSourceEntry) => Promise<import("./content_source.js").ContentSourceContent>): Promise<ContentIndexBuild>;
10
+ static buildFromAliases(contentEntries: readonly ContentSourceEntry[], aliasesByPath: ReadonlyMap<string, readonly string[]>): ContentIndexBuild;
7
11
  private indexContentEntry;
8
12
  private static indexContentEntryFromAliases;
9
13
  }
@@ -29,6 +29,7 @@ export declare class ContentManager {
29
29
  private manifestBuilder;
30
30
  private pluginRuntime;
31
31
  private contentIndex;
32
+ private contentIndexAmbiguities;
32
33
  private contentIndexPromise;
33
34
  private contentCache;
34
35
  private manifest;
@@ -51,6 +52,7 @@ export declare class ContentManager {
51
52
  getPost(slug: string): Promise<string>;
52
53
  getContentIndex(preparation?: ContentBuildPreparation): Promise<Map<string, string>>;
53
54
  getProcessedContent(slug: string): Promise<PostContent>;
55
+ private processContent;
54
56
  getManifest(options?: ContentBuildOptions): Promise<ContentManifest>;
55
57
  private buildManifest;
56
58
  build(options?: ContentBuildOptions): Promise<ContentManifest>;
@@ -33,4 +33,4 @@ export type FolderLocationResolution = {
33
33
  export declare function resolveFolderEntry(manifest: ContentManifest, folder: string, options?: ResolveFolderEntryOptions): FolderEntryResolution;
34
34
  export declare function resolveFolderLocation(manifest: ContentManifest, folder: string): FolderLocationResolution;
35
35
  export declare function resolvePublicFolderLocation(manifest: ContentManifest, pathname: string): FolderLocationResolution;
36
- export declare function resolveGeneratedFolderLocation(manifest: ContentManifest, folder: string): string | null;
36
+ export declare function resolveGeneratedFolderLocation(manifest: ContentManifest, folder: string, language?: string): string | null;
@@ -3,5 +3,5 @@ import type { PostContent } from "../types/post_content.js";
3
3
  import type { ResolvedPublishingState } from "./publishing.js";
4
4
  export declare class ManifestBuilder {
5
5
  createEntry(slug: string, markdown: string, processed: PostContent, contentIndex: Map<string, string>, location: ContentPublicLocation, publishing: ResolvedPublishingState): ContentManifestEntry;
6
- build(entries: ContentManifestEntry[], contentIndex: Map<string, string>): ContentManifest;
6
+ build(entries: ContentManifestEntry[], contentIndex: Map<string, string>, contentIndexAmbiguities?: ReadonlyMap<string, readonly string[]>): ContentManifest;
7
7
  }
@@ -2,6 +2,7 @@ import type { Tracer } from "../observability.js";
2
2
  import type { RiebeckitePlugin } from "../types/plugin.js";
3
3
  import type { PluginLifecycleContext, PluginManifestContext } from "../types/plugin_context.js";
4
4
  export declare class PluginHookError extends Error {
5
+ readonly path?: string;
5
6
  constructor(pluginName: string, hookName: string, cause: unknown);
6
7
  }
7
8
  export declare function runPluginHook<TContext extends {
@@ -0,0 +1,11 @@
1
+ import type { ResolvedRiebeckiteConfig } from "../types/resolved_riebeckite_config.js";
2
+ /**
3
+ * Root directory for Riebeckite-managed persistent state: content build state,
4
+ * plugin cache, persistent content cache, and the SSG output cache. The root is
5
+ * reproducible and safe to remove; missing paths are not an error.
6
+ */
7
+ export declare function resolveManagedStateRoot(config: ResolvedRiebeckiteConfig | undefined): string | undefined;
8
+ /**
9
+ * Directory for the built site. Missing paths are not an error.
10
+ */
11
+ export declare function resolveBuildOutputDirectory(config: ResolvedRiebeckiteConfig | undefined): string | undefined;
@@ -18,13 +18,36 @@ export type ContentAsset = {
18
18
  export type ContentManifestPluginAsset = PluginAsset & {
19
19
  path: string;
20
20
  };
21
+ /**
22
+ * The standard `article.*` positions the article consumer recognizes.
23
+ *
24
+ * These constants are a convenience for Sites that prefer named references;
25
+ * writing the slot string inline (for example `name="article.metadata"`) stays
26
+ * the recommended, most readable form in TSX layouts.
27
+ */
28
+ export declare const ARTICLE_SLOT: {
29
+ readonly header: "article.header";
30
+ readonly metadata: "article.metadata";
31
+ readonly aside: "article.aside";
32
+ readonly beforeContent: "article.before-content";
33
+ readonly afterContent: "article.after-content";
34
+ readonly footer: "article.footer";
35
+ };
21
36
  /**
22
37
  * A semantic position in a Site-owned article layout.
23
38
  *
24
39
  * The standard article consumer recognizes the `article.*` positions below.
25
40
  * Other names remain valid so a custom Site can define its own layout slots.
26
41
  */
27
- export type ContentBodySlot = "article.header" | "article.metadata" | "article.aside" | "article.before-content" | "article.after-content" | "article.footer" | (string & {});
42
+ export type ContentBodySlot = (typeof ARTICLE_SLOT)[keyof typeof ARTICLE_SLOT] | (string & {});
43
+ /**
44
+ * A map of Plugin-provided HTML fragments keyed by slot name.
45
+ *
46
+ * The standard `article.*` names autocomplete while any custom slot name
47
+ * remains valid, so custom Plugins keep working. A slot is considered empty
48
+ * when its value is missing or whitespace-only.
49
+ */
50
+ export type ContentBodySlots = Partial<Record<(typeof ARTICLE_SLOT)[keyof typeof ARTICLE_SLOT], string>> & Readonly<Record<string, string | undefined>>;
28
51
  /** Client entries and their explicitly public configuration. */
29
52
  export type ContentManifestPluginClientEntry = PluginClientEntry;
30
53
  export type ContentManifestEntry = {
@@ -77,6 +100,8 @@ export type ContentPublicLocation = {
77
100
  };
78
101
  export type FolderLocation = {
79
102
  pathname: string;
103
+ folder?: string;
104
+ language?: string;
80
105
  };
81
106
  export type PluginPageRoute = {
82
107
  pathname: string;
@@ -121,6 +146,13 @@ export type ContentManifest = {
121
146
  outgoingLinks: Map<string, ContentLink[]>;
122
147
  incomingLinks: Map<string, string[]>;
123
148
  contentIndex: Map<string, string>;
149
+ /**
150
+ * Lookup keys that matched more than one candidate, mapped to their
151
+ * candidates (sorted). These keys are intentionally absent from
152
+ * `contentIndex` so links stay unresolved instead of picking a target by
153
+ * discovery order. Used to report actionable ambiguity diagnostics.
154
+ */
155
+ contentIndexAmbiguities?: ReadonlyMap<string, readonly string[]>;
124
156
  graph: ContentGraph;
125
157
  assets: ContentManifestPluginAsset[];
126
158
  /**
@@ -18,7 +18,11 @@ export type PluginPage = {
18
18
  language?: string;
19
19
  };
20
20
  export type PluginPageContext = PluginContext & {
21
- /** The public manifest. Unpublished content is not exposed through pages. */
21
+ /**
22
+ * The resolved manifest. `manifest.entries` still contains `draft` and
23
+ * `scheduled` entries, so page output must read `publicEntries` (routable) or
24
+ * `discoverableEntries` (public only) instead of `entries`.
25
+ */
22
26
  manifest: ContentManifest;
23
27
  /** Request pathname, normalized to an absolute path. */
24
28
  pathname: string;
@@ -25,7 +25,7 @@ export type RenderableFeedEntry = ContentManifestEntry & {
25
25
  html?: string;
26
26
  };
27
27
  export type PluginSeoExtension = {
28
- buildArticleSeo(config: ResolvedRiebeckiteConfig, permalink: string, post: PostContent, headTags?: readonly PluginHeadTag[]): SeoMetadata;
28
+ buildArticleSeo(config: ResolvedRiebeckiteConfig, permalink: string, post: PostContent, headTags?: readonly PluginHeadTag[], language?: string): SeoMetadata;
29
29
  buildWebsiteSeo(config: ResolvedRiebeckiteConfig, input: WebsiteSeoInput, headTags?: readonly PluginHeadTag[]): SeoMetadata;
30
30
  buildAbsoluteUrl(config: ResolvedRiebeckiteConfig, pathOrUrl: string): string;
31
31
  buildPostUrl(config: ResolvedRiebeckiteConfig, permalink: string): string;
@@ -9,6 +9,11 @@ export type ResolvedRiebeckiteConfig = {
9
9
  * relative to their application root.
10
10
  */
11
11
  buildDirectory?: string;
12
+ /**
13
+ * Directory for the built site. Host integrations resolve this relative to
14
+ * their application root.
15
+ */
16
+ outputDirectory?: string;
12
17
  site: Omit<Required<SiteConfig>, "feed"> & {
13
18
  feed: {
14
19
  title: string;
@@ -0,0 +1 @@
1
+ export declare function attachErrorPath<T>(error: T, path: string): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsx": "^4.22.4",
52
- "@riebeckite/test": "0.0.17"
52
+ "@riebeckite/test": "0.0.19"
53
53
  },
54
54
  "repository": {
55
55
  "type": "git",