@module-federation/modern-js 0.0.0-next-20250618090631 → 0.0.0-next-20250620090335

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 (64) hide show
  1. package/dist/cjs/cli/configPlugin.js +1 -1
  2. package/dist/cjs/cli/configPlugin.spec.js +2 -2
  3. package/dist/cjs/cli/mfRuntimePlugins/auto-fetch-data.js +100 -0
  4. package/dist/cjs/cli/server/data-fetch-server-plugin.js +143 -2
  5. package/dist/cjs/cli/ssrPlugin.js +8 -8
  6. package/dist/cjs/constant.js +49 -2
  7. package/dist/cjs/interfaces/global.js +16 -0
  8. package/dist/cjs/runtime/AwaitDataFetch.js +144 -0
  9. package/dist/cjs/runtime/createRemoteComponent.js +327 -0
  10. package/dist/cjs/runtime/index.js +28 -0
  11. package/dist/cjs/runtime/wrapNoSSR.js +35 -0
  12. package/dist/cjs/ssr-runtime/devPlugin.js +2 -2
  13. package/dist/cjs/ssr-runtime/downgrade.js +114 -0
  14. package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +102 -7
  15. package/dist/cjs/utils/dataFetch.js +211 -0
  16. package/dist/cjs/utils/index.js +54 -0
  17. package/dist/esm/cli/configPlugin.js +1 -1
  18. package/dist/esm/cli/configPlugin.spec.js +2 -2
  19. package/dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js +76 -0
  20. package/dist/esm/cli/server/data-fetch-server-plugin.js +219 -2
  21. package/dist/esm/cli/ssrPlugin.js +1 -1
  22. package/dist/esm/constant.js +37 -1
  23. package/dist/esm/interfaces/global.js +0 -0
  24. package/dist/esm/runtime/AwaitDataFetch.js +131 -0
  25. package/dist/esm/runtime/createRemoteComponent.js +417 -0
  26. package/dist/esm/runtime/index.js +21 -0
  27. package/dist/esm/runtime/wrapNoSSR.js +12 -0
  28. package/dist/esm/ssr-runtime/devPlugin.js +1 -1
  29. package/dist/esm/ssr-runtime/downgrade.js +150 -0
  30. package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +147 -5
  31. package/dist/esm/utils/dataFetch.js +237 -0
  32. package/dist/esm/utils/index.js +28 -0
  33. package/dist/esm-node/cli/configPlugin.js +1 -1
  34. package/dist/esm-node/cli/configPlugin.spec.js +2 -2
  35. package/dist/esm-node/cli/mfRuntimePlugins/auto-fetch-data.js +70 -0
  36. package/dist/esm-node/cli/server/data-fetch-server-plugin.js +143 -2
  37. package/dist/esm-node/cli/ssrPlugin.js +1 -1
  38. package/dist/esm-node/constant.js +37 -1
  39. package/dist/esm-node/interfaces/global.js +0 -0
  40. package/dist/esm-node/runtime/AwaitDataFetch.js +109 -0
  41. package/dist/esm-node/runtime/createRemoteComponent.js +291 -0
  42. package/dist/esm-node/runtime/index.js +21 -0
  43. package/dist/esm-node/runtime/wrapNoSSR.js +11 -0
  44. package/dist/esm-node/ssr-runtime/devPlugin.js +1 -1
  45. package/dist/esm-node/ssr-runtime/downgrade.js +88 -0
  46. package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +89 -5
  47. package/dist/esm-node/utils/dataFetch.js +166 -0
  48. package/dist/esm-node/utils/index.js +27 -0
  49. package/dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts +3 -0
  50. package/dist/types/constant.d.ts +23 -0
  51. package/dist/types/interfaces/global.d.ts +27 -0
  52. package/dist/types/runtime/AwaitDataFetch.d.ts +19 -0
  53. package/dist/types/runtime/createRemoteComponent.d.ts +26 -0
  54. package/dist/types/runtime/index.d.ts +9 -0
  55. package/dist/types/runtime/wrapNoSSR.d.ts +9 -0
  56. package/dist/types/ssr-runtime/downgrade.d.ts +4 -0
  57. package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +3 -0
  58. package/dist/types/utils/dataFetch.d.ts +26 -0
  59. package/dist/types/utils/index.d.ts +15 -0
  60. package/package.json +16 -16
  61. package/dist/cjs/react/index.js +0 -67
  62. package/dist/esm/react/index.js +0 -28
  63. package/dist/esm-node/react/index.js +0 -29
  64. package/dist/types/react/index.d.ts +0 -10
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var react_exports = {};
30
- __export(react_exports, {
31
- ERROR_TYPE: () => import_bridge_react.ERROR_TYPE,
32
- collectSSRAssets: () => collectSSRAssets,
33
- createLazyComponent: () => createLazyComponent,
34
- injectDataFetch: () => import_bridge_react.injectDataFetch,
35
- wrapNoSSR: () => wrapNoSSR
36
- });
37
- module.exports = __toCommonJS(react_exports);
38
- var mfRuntime = __toESM(require("@module-federation/enhanced/runtime"));
39
- var import_bridge_react = require("@module-federation/bridge-react");
40
- const createLazyComponent = (options) => {
41
- return (0, import_bridge_react.createLazyComponent)({
42
- ...options,
43
- runtime: mfRuntime
44
- });
45
- };
46
- const collectSSRAssets = (options) => {
47
- return (0, import_bridge_react.collectSSRAssets)({
48
- ...options,
49
- runtime: mfRuntime
50
- });
51
- };
52
- function wrapNoSSR(createLazyComponentFn) {
53
- return (options) => {
54
- return createLazyComponentFn({
55
- ...options,
56
- noSSR: true
57
- });
58
- };
59
- }
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- ERROR_TYPE,
63
- collectSSRAssets,
64
- createLazyComponent,
65
- injectDataFetch,
66
- wrapNoSSR
67
- });
@@ -1,28 +0,0 @@
1
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
- import * as mfRuntime from "@module-federation/enhanced/runtime";
4
- import { ERROR_TYPE, createLazyComponent as rawCreateLazyComponent, collectSSRAssets as rawCollectSsrAssets, injectDataFetch } from "@module-federation/bridge-react";
5
- var createLazyComponent = function(options) {
6
- return rawCreateLazyComponent(_object_spread_props(_object_spread({}, options), {
7
- runtime: mfRuntime
8
- }));
9
- };
10
- var collectSSRAssets = function(options) {
11
- return rawCollectSsrAssets(_object_spread_props(_object_spread({}, options), {
12
- runtime: mfRuntime
13
- }));
14
- };
15
- function wrapNoSSR(createLazyComponentFn) {
16
- return function(options) {
17
- return createLazyComponentFn(_object_spread_props(_object_spread({}, options), {
18
- noSSR: true
19
- }));
20
- };
21
- }
22
- export {
23
- ERROR_TYPE,
24
- collectSSRAssets,
25
- createLazyComponent,
26
- injectDataFetch,
27
- wrapNoSSR
28
- };
@@ -1,29 +0,0 @@
1
- import * as mfRuntime from "@module-federation/enhanced/runtime";
2
- import { ERROR_TYPE, createLazyComponent as rawCreateLazyComponent, collectSSRAssets as rawCollectSsrAssets, injectDataFetch } from "@module-federation/bridge-react";
3
- const createLazyComponent = (options) => {
4
- return rawCreateLazyComponent({
5
- ...options,
6
- runtime: mfRuntime
7
- });
8
- };
9
- const collectSSRAssets = (options) => {
10
- return rawCollectSsrAssets({
11
- ...options,
12
- runtime: mfRuntime
13
- });
14
- };
15
- function wrapNoSSR(createLazyComponentFn) {
16
- return (options) => {
17
- return createLazyComponentFn({
18
- ...options,
19
- noSSR: true
20
- });
21
- };
22
- }
23
- export {
24
- ERROR_TYPE,
25
- collectSSRAssets,
26
- createLazyComponent,
27
- injectDataFetch,
28
- wrapNoSSR
29
- };
@@ -1,10 +0,0 @@
1
- import { ERROR_TYPE, createLazyComponent as rawCreateLazyComponent, collectSSRAssets as rawCollectSsrAssets, injectDataFetch } from '@module-federation/bridge-react';
2
- import type { CollectSSRAssetsOptions, CreateLazyComponentOptions } from '@module-federation/bridge-react';
3
- export { ERROR_TYPE };
4
- type NewCreateLazyComponentOptions<T, E extends keyof T> = Omit<CreateLazyComponentOptions<T, E>, 'runtime'>;
5
- type NewCreateLazyComponent = <T, E extends keyof T>(options: NewCreateLazyComponentOptions<T, E>) => ReturnType<typeof rawCreateLazyComponent<T, E>>;
6
- export declare const createLazyComponent: NewCreateLazyComponent;
7
- export declare const collectSSRAssets: (options: Omit<CollectSSRAssetsOptions, 'runtime'>) => ReturnType<typeof rawCollectSsrAssets>;
8
- export declare function wrapNoSSR<T, E extends keyof T>(createLazyComponentFn: typeof createLazyComponent<T, E>): (options: Omit<NewCreateLazyComponentOptions<T, E>, 'noSSR'>) => ReturnType<typeof createLazyComponent<T, E>>;
9
- export { injectDataFetch };
10
- export type { DataFetchParams } from '@module-federation/bridge-react';