@module-federation/modern-js 0.0.0-chore-bump-node-22-20260710161714

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/cjs/cli/configPlugin.js +346 -0
  4. package/dist/cjs/cli/index.js +115 -0
  5. package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +54 -0
  6. package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +53 -0
  7. package/dist/cjs/cli/server/data-fetch-server-plugin.js +59 -0
  8. package/dist/cjs/cli/ssrPlugin.js +314 -0
  9. package/dist/cjs/cli/utils.js +93 -0
  10. package/dist/cjs/constant.js +40 -0
  11. package/dist/cjs/interfaces/bundler.js +18 -0
  12. package/dist/cjs/logger.js +39 -0
  13. package/dist/cjs/react/data-fetch.js +58 -0
  14. package/dist/cjs/react/index.js +58 -0
  15. package/dist/cjs/react/plugin.js +65 -0
  16. package/dist/cjs/react/v18.js +58 -0
  17. package/dist/cjs/react/v19.js +58 -0
  18. package/dist/cjs/runtime/index.js +58 -0
  19. package/dist/cjs/server/fileCache.js +82 -0
  20. package/dist/cjs/server/index.js +71 -0
  21. package/dist/cjs/server/staticMiddleware.js +97 -0
  22. package/dist/cjs/ssr-runtime/SSRLiveReload.js +50 -0
  23. package/dist/cjs/ssr-runtime/devPlugin.js +67 -0
  24. package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +47 -0
  25. package/dist/cjs/types/index.js +18 -0
  26. package/dist/esm/cli/configPlugin.mjs +321 -0
  27. package/dist/esm/cli/index.mjs +91 -0
  28. package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs +12 -0
  29. package/dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs +21 -0
  30. package/dist/esm/cli/server/data-fetch-server-plugin.mjs +17 -0
  31. package/dist/esm/cli/ssrPlugin.mjs +297 -0
  32. package/dist/esm/cli/utils.mjs +40 -0
  33. package/dist/esm/constant.mjs +3 -0
  34. package/dist/esm/interfaces/bundler.mjs +0 -0
  35. package/dist/esm/logger.mjs +5 -0
  36. package/dist/esm/react/data-fetch.mjs +1 -0
  37. package/dist/esm/react/index.mjs +1 -0
  38. package/dist/esm/react/plugin.mjs +3 -0
  39. package/dist/esm/react/v18.mjs +1 -0
  40. package/dist/esm/react/v19.mjs +1 -0
  41. package/dist/esm/runtime/index.mjs +1 -0
  42. package/dist/esm/server/fileCache.mjs +125 -0
  43. package/dist/esm/server/index.mjs +36 -0
  44. package/dist/esm/server/staticMiddleware.mjs +122 -0
  45. package/dist/esm/ssr-runtime/SSRLiveReload.mjs +23 -0
  46. package/dist/esm/ssr-runtime/devPlugin.mjs +70 -0
  47. package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.mjs +33 -0
  48. package/dist/esm/types/index.mjs +0 -0
  49. package/dist/esm-node/cli/configPlugin.mjs +276 -0
  50. package/dist/esm-node/cli/index.mjs +75 -0
  51. package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.mjs +10 -0
  52. package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.mjs +19 -0
  53. package/dist/esm-node/cli/server/data-fetch-server-plugin.mjs +15 -0
  54. package/dist/esm-node/cli/ssrPlugin.mjs +258 -0
  55. package/dist/esm-node/cli/utils.mjs +40 -0
  56. package/dist/esm-node/constant.mjs +3 -0
  57. package/dist/esm-node/interfaces/bundler.mjs +0 -0
  58. package/dist/esm-node/logger.mjs +5 -0
  59. package/dist/esm-node/react/data-fetch.mjs +1 -0
  60. package/dist/esm-node/react/index.mjs +1 -0
  61. package/dist/esm-node/react/plugin.mjs +3 -0
  62. package/dist/esm-node/react/v18.mjs +1 -0
  63. package/dist/esm-node/react/v19.mjs +1 -0
  64. package/dist/esm-node/runtime/index.mjs +1 -0
  65. package/dist/esm-node/server/fileCache.mjs +45 -0
  66. package/dist/esm-node/server/index.mjs +34 -0
  67. package/dist/esm-node/server/staticMiddleware.mjs +50 -0
  68. package/dist/esm-node/ssr-runtime/SSRLiveReload.mjs +16 -0
  69. package/dist/esm-node/ssr-runtime/devPlugin.mjs +33 -0
  70. package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.mjs +13 -0
  71. package/dist/esm-node/types/index.mjs +0 -0
  72. package/dist/types/cli/configPlugin.d.ts +21 -0
  73. package/dist/types/cli/configPlugin.spec.d.ts +1 -0
  74. package/dist/types/cli/index.d.ts +6 -0
  75. package/dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts +3 -0
  76. package/dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts +3 -0
  77. package/dist/types/cli/server/data-fetch-server-plugin.d.ts +3 -0
  78. package/dist/types/cli/ssrPlugin.d.ts +6 -0
  79. package/dist/types/cli/ssrPlugin.spec.d.ts +1 -0
  80. package/dist/types/cli/utils.d.ts +6 -0
  81. package/dist/types/constant.d.ts +2 -0
  82. package/dist/types/interfaces/bundler.d.ts +18 -0
  83. package/dist/types/logger.d.ts +2 -0
  84. package/dist/types/react/data-fetch.d.ts +1 -0
  85. package/dist/types/react/index.d.ts +1 -0
  86. package/dist/types/react/plugin.d.ts +2 -0
  87. package/dist/types/react/v18.d.ts +1 -0
  88. package/dist/types/react/v19.d.ts +1 -0
  89. package/dist/types/runtime/index.d.ts +1 -0
  90. package/dist/types/server/fileCache.d.ts +14 -0
  91. package/dist/types/server/fileCache.spec.d.ts +1 -0
  92. package/dist/types/server/index.d.ts +4 -0
  93. package/dist/types/server/staticMiddleware.d.ts +7 -0
  94. package/dist/types/server/staticMiddleware.spec.d.ts +1 -0
  95. package/dist/types/ssr-runtime/SSRLiveReload.d.ts +2 -0
  96. package/dist/types/ssr-runtime/devPlugin.d.ts +2 -0
  97. package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +4 -0
  98. package/dist/types/types/index.d.ts +35 -0
  99. package/package.json +192 -0
  100. package/types.d.ts +6 -0
