@bleedingdev/modern-js-create 3.2.0-ultramodern.44 → 3.2.0-ultramodern.46

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.
Files changed (2) hide show
  1. package/dist/index.js +84 -64
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1559,6 +1559,16 @@ ${bffPluginEntry} moduleFederationPlugin(),
1559
1559
  }
1560
1560
  function createSharedModuleFederationConfig() {
1561
1561
  return ` shared: {
1562
+ '@modern-js/plugin-i18n/runtime': {
1563
+ requiredVersion: pluginI18nVersion,
1564
+ singleton: true,
1565
+ treeShaking: false,
1566
+ },
1567
+ '@modern-js/plugin-tanstack/runtime': {
1568
+ requiredVersion: pluginTanstackVersion,
1569
+ singleton: true,
1570
+ treeShaking: false,
1571
+ },
1562
1572
  '@modern-js/runtime': {
1563
1573
  requiredVersion: runtimeVersion,
1564
1574
  singleton: true,
@@ -1620,6 +1630,8 @@ import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
1620
1630
  import { dependencies } from './package.json';
1621
1631
 
1622
1632
  const require = createRequire(import.meta.url);
1633
+ const pluginI18nVersion = (require('@modern-js/plugin-i18n/package.json') as { version: string }).version;
1634
+ const pluginTanstackVersion = (require('@modern-js/plugin-tanstack/package.json') as { version: string }).version;
1623
1635
  const runtimeVersion = (require('@modern-js/runtime/package.json') as { version: string }).version;
1624
1636
  const reactVersion = (require('react/package.json') as { version: string }).version;
1625
1637
  const reactDomVersion = (require('react-dom/package.json') as { version: string }).version;
@@ -1672,6 +1684,8 @@ import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
1672
1684
  import { dependencies } from './package.json';
1673
1685
 
1674
1686
  const require = createRequire(import.meta.url);
1687
+ const pluginI18nVersion = (require('@modern-js/plugin-i18n/package.json') as { version: string }).version;
1688
+ const pluginTanstackVersion = (require('@modern-js/plugin-tanstack/package.json') as { version: string }).version;
1675
1689
  const runtimeVersion = (require('@modern-js/runtime/package.json') as { version: string }).version;
1676
1690
  const reactVersion = (require('react/package.json') as { version: string }).version;
1677
1691
  const reactDomVersion = (require('react-dom/package.json') as { version: string }).version;
@@ -2896,40 +2910,55 @@ export default function ShellCartPage() {
2896
2910
  `;
2897
2911
  }
2898
2912
  function createShellRemoteComponents() {
2899
- return `import { loadRemote } from '@module-federation/modern-js-v3/runtime';
2900
- import * as React from 'react';
2901
-
2902
- type RemoteComponent = React.ComponentType<Record<string, never>>;
2903
-
2904
- const lazyRemote = (moduleId: string) => {
2905
- const Component = React.lazy(async () => {
2906
- const module = await loadRemote(moduleId);
2907
- const remote = (module as { default?: unknown }).default;
2908
-
2909
- if (typeof remote !== 'function') {
2910
- throw new Error(\`Remote "\${moduleId}" did not expose a React component.\`);
2911
- }
2912
-
2913
- return {
2914
- default: remote as RemoteComponent,
2915
- };
2916
- });
2917
-
2918
- return function RemoteComponent() {
2919
- return (
2920
- <React.Suspense fallback={null}>
2921
- <Component />
2922
- </React.Suspense>
2923
- );
2924
- };
2925
- };
2926
-
2927
- export const Header = lazyRemote('explore/Header');
2928
- export const StorePicker = lazyRemote('explore/StorePicker');
2929
- export const Recommendations = lazyRemote('explore/Recommendations');
2930
- export const ProductPage = lazyRemote('decide/ProductPage');
2931
- export const MiniCart = lazyRemote('checkout/MiniCart');
2932
- export const CartPage = lazyRemote('checkout/CartPage');
2913
+ return `import { createLazyComponent } from '@module-federation/modern-js-v3/react';
2914
+ import { getInstance } from '@module-federation/modern-js-v3/runtime';
2915
+
2916
+ const remoteFallback =
2917
+ ({ error }: { error: Error }) =>
2918
+ <div data-remote-error={error.name}>Remote unavailable</div>;
2919
+
2920
+ export const Header = createLazyComponent({
2921
+ export: 'default',
2922
+ fallback: remoteFallback,
2923
+ instance: getInstance(),
2924
+ loader: () => import('explore/Header'),
2925
+ loading: null,
2926
+ });
2927
+ export const StorePicker = createLazyComponent({
2928
+ export: 'default',
2929
+ fallback: remoteFallback,
2930
+ instance: getInstance(),
2931
+ loader: () => import('explore/StorePicker'),
2932
+ loading: null,
2933
+ });
2934
+ export const Recommendations = createLazyComponent({
2935
+ export: 'default',
2936
+ fallback: remoteFallback,
2937
+ instance: getInstance(),
2938
+ loader: () => import('explore/Recommendations'),
2939
+ loading: null,
2940
+ });
2941
+ export const ProductPage = createLazyComponent({
2942
+ export: 'default',
2943
+ fallback: remoteFallback,
2944
+ instance: getInstance(),
2945
+ loader: () => import('decide/ProductPage'),
2946
+ loading: null,
2947
+ });
2948
+ export const MiniCart = createLazyComponent({
2949
+ export: 'default',
2950
+ fallback: remoteFallback,
2951
+ instance: getInstance(),
2952
+ loader: () => import('checkout/MiniCart'),
2953
+ loading: null,
2954
+ });
2955
+ export const CartPage = createLazyComponent({
2956
+ export: 'default',
2957
+ fallback: remoteFallback,
2958
+ instance: getInstance(),
2959
+ loader: () => import('checkout/CartPage'),
2960
+ loading: null,
2961
+ });
2933
2962
  `;
2934
2963
  }
2935
2964
  function createRemotePage(app) {
@@ -3228,36 +3257,27 @@ export default function ${componentName}() {
3228
3257
  `;
3229
3258
  }
