@bleedingdev/modern-js-runtime 3.2.0-ultramodern.82 → 3.2.0-ultramodern.83

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.
@@ -133,23 +133,12 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
133
133
  console.warn(warningMessage);
134
134
  }
135
135
  const isModuleFederationAppSSR = hasServerRendering && hasExplicitMfSsrFlag && !isCloudflareWorkerSSR;
136
- const useModuleFederationNodeOutput = hasServerRendering && isModuleFederationAppSSR && isNodeEnvironmentTarget(config.output.target);
137
136
  const ssrEnv = userConfig.deploy?.worker?.ssr || userConfig.server?.rsc ? 'edge' : 'node';
138
137
  const appContext = modernAPI.getAppContext();
139
138
  const { appDirectory, entrypoints } = appContext;
140
- const serverBundlerChain = useModuleFederationNodeOutput ? (chain)=>{
141
- chain.target('async-node');
142
- chain.output.module(false);
143
- chain.output.chunkFormat('commonjs');
144
- chain.output.chunkLoading('async-node');
145
- chain.output.library({
146
- ...chain.output.get('library') || {},
147
- type: 'commonjs-module'
148
- });
149
- } : void 0;
150
139
  const useLoadablePlugin = (0, utils_namespaceObject.isUseSSRBundle)(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig, appDirectory, entrypoints);
151
140
  const outputConfig = {
152
- module: isServerEnvironment && !useModuleFederationNodeOutput && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
141
+ module: isServerEnvironment && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
153
142
  };
154
143
  const useLoadableComponents = (0, utils_namespaceObject.isUseSSRBundle)(userConfig) && checkUseStringSSR(userConfig, appDirectory, entrypoints);