@@ -0,0 +1 @@
1
+ export * from '@module-federation/enhanced/runtime';
@@ -0,0 +1,14 @@
1
+ export interface FileResult {
2
+ content: string;
3
+ lastModified: number;
4
+ }
5
+ export declare class FileCache {
6
+ private cache;
7
+ /**
8
+ * Check if file exists and return file info
9
+ * @param filepath Path to the file
10
+ * @returns FileResult or null if file doesn't exist
11
+ */
12
+ getFile(filepath: string): Promise<FileResult | null>;
13
+ }
14
+ export declare const fileCache: FileCache;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ServerPlugin } from '@modern-js/server-runtime';
2
+ declare const staticServePlugin: () => ServerPlugin;
3
+ export default staticServePlugin;
4
+ export { staticServePlugin };
@@ -0,0 +1,7 @@
1
+ import type { MiddlewareHandler } from '@modern-js/server-runtime';
2
+ declare const createStaticMiddleware: (options: {
3
+ assetPrefix: string;
4
+ pwd: string;
5
+ }) => MiddlewareHandler;
6
+ declare const createCorsMiddleware: () => MiddlewareHandler;
7
+ export { createStaticMiddleware, createCorsMiddleware };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function SSRLiveReload(): React.JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { RuntimePluginFuture } from '@modern-js/runtime';
2
+ export declare const mfSSRDevPlugin: () => RuntimePluginFuture;
@@ -0,0 +1,4 @@
1
+ import type { RuntimePluginFuture } from '@modern-js/runtime';
2
+ export declare const injectDataFetchFunctionPlugin: ({ fetchServerQuery, }: {
3
+ fetchServerQuery?: Record<string, unknown>;
4
+ }) => RuntimePluginFuture;
@@ -0,0 +1,35 @@
1
+ import { moduleFederationPlugin } from '@module-federation/sdk';
2
+ import type { StatsAssetResource } from '@module-federation/rsbuild-plugin/utils';
3
+ export interface PluginOptions {
4
+ config?: moduleFederationPlugin.ModuleFederationPluginOptions;
5
+ configPath?: string;
6
+ ssr?: {
7
+ distOutputDir?: string;
8
+ } | boolean;
9
+ fetchServerQuery?: Record<string, unknown>;
10
+ secondarySharedTreeShaking?: boolean;
11
+ }
12
+ export type AssetFileNames = {
13
+ statsFileName: string;
14
+ manifestFileName: string;
15
+ };
16
+ export interface InternalModernPluginOptions {
17
+ csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
18
+ ssrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
19
+ distOutputDir: string;
20
+ originPluginOptions: PluginOptions;
21
+ browserPlugin?: BundlerPlugin;
22
+ nodePlugin?: BundlerPlugin;
23
+ assetFileNames: {
24
+ node?: AssetFileNames;
25
+ browser?: AssetFileNames;
26
+ };
27
+ assetResources: {
28
+ browser?: StatsAssetResource;
29
+ node?: StatsAssetResource;
30
+ };
31
+ userConfig?: PluginOptions;
32
+ fetchServerQuery?: Record<string, unknown>;
33
+ secondarySharedTreeShaking?: boolean;
34
+ }
35
+ export type BundlerPlugin = any;
package/package.json ADDED
@@ -0,0 +1,192 @@
1
+ {
2
+ "name": "@module-federation/modern-js",
3
+ "version": "0.0.0-chore-bump-node-22-20260710161714",
4
+ "files": [
5
+ "dist/",
6
+ "types.d.ts",
7
+ "README.md"
8
+ ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/module-federation/core.git",
15
+ "directory": "packages/modernjs"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/types/cli/index.d.ts",
20
+ "import": "./dist/esm/cli/index.mjs",
21
+ "require": "./dist/cjs/cli/index.js"
22
+ },
23
+ "./runtime": {
24
+ "types": "./dist/types/runtime/index.d.ts",
25
+ "default": "./dist/esm/runtime/index.mjs"
26
+ },
27
+ "./data-fetch": {
28
+ "types": "./dist/types/react/data-fetch.d.ts",
29
+ "default": "./dist/esm/react/data-fetch.mjs"
30
+ },
31
+ "./react": {
32
+ "types": "./dist/types/react/index.d.ts",
33
+ "default": "./dist/esm/react/index.mjs"
34
+ },
35
+ "./react-v18": {
36
+ "types": "./dist/types/react/v18.d.ts",
37
+ "default": "./dist/esm/react/v18.mjs"
38
+ },
39
+ "./react-v19": {
40
+ "types": "./dist/types/react/v19.d.ts",
41
+ "default": "./dist/esm/react/v19.mjs"
42
+ },
43
+ "./react-plugin": {
44
+ "types": "./dist/types/react/plugin.d.ts",
45
+ "default": "./dist/esm/react/plugin.mjs"
46
+ },
47
+ "./ssr-dev-plugin": {
48
+ "types": "./dist/types/ssr-runtime/devPlugin.d.ts",
49
+ "default": "./dist/esm/ssr-runtime/devPlugin.mjs"
50
+ },
51
+ "./ssr-inject-data-fetch-function-plugin": {
52
+ "types": "./dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts",
53
+ "default": "./dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.mjs"
54
+ },
55
+ "./config-plugin": {
56
+ "types": "./dist/types/cli/configPlugin.d.ts",
57
+ "import": "./dist/esm/cli/configPlugin.mjs",
58
+ "require": "./dist/cjs/cli/configPlugin.js"
59
+ },
60
+ "./ssr-plugin": {
61
+ "types": "./dist/types/cli/ssrPlugin.d.ts",
62
+ "import": "./dist/esm/cli/ssrPlugin.mjs",
63
+ "require": "./dist/cjs/cli/ssrPlugin.js"
64
+ },
65
+ "./shared-strategy": {
66
+ "types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts",
67
+ "import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs",
68
+ "require": "./dist/cjs/cli/mfRuntimePlugins/shared-strategy.js"
69
+ },
70
+ "./inject-node-fetch": {
71
+ "types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
72
+ "import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs",
73
+ "require": "./dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js"
74
+ },
75
+ "./data-fetch-server-plugin": {
76
+ "types": "./dist/types/cli/server/data-fetch-server-plugin.d.ts",
77
+ "default": "./dist/cjs/cli/server/data-fetch-server-plugin.js"
78
+ },
79
+ "./server": {
80
+ "types": "./dist/types/server/index.d.ts",
81
+ "default": "./dist/cjs/server/index.js"
82
+ }
83
+ },
84
+ "typesVersions": {
85
+ "*": {
86
+ ".": [
87
+ "./dist/types/cli/index.d.ts"
88
+ ],
89
+ "runtime": [
90
+ "./dist/types/runtime/index.d.ts"
91
+ ],
92
+ "data-fetch": [
93
+ "./dist/types/react/data-fetch.d.ts"
94
+ ],
95
+ "react": [
96
+ "./dist/types/react/index.d.ts"
97
+ ],
98
+ "react-v18": [
99
+ "./dist/types/react/v18.d.ts"
100
+ ],
101
+ "react-v19": [
102
+ "./dist/types/react/v19.d.ts"
103
+ ],
104
+ "react-plugin": [
105
+ "./dist/types/react/plugin.d.ts"
106
+ ],
107
+ "config-plugin": [
108
+ "./dist/types/cli/configPlugin.d.ts"
109
+ ],
110
+ "ssr-plugin": [
111
+ "./dist/types/cli/ssrPlugin.d.ts"
112
+ ],
113
+ "shared-strategy": [
114
+ "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts"
115
+ ],
116
+ "inject-node-fetch": [
117
+ "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
118
+ ],
119
+ "data-fetch-server-plugin": [
120
+ "./dist/types/cli/server/data-fetch-server-plugin.d.ts"
121
+ ],
122
+ "ssr-inject-data-fetch-function-plugin": [
123
+ "./dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts"
124
+ ],
125
+ "server": [
126
+ "./dist/types/server/index.d.ts"
127
+ ]
128
+ }
129
+ },
130
+ "main": "./dist/cjs/cli/index.js",
131
+ "types": "./dist/types/cli/index.d.ts",
132
+ "author": "hanric <hanric.zhang@gmail.com>",
133
+ "license": "MIT",
134
+ "dependencies": {
135
+ "@modern-js/utils": "2.70.5",
136
+ "lru-cache": "10.4.3",
137
+ "@swc/helpers": "0.5.17",
138
+ "node-fetch": "3.3.0",
139
+ "jiti": "2.4.2",
140
+ "react-error-boundary": "4.1.2",
141
+ "@module-federation/rsbuild-plugin": "0.0.0-chore-bump-node-22-20260710161714",
142
+ "@module-federation/enhanced": "0.0.0-chore-bump-node-22-20260710161714",
143
+ "@module-federation/runtime": "0.0.0-chore-bump-node-22-20260710161714",
144
+ "@module-federation/node": "0.0.0-chore-bump-node-22-20260710161714",
145
+ "@module-federation/sdk": "0.0.0-chore-bump-node-22-20260710161714",
146
+ "@module-federation/bridge-react": "0.0.0-chore-bump-node-22-20260710161714",
147
+ "@module-federation/cli": "0.0.0-chore-bump-node-22-20260710161714"
148
+ },
149
+ "devDependencies": {
150
+ "@rsbuild/plugin-react": "1.4.5",
151
+ "@rstest/core": "^0.10.6",
152
+ "@rslib/core": "0.18.5",
153
+ "@rsbuild/core": "1.3.21",
154
+ "@modern-js/app-tools": "2.70.5",
155
+ "@modern-js/server-runtime": "2.70.5",
156
+ "@modern-js/module-tools": "2.70.5",
157
+ "@modern-js/runtime": "2.70.5",
158
+ "@modern-js/tsconfig": "2.70.5",
159
+ "@types/react": "^18.3.11",
160
+ "@types/react-dom": "^18.3.0",
161
+ "typescript": "6.0.3",
162
+ "@module-federation/manifest": "0.0.0-chore-bump-node-22-20260710161714"
163
+ },
164
+ "peerDependencies": {
165
+ "react": ">=17",
166
+ "react-dom": ">=17",
167
+ "typescript": "^4.9.0 || ^5.0.0 || ^6.0.0",
168
+ "vue-tsc": "^1.0.24",
169
+ "react-router-dom": "^4 || ^5 || ^6 || ^7",
170
+ "react-router": "^7"
171
+ },
172
+ "peerDependenciesMeta": {
173
+ "typescript": {
174
+ "optional": true
175
+ },
176
+ "vue-tsc": {
177
+ "optional": true
178
+ },
179
+ "react-router-dom": {
180
+ "optional": true
181
+ },
182
+ "react-router": {
183
+ "optional": true
184
+ }
185
+ },
186
+ "scripts": {
187
+ "build": "rslib build",
188
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\"",
189
+ "test": "pnpm exec rstest --passWithNoTests",
190
+ "pre-release": "pnpm run test && pnpm run build"
191
+ }
192
+ }
package/types.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import './dist/types/runtime';
2
+
3
+ // TODO: deprecated
4
+ declare module '@modern-js/runtime/mf' {
5
+ export * from './dist/types/runtime';
6
+ }