@ecopages/mdx 0.2.0-alpha.10 → 0.2.0-alpha.11

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/CHANGELOG.md CHANGED
@@ -8,18 +8,15 @@ All notable changes to `@ecopages/mdx` are documented here.
8
8
 
9
9
  ### Features
10
10
 
11
- - Made the MDX integration standalone so MDX routes can server-render without requiring the React integration.
12
- - Switched MDX compilation to the async pipeline for async remark and rehype plugin support.
11
+ - Added standalone MDX server rendering and async compilation support.
13
12
 
14
13
  ### Bug Fixes
15
14
 
16
- - Fixed configured `.md` extensions to compile as MDX instead of plain markdown so top-level `import` and `export` statements work when `.md` is opted in.
17
- - Fixed loader registration to respect configured extensions so standalone MDX no longer hijacks React `.mdx` pages during shared development and build flows.
18
- - Fixed native Node startup compatibility by using Node-safe `source-map` interop.
15
+ - Fixed `.md` opt-in handling, loader registration, and Node `source-map` interop.
19
16
 
20
17
  ### Refactoring
21
18
 
22
- - Removed the React-specific renderer and HMR code from the package and aligned MDX with the unified orchestration pipeline.
19
+ - Removed the React-specific renderer and HMR path from the package.
23
20
 
24
21
  ### Documentation
25
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopages/mdx",
3
- "version": "0.2.0-alpha.10",
3
+ "version": "0.2.0-alpha.11",
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.10",
40
+ "@ecopages/core": "0.2.0-alpha.11",
41
41
  "@kitajs/html": "^4.1.0",
42
42
  "@mdx-js/mdx": "^3.1.0"
43
43
  },
@@ -33,11 +33,7 @@ export declare class MDXRenderer extends IntegrationRenderer<EcoPagesElement> {
33
33
  compilerOptions?: CompileOptions;
34
34
  });
35
35
  buildRouteRenderAssets(pagePath: string): Promise<ProcessedAsset[]>;
36
- protected importPageFile(file: string): Promise<EcoPageFile<{
37
- layout?: EcoComponent<any> | {
38
- config: EcoComponentConfig | undefined;
39
- };
40
- }>>;
36
+ protected normalizeImportedPageFile<TPageModule extends EcoPageFile>(_file: string, pageModule: TPageModule): TPageModule;
41
37
  render({ params, query, props, locals, pageLocals, metadata, Page, HtmlTemplate, Layout, pageProps, }: MDXIntegrationRendererOpions): Promise<RouteRendererBody>;
42
38
  renderToResponse<P = Record<string, unknown>>(view: EcoComponent<P>, props: P, ctx: RenderToResponseContext): Promise<Response>;
43
39
  }
@@ -34,19 +34,17 @@ class MDXRenderer extends IntegrationRenderer {
34
34
  }
35
35
  return await this.resolveDependencies(components);
36
36
  }
37
- async importPageFile(file) {
37
+ normalizeImportedPageFile(_file, pageModule) {
38
38
  try {
39
- const {
40
- default: Page,
41
- config,
42
- getMetadata
43
- } = await super.importPageFile(file);
39
+ const mdxModule = pageModule;
40
+ const { default: Page, config, getMetadata } = mdxModule;
44
41
  if (typeof Page !== "function") {
45
42
  throw new Error("MDX file must export a default function");
46
43
  }
47
44
  const resolvedLayout = config?.layout;
48
45
  if (config) Page.config = config;
49
46
  return {
47
+ ...pageModule,
50
48
  default: Page,
51
49
  layout: resolvedLayout,
52
50
  getMetadata