3230
3259
  function createDecideRemoteComponents() {
3231
- return `import { loadRemote } from '@module-federation/modern-js-v3/runtime';
3232
- import * as React from 'react';
3233
-
3234
- type RemoteComponent = React.ComponentType<Record<string, never>>;
3235
-
3236
- const lazyRemote = (moduleId: string) => {
3237
- const Component = React.lazy(async () => {
3238
- const module = await loadRemote(moduleId);
3239
- const remote = (module as { default?: unknown }).default;
3240
-
3241
- if (typeof remote !== 'function') {
3242
- throw new Error(\`Remote "\${moduleId}" did not expose a React component.\`);
3243
- }
3244
-
3245
- return {
3246
- default: remote as RemoteComponent,
3247
- };
3248
- });
3249
-
3250
- return function RemoteComponent() {
3251
- return (
3252
- <React.Suspense fallback={null}>
3253
- <Component />
3254
- </React.Suspense>
3255
- );
3256
- };
3257
- };
3258
-
3259
- export const AddToCart = lazyRemote('checkout/AddToCart');
3260
- export const Recommendations = lazyRemote('explore/Recommendations');
3260
+ return `import { createLazyComponent } from '@module-federation/modern-js-v3/react';
3261
+ import { getInstance } from '@module-federation/modern-js-v3/runtime';
3262
+
3263
+ const remoteFallback =
3264
+ ({ error }: { error: Error }) =>
3265
+ <div data-remote-error={error.name}>Remote unavailable</div>;
3266
+
3267
+ export const AddToCart = createLazyComponent({
3268
+ export: 'default',
3269
+ fallback: remoteFallback,
3270
+ instance: getInstance(),
3271
+ loader: () => import('checkout/AddToCart'),
3272
+ loading: null,
3273
+ });
3274
+ export const Recommendations = createLazyComponent({
3275
+ export: 'default',
3276
+ fallback: remoteFallback,
3277
+ instance: getInstance(),
3278
+ loader: () => import('explore/Recommendations'),
3279
+ loading: null,
3280
+ });
3261
3281
  `;
3262
3282
  }
3263
3283
  function remoteComponentOutputPath(app, expose) {
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
24
- "version": "3.2.0-ultramodern.44",
24
+ "version": "3.2.0-ultramodern.46",
25
25
  "types": "./dist/types/index.d.ts",
26
26
  "main": "./dist/index.js",
27
27
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "@types/node": "^25.9.1",
42
42
  "@typescript/native-preview": "7.0.0-dev.20260527.2",
43
43
  "tsx": "^4.22.3",
44
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.44"
44
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.46"
45
45
  },
46
46
  "publishConfig": {
47
47
  "registry": "https://registry.npmjs.org/",
@@ -54,6 +54,6 @@
54
54
  "start": "node ./dist/index.js"
55
55
  },
56
56
  "ultramodern": {
57
- "frameworkVersion": "3.2.0-ultramodern.44"
57
+ "frameworkVersion": "3.2.0-ultramodern.46"
58
58
  }
59
59
  }