@ecopages/mdx 0.2.0-alpha.23 → 0.2.0-alpha.25
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/package.json +2 -2
- package/src/mdx-renderer.d.ts +1 -0
- package/src/mdx-renderer.js +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/mdx",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.25",
|
|
4
4
|
"description": "MDX plugin for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"directory": "packages/integrations/mdx"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
40
|
+
"@ecopages/core": "0.2.0-alpha.25",
|
|
41
41
|
"@kitajs/html": "^4.1.0",
|
|
42
42
|
"@mdx-js/mdx": "^3.1.0"
|
|
43
43
|
},
|
package/src/mdx-renderer.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ interface MDXIntegrationRendererOptions<C = EcoPagesElement> extends Integration
|
|
|
19
19
|
export declare class MDXRenderer extends IntegrationRenderer<EcoPagesElement> {
|
|
20
20
|
name: string;
|
|
21
21
|
readonly compilerOptions: CompileOptions;
|
|
22
|
+
private isFunctionComponent;
|
|
22
23
|
constructor({ mdxConfig, ...options }: MDXRendererOptions);
|
|
23
24
|
buildRouteRenderAssets(pagePath: string): Promise<ProcessedAsset[]>;
|
|
24
25
|
protected normalizeImportedPageFile<TPageModule extends EcoPageFile>(_file: string, pageModule: TPageModule): TPageModule;
|
package/src/mdx-renderer.js
CHANGED
|
@@ -5,6 +5,9 @@ import { rapidhash } from "@ecopages/core/hash";
|
|
|
5
5
|
class MDXRenderer extends IntegrationRenderer {
|
|
6
6
|
name = MDX_PLUGIN_NAME;
|
|
7
7
|
compilerOptions;
|
|
8
|
+
isFunctionComponent(component) {
|
|
9
|
+
return typeof component === "function";
|
|
10
|
+
}
|
|
8
11
|
constructor({ mdxConfig, ...options }) {
|
|
9
12
|
super(options);
|
|
10
13
|
this.compilerOptions = mdxConfig?.compilerOptions ?? {};
|
|
@@ -51,10 +54,10 @@ class MDXRenderer extends IntegrationRenderer {
|
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
async renderComponent(input) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
57
|
+
if (!this.isFunctionComponent(input.component)) {
|
|
58
|
+
throw new TypeError("MDX renderer expected a callable component.");
|
|
59
|
+
}
|
|
60
|
+
return this.renderStringComponentBoundaryWithQueuedForeignBoundaries(input, input.component);
|
|
58
61
|
}
|
|
59
62
|
createComponentBoundaryRuntime(options) {
|
|
60
63
|
return this.createQueuedBoundaryRuntime({
|