@ecopages/react 0.2.0-alpha.33 → 0.2.0-alpha.35

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopages/react",
3
- "version": "0.2.0-alpha.33",
3
+ "version": "0.2.0-alpha.35",
4
4
  "description": "React integration for Ecopages",
5
5
  "keywords": [
6
6
  "ecopages",
@@ -53,17 +53,17 @@
53
53
  "directory": "packages/integrations/react"
54
54
  },
55
55
  "peerDependencies": {
56
- "@ecopages/core": "0.2.0-alpha.33",
56
+ "@ecopages/core": "0.2.0-alpha.34",
57
57
  "@types/react": "^19",
58
58
  "@types/react-dom": "^19",
59
59
  "react": "^19",
60
60
  "react-dom": "^19"
61
61
  },
62
62
  "dependencies": {
63
- "@ecopages/file-system": "0.2.0-alpha.33",
63
+ "@ecopages/file-system": "0.2.0-alpha.34",
64
64
  "@ecopages/logger": "^0.2.3",
65
- "@mdx-js/esbuild": "^3.0.1",
66
- "@mdx-js/mdx": "^3.1.0",
65
+ "@mdx-js/esbuild": "^3.1.1",
66
+ "@mdx-js/mdx": "^3.1.1",
67
67
  "oxc-parser": "^0.124.0",
68
68
  "oxc-transform": "^0.124.0",
69
69
  "source-map": "^0.7.6",
@@ -7,6 +7,7 @@ import { Logger } from "@ecopages/logger";
7
7
  import { injectHmrHandler } from "./utils/hmr-scripts.js";
8
8
  import { createClientGraphBoundaryPlugin } from "./utils/client-graph-boundary-plugin.js";
9
9
  import { collectPageDeclaredModules, collectPageDeclaredModulesFromModule } from "./utils/declared-modules.js";
10
+ import { createReactMdxLoaderPlugin } from "./utils/react-mdx-loader-plugin.js";
10
11
  import { getReactClientGraphAllowSpecifiers } from "./utils/react-runtime-alias-map.js";
11
12
  import { createUseSyncExternalStoreShimPlugin } from "./utils/use-sync-external-store-shim-plugin.js";
12
13
  const appLogger = new Logger("[ReactHmrStrategy]");
@@ -71,10 +72,13 @@ class ReactHmrStrategy extends HmrStrategy {
71
72
  if (!filePath.endsWith(".tsx")) {
72
73
  return false;
73
74
  }
75
+ const templateExtension = this.resolveTemplateExtension(filePath);
76
+ if (templateExtension && templateExtension !== ".tsx") {
77
+ return this.ownedTemplateExtensions.has(templateExtension);
78
+ }
74
79
  if (!this.isRouteTemplate(filePath)) {
75
80
  return true;
76
81
  }
77
- const templateExtension = this.resolveTemplateExtension(filePath);
78
82
  if (!templateExtension) {
79
83
  return false;
80
84
  }
@@ -211,7 +215,6 @@ class ReactHmrStrategy extends HmrStrategy {
211
215
  const declaredModules = this.pageMetadataCache.getDeclaredModules(entrypointPath) ? this.pageMetadataCache.getDeclaredModules(entrypointPath) : isMdx ? await collectPageDeclaredModules(entrypointPath) : collectPageDeclaredModulesFromModule(await this.importNodePageModule(entrypointPath));
212
216
  const plugins = this.getBuildPlugins(declaredModules);
213
217
  if (isMdx && this.mdxCompilerOptions) {
214
- const { createReactMdxLoaderPlugin } = await import("./utils/react-mdx-loader-plugin.js");
215
218
  const mdxPlugin = createReactMdxLoaderPlugin(this.mdxCompilerOptions);
216
219
  plugins.unshift(mdxPlugin);
217
220
  }
@@ -7,6 +7,7 @@ import { ReactRenderer } from "./react-renderer.js";
7
7
  import { ReactHmrStrategy } from "./react-hmr-strategy.js";
8
8
  import { ReactRuntimeBundleService } from "./services/react-runtime-bundle.service.js";
9
9
  import { ReactHmrPageMetadataCache } from "./services/react-hmr-page-metadata-cache.js";
10
+ import { createReactMdxLoaderPlugin } from "./utils/react-mdx-loader-plugin.js";
10
11
  const appLogger = new Logger("[ReactPlugin]");
11
12
  const PLUGIN_NAME = REACT_PLUGIN_NAME;
12
13
  const mergePluginLists = (...lists) => {
@@ -142,7 +143,6 @@ class ReactPlugin extends IntegrationPlugin {
142
143
  if (!this.mdxEnabled || !this.mdxCompilerOptions || this.mdxLoaderPlugin) {
143
144
  return;
144
145
  }
145
- const { createReactMdxLoaderPlugin } = await import("./utils/react-mdx-loader-plugin.js");
146
146
  this.mdxLoaderPlugin = createReactMdxLoaderPlugin(this.mdxCompilerOptions);
147
147
  }
148
148
  /**
@@ -8,6 +8,7 @@ import { createUseSyncExternalStoreShimPlugin } from "../utils/use-sync-external
8
8
  import { createRuntimeSpecifierAliasPlugin } from "@ecopages/core/build/runtime-specifier-alias-plugin";
9
9
  import { createForeignJsxOverridePlugin } from "@ecopages/core/plugins/foreign-jsx-override-plugin";
10
10
  import { ReactRuntimeBundleService } from "./react-runtime-bundle.service.js";
11
+ import { createReactMdxLoaderPlugin } from "../utils/react-mdx-loader-plugin.js";
11
12
  class ReactBundleService {
12
13
  runtimeBundleService;
13
14
  config;
@@ -65,7 +66,6 @@ class ReactBundleService {
65
66
  });
66
67
  const runtimePlugins = bundleOptions.includeRuntime ? [] : [this.createRuntimeAliasPlugin(buildReactRuntimeAliasMap(runtimeImports))];
67
68
  if (isMdx && this.config.mdxCompilerOptions) {
68
- const { createReactMdxLoaderPlugin } = await import("../utils/react-mdx-loader-plugin.js");
69
69
  const mdxPlugin = createReactMdxLoaderPlugin(this.config.mdxCompilerOptions);
70
70
  options.plugins = [
71
71
  foreignJsxOverridePlugin,
@@ -5,6 +5,7 @@ import { build } from "@ecopages/core/build/build-adapter";
5
5
  import { fileSystem } from "@ecopages/file-system";
6
6
  import { someInConfigTree } from "../utils/component-config-traversal.js";
7
7
  import { collectDeclaredModulesInConfig } from "../utils/declared-modules.js";
8
+ import { createReactMdxLoaderPlugin } from "../utils/react-mdx-loader-plugin.js";
8
9
  class ReactPageModuleService {
9
10
  config;
10
11
  constructor(config) {
@@ -25,7 +26,6 @@ class ReactPageModuleService {
25
26
  * @returns The imported module
26
27
  */
27
28
  async importMdxPageFile(filePath, options) {
28
- const { createReactMdxLoaderPlugin } = await import("../utils/react-mdx-loader-plugin.js");
29
29
  const mdxPlugin = createReactMdxLoaderPlugin(
30
30
  this.config.mdxCompilerOptions ?? {
31
31
  jsxImportSource: "react",