155
144
  return mergeEnvironmentConfig(config, {
@@ -162,13 +151,13 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
162
151
  },
163
152
  output: outputConfig,
164
153
  tools: {
165
- bundlerChain: serverBundlerChain || (useLoadablePlugin ? (chain)=>{
154
+ bundlerChain: useLoadablePlugin ? (chain)=>{
166
155
  chain.plugin('loadable').use(external_loadable_bundler_plugin_js_default(), [
167
156
  {
168
157
  filename: utils_namespaceObject.LOADABLE_STATS_FILE
169
158
  }
170
159
  ]);
171
- } : void 0),
160
+ } : void 0,
172
161
  swc: useLoadableComponents ? {
173
162
  jsc: {
174
163
  experimental: {
@@ -74,12 +74,19 @@ function isModernDeferredData(value) {
74
74
  function normalizeModernLoaderResult(result) {
75
75
  return isModernDeferredData(result) ? result.data : result;
76
76
  }
77
- function pickRouteModuleComponent(routeModule) {
77
+ function pickRouteModuleComponent(routeModule, seen = new Set()) {
78
78
  if ('function' == typeof routeModule || routeModule && 'object' == typeof routeModule && '$$typeof' in routeModule) return routeModule;
79
79
  if (!routeModule || 'object' != typeof routeModule) return;
80
+ if (seen.has(routeModule)) return;
81
+ seen.add(routeModule);
80
82
  const module = routeModule;
81
- const component = module.default || module.Component;
82
- if ('function' == typeof component || component && 'object' == typeof component && '$$typeof' in component) return component;
83
+ for (const candidate of [
84
+ module.default,
85
+ module.Component
86
+ ]){
87
+ const component = pickRouteModuleComponent(candidate, seen);
88
+ if (component) return component;
89
+ }
83
90
  }
84
91
  function createServerLazyImportComponent(lazyImport, fallbackComponent) {
85
92
  if ("u" > typeof document) return fallbackComponent;
@@ -92,23 +92,12 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
92
92
  console.warn(warningMessage);
93
93
  }
94
94
  const isModuleFederationAppSSR = hasServerRendering && hasExplicitMfSsrFlag && !isCloudflareWorkerSSR;
95
- const useModuleFederationNodeOutput = hasServerRendering && isModuleFederationAppSSR && isNodeEnvironmentTarget(config.output.target);
96
95
  const ssrEnv = userConfig.deploy?.worker?.ssr || userConfig.server?.rsc ? 'edge' : 'node';
97
96
  const appContext = modernAPI.getAppContext();
98
97
  const { appDirectory, entrypoints } = appContext;
99
- const serverBundlerChain = useModuleFederationNodeOutput ? (chain)=>{
100
- chain.target('async-node');
101
- chain.output.module(false);
102
- chain.output.chunkFormat('commonjs');
103
- chain.output.chunkLoading('async-node');
104
- chain.output.library({
105
- ...chain.output.get('library') || {},
106
- type: 'commonjs-module'
107
- });
108
- } : void 0;
109
98
  const useLoadablePlugin = isUseSSRBundle(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig, appDirectory, entrypoints);
110
99
  const outputConfig = {
111
- module: isServerEnvironment && !useModuleFederationNodeOutput && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
100
+ module: isServerEnvironment && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
112
101
  };
113
102
  const useLoadableComponents = isUseSSRBundle(userConfig) && checkUseStringSSR(userConfig, appDirectory, entrypoints);
114
103
  return mergeEnvironmentConfig(config, {
@@ -121,13 +110,13 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
121
110
  },
122
111
  output: outputConfig,
123
112
  tools: {
124
- bundlerChain: serverBundlerChain || (useLoadablePlugin ? (chain)=>{
113
+ bundlerChain: useLoadablePlugin ? (chain)=>{
125
114
  chain.plugin('loadable').use(loadable_bundler_plugin, [
126
115
  {
127
116
  filename: LOADABLE_STATS_FILE
128
117
  }
129
118
  ]);
130
- } : void 0),
119
+ } : void 0,
131
120
  swc: useLoadableComponents ? {
132
121
  jsc: {
133
122
  experimental: {
@@ -44,12 +44,19 @@ function isModernDeferredData(value) {
44
44
  function normalizeModernLoaderResult(result) {
45
45
  return isModernDeferredData(result) ? result.data : result;
46
46
  }
47
- function pickRouteModuleComponent(routeModule) {
47
+ function pickRouteModuleComponent(routeModule, seen = new Set()) {
48
48
  if ('function' == typeof routeModule || routeModule && 'object' == typeof routeModule && '$$typeof' in routeModule) return routeModule;
49
49
  if (!routeModule || 'object' != typeof routeModule) return;
50
+ if (seen.has(routeModule)) return;
51
+ seen.add(routeModule);
50
52
  const module = routeModule;
51
- const component = module.default || module.Component;
52
- if ('function' == typeof component || component && 'object' == typeof component && '$$typeof' in component) return component;
53
+ for (const candidate of [
54
+ module.default,
55
+ module.Component
56
+ ]){
57
+ const component = pickRouteModuleComponent(candidate, seen);
58
+ if (component) return component;
59
+ }
53
60
  }
54
61
  function createServerLazyImportComponent(lazyImport, fallbackComponent) {
55
62
  if ("u" > typeof document) return fallbackComponent;
@@ -94,23 +94,12 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
94
94
  console.warn(warningMessage);
95
95
  }
96
96
  const isModuleFederationAppSSR = hasServerRendering && hasExplicitMfSsrFlag && !isCloudflareWorkerSSR;
97
- const useModuleFederationNodeOutput = hasServerRendering && isModuleFederationAppSSR && isNodeEnvironmentTarget(config.output.target);
98
97
  const ssrEnv = userConfig.deploy?.worker?.ssr || userConfig.server?.rsc ? 'edge' : 'node';
99
98
  const appContext = modernAPI.getAppContext();
100
99
  const { appDirectory, entrypoints } = appContext;
101
- const serverBundlerChain = useModuleFederationNodeOutput ? (chain)=>{
102
- chain.target('async-node');
103
- chain.output.module(false);
104
- chain.output.chunkFormat('commonjs');
105
- chain.output.chunkLoading('async-node');
106
- chain.output.library({
107
- ...chain.output.get('library') || {},
108
- type: 'commonjs-module'
109
- });
110
- } : void 0;
111
100
  const useLoadablePlugin = isUseSSRBundle(userConfig) && !isServerEnvironment && checkUseStringSSR(userConfig, appDirectory, entrypoints);
112
101
  const outputConfig = {
113
- module: isServerEnvironment && !useModuleFederationNodeOutput && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
102
+ module: isServerEnvironment && (outputModule || 'workerSSR' === name && userConfig.deploy?.target === 'cloudflare')
114
103
  };
115
104
  const useLoadableComponents = isUseSSRBundle(userConfig) && checkUseStringSSR(userConfig, appDirectory, entrypoints);
116
105
  return mergeEnvironmentConfig(config, {
@@ -123,13 +112,13 @@ const ssrBuilderPlugin = (modernAPI, outputModule, exportLoadablePath)=>({
123
112
  },
124
113
  output: outputConfig,
125
114
  tools: {
126
- bundlerChain: serverBundlerChain || (useLoadablePlugin ? (chain)=>{
115
+ bundlerChain: useLoadablePlugin ? (chain)=>{
127
116
  chain.plugin('loadable').use(loadable_bundler_plugin, [
128
117
  {
129
118
  filename: LOADABLE_STATS_FILE
130
119
  }
131
120
  ]);
132
- } : void 0),
121
+ } : void 0,
133
122
  swc: useLoadableComponents ? {
134
123
  jsc: {
135
124
  experimental: {
@@ -45,12 +45,19 @@ function isModernDeferredData(value) {
45
45
  function normalizeModernLoaderResult(result) {
46
46
  return isModernDeferredData(result) ? result.data : result;
47
47
  }
48
- function pickRouteModuleComponent(routeModule) {
48
+ function pickRouteModuleComponent(routeModule, seen = new Set()) {
49
49
  if ('function' == typeof routeModule || routeModule && 'object' == typeof routeModule && '$$typeof' in routeModule) return routeModule;
50
50
  if (!routeModule || 'object' != typeof routeModule) return;
51
+ if (seen.has(routeModule)) return;
52
+ seen.add(routeModule);
51
53
  const module = routeModule;
52
- const component = module.default || module.Component;
53
- if ('function' == typeof component || component && 'object' == typeof component && '$$typeof' in component) return component;
54
+ for (const candidate of [
55
+ module.default,
56
+ module.Component
57
+ ]){
58
+ const component = pickRouteModuleComponent(candidate, seen);
59
+ if (component) return component;
60
+ }
54
61
  }
55
62
  function createServerLazyImportComponent(lazyImport, fallbackComponent) {
56
63
  if ("u" > typeof document) return fallbackComponent;
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.2.0-ultramodern.82",
20
+ "version": "3.2.0-ultramodern.83",
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
@@ -234,12 +234,12 @@
234
234
  "isbot": "5.1.40",
235
235
  "react-helmet": "^6.1.0",
236
236
  "react-is": "^19.2.6",
237
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.82",
238
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.2.0-ultramodern.82",
239
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.82",
240
- "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.82",
241
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.82",
242
- "@modern-js/render": "npm:@bleedingdev/modern-js-render@3.2.0-ultramodern.82"
237
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.2.0-ultramodern.83",
238
+ "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.83",
239
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.83",
240
+ "@modern-js/render": "npm:@bleedingdev/modern-js-render@3.2.0-ultramodern.83",
241
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.83",
242
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.83"
243
243
  },
244
244
  "peerDependencies": {
245
245
  "react": "^19.2.6",
@@ -258,7 +258,7 @@
258
258
  "@typescript/native-preview": "7.0.0-dev.20260527.2",
259
259
  "react": "^19.2.6",
260
260
  "react-dom": "^19.2.6",
261
- "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.2.0-ultramodern.82",
261
+ "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.2.0-ultramodern.83",
262
262
  "@scripts/rstest-config": "2.66.0"
263
263
  },
264
264
  "sideEffects": false,