@riebeckite/core 0.0.11 → 0.0.12
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/dist/index.d.ts +1 -1
- package/dist/index.js +16 -11
- package/dist/src/pipeline.d.ts +3 -1
- package/dist/src/types/plugin_pipeline.d.ts +6 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export type { PluginDiagnostic, PluginDiagnosticLevel, } from "./src/types/plugi
|
|
|
47
47
|
export type { PluginEndpoint, PluginEndpointContext, PluginEndpointMethod, PluginEndpointOptions, PluginEndpointRequest, PluginEndpointResponse, } from "./src/types/plugin_endpoint.js";
|
|
48
48
|
export { defineEndpoint } from "./src/types/plugin_endpoint.js";
|
|
49
49
|
export type { PluginHeadTag } from "./src/types/plugin_head.js";
|
|
50
|
-
export type { HtmlPipeline, MarkdownEmbedFragment, MarkdownPipeline, MarkdownPipelineContext, PipelinePlugin, } from "./src/types/plugin_pipeline.js";
|
|
50
|
+
export type { HtmlPipeline, MarkdownEmbedFragment, MarkdownExecutionContext, MarkdownPipeline, MarkdownPipelineContext, PipelinePlugin, } from "./src/types/plugin_pipeline.js";
|
|
51
51
|
export type { PluginSeoExtension, RenderableFeedEntry, SeoMetadata, WebsiteSeoInput, } from "./src/types/plugin_seo.js";
|
|
52
52
|
export type { PostContent, PostFrontmatter } from "./src/types/post_content.js";
|
|
53
53
|
export type { PublishFrontmatter, PublishStrategy, } from "./src/types/publish_strategy.js";
|
package/dist/index.js
CHANGED
|
@@ -1546,7 +1546,15 @@ var Pipeline = class {
|
|
|
1546
1546
|
options;
|
|
1547
1547
|
isBuildTime;
|
|
1548
1548
|
pluginCaches = /* @__PURE__ */ new Map();
|
|
1549
|
-
async execute(markDownContent,
|
|
1549
|
+
async execute(markDownContent, context = {}) {
|
|
1550
|
+
return await this.executeWithEmbedState(
|
|
1551
|
+
markDownContent,
|
|
1552
|
+
context,
|
|
1553
|
+
0,
|
|
1554
|
+
new Set(context.sourceSlug ? [context.sourceSlug] : [])
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
async executeWithEmbedState(markDownContent, context, embedDepth, embedTrail) {
|
|
1550
1558
|
const processor = unified();
|
|
1551
1559
|
const plugins = resolvePlugins(this.options.plugins);
|
|
1552
1560
|
this.use(processor, remarkParse);
|
|
@@ -1560,7 +1568,7 @@ var Pipeline = class {
|
|
|
1560
1568
|
this.use(processor, remarkMath);
|
|
1561
1569
|
this.use(processor, remarkGfm);
|
|
1562
1570
|
const markdownPipelineContext = {
|
|
1563
|
-
sourceSlug,
|
|
1571
|
+
sourceSlug: context.sourceSlug,
|
|
1564
1572
|
contentIndex: this.contentIndex,
|
|
1565
1573
|
resolvePermalink: (slug) => this.getPermalink(slug),
|
|
1566
1574
|
renderNoteEmbed: this.createNoteEmbedRenderer(embedDepth, embedTrail),
|
|
@@ -1626,11 +1634,11 @@ var Pipeline = class {
|
|
|
1626
1634
|
if (!markdown) return null;
|
|
1627
1635
|
const nextEmbedTrail = new Set(embedTrail);
|
|
1628
1636
|
nextEmbedTrail.add(slug);
|
|
1629
|
-
const content = await this.
|
|
1637
|
+
const content = await this.executeWithEmbedState(
|
|
1630
1638
|
markdown,
|
|
1639
|
+
{ sourceSlug: slug },
|
|
1631
1640
|
embedDepth + 1,
|
|
1632
|
-
nextEmbedTrail
|
|
1633
|
-
slug
|
|
1641
|
+
nextEmbedTrail
|
|
1634
1642
|
);
|
|
1635
1643
|
return content.html;
|
|
1636
1644
|
};
|
|
@@ -2785,12 +2793,9 @@ var ContentManager = class {
|
|
|
2785
2793
|
this.pipelineOptions,
|
|
2786
2794
|
this.isBuildTime
|
|
2787
2795
|
);
|
|
2788
|
-
const content = await this.pipeline.execute(
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
/* @__PURE__ */ new Set([slug]),
|
|
2792
|
-
slug
|
|
2793
|
-
);
|
|
2796
|
+
const content = await this.pipeline.execute(rawPost, {
|
|
2797
|
+
sourceSlug: slug
|
|
2798
|
+
});
|
|
2794
2799
|
await this.pluginRuntime.runPostHook(
|
|
2795
2800
|
"onPostParsed",
|
|
2796
2801
|
slug,
|
package/dist/src/pipeline.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ContentSource } from "./content/content_source.js";
|
|
2
2
|
import type { Observability } from "./observability.js";
|
|
3
3
|
import type { RiebeckitePlugin } from "./types/plugin.js";
|
|
4
|
+
import type { MarkdownExecutionContext } from "./types/plugin_pipeline.js";
|
|
4
5
|
import type { PostContent } from "./types/post_content.js";
|
|
5
6
|
export interface PipelineOptions {
|
|
6
7
|
plugins?: RiebeckitePlugin[];
|
|
@@ -16,7 +17,8 @@ export declare class Pipeline {
|
|
|
16
17
|
private isBuildTime;
|
|
17
18
|
private pluginCaches;
|
|
18
19
|
constructor(contentIndex: Map<string, string>, permalinks: ReadonlyMap<string, string>, getMarkdownBySlug?: (slug: string) => Promise<string>, options?: PipelineOptions, isBuildTime?: boolean);
|
|
19
|
-
execute(markDownContent: string,
|
|
20
|
+
execute(markDownContent: string, context?: MarkdownExecutionContext): Promise<PostContent>;
|
|
21
|
+
private executeWithEmbedState;
|
|
20
22
|
private getPermalink;
|
|
21
23
|
private use;
|
|
22
24
|
private createNoteEmbedRenderer;
|
|
@@ -6,9 +6,14 @@ export type MarkdownPipeline = {
|
|
|
6
6
|
use(plugin: PipelinePlugin, options?: unknown): void;
|
|
7
7
|
};
|
|
8
8
|
export type HtmlPipeline = MarkdownPipeline;
|
|
9
|
-
|
|
9
|
+
/** Identifies the source being processed by a Markdown pipeline execution. */
|
|
10
|
+
export type MarkdownExecutionContext = {
|
|
10
11
|
/** Slug of the content currently being rendered, when available. */
|
|
11
12
|
sourceSlug?: string;
|
|
13
|
+
};
|
|
14
|
+
export type MarkdownPipelineContext = {
|
|
15
|
+
/** Source identity supplied for this execution, when available. */
|
|
16
|
+
sourceSlug?: MarkdownExecutionContext["sourceSlug"];
|
|
12
17
|
contentIndex: Map<string, string>;
|
|
13
18
|
resolvePermalink: (slug: string) => string;
|
|
14
19
|
renderNoteEmbed?: (slug: string, fragment: MarkdownEmbedFragment | null) => Promise<string | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
|
-
"@riebeckite/test": "0.0.
|
|
46
|
+
"@riebeckite/test": "0.0.12"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|