@module-federation/modern-js 0.0.0-next-20250616123529 → 0.0.0-next-20250616190501
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 +16 -9
- package/dist/LICENSE +0 -21
- package/dist/cjs/cli/configPlugin.js +0 -381
- package/dist/cjs/cli/configPlugin.spec.js +0 -114
- package/dist/cjs/cli/index.js +0 -95
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +0 -44
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -82
- package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +0 -43
- package/dist/cjs/cli/server/data-fetch-server-plugin.js +0 -48
- package/dist/cjs/cli/ssrPlugin.js +0 -236
- package/dist/cjs/cli/utils.js +0 -90
- package/dist/cjs/constant.js +0 -31
- package/dist/cjs/interfaces/bundler.js +0 -16
- package/dist/cjs/logger.js +0 -27
- package/dist/cjs/runtime/index.js +0 -78
- package/dist/cjs/server/fileCache.js +0 -84
- package/dist/cjs/server/fileCache.spec.js +0 -28
- package/dist/cjs/server/index.js +0 -58
- package/dist/cjs/server/staticMiddleware.js +0 -77
- package/dist/cjs/server/staticMiddleware.spec.js +0 -185
- package/dist/cjs/ssr-runtime/SSRLiveReload.js +0 -43
- package/dist/cjs/ssr-runtime/devPlugin.js +0 -71
- package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -41
- package/dist/cjs/types/index.js +0 -16
- package/dist/esm/cli/configPlugin.js +0 -388
- package/dist/esm/cli/configPlugin.spec.js +0 -110
- package/dist/esm/cli/index.js +0 -90
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js +0 -16
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -74
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.js +0 -25
- package/dist/esm/cli/server/data-fetch-server-plugin.js +0 -20
- package/dist/esm/cli/ssrPlugin.js +0 -219
- package/dist/esm/cli/utils.js +0 -53
- package/dist/esm/constant.js +0 -6
- package/dist/esm/interfaces/bundler.js +0 -0
- package/dist/esm/logger.js +0 -7
- package/dist/esm/runtime/index.js +0 -47
- package/dist/esm/server/fileCache.js +0 -98
- package/dist/esm/server/fileCache.spec.js +0 -50
- package/dist/esm/server/index.js +0 -36
- package/dist/esm/server/staticMiddleware.js +0 -81
- package/dist/esm/server/staticMiddleware.spec.js +0 -328
- package/dist/esm/ssr-runtime/SSRLiveReload.js +0 -26
- package/dist/esm/ssr-runtime/devPlugin.js +0 -73
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -35
- package/dist/esm/types/index.js +0 -0
- package/dist/esm-node/cli/configPlugin.js +0 -340
- package/dist/esm-node/cli/configPlugin.spec.js +0 -91
- package/dist/esm-node/cli/index.js +0 -70
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.js +0 -14
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -62
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.js +0 -23
- package/dist/esm-node/cli/server/data-fetch-server-plugin.js +0 -18
- package/dist/esm-node/cli/ssrPlugin.js +0 -200
- package/dist/esm-node/cli/utils.js +0 -53
- package/dist/esm-node/constant.js +0 -6
- package/dist/esm-node/interfaces/bundler.js +0 -0
- package/dist/esm-node/logger.js +0 -7
- package/dist/esm-node/runtime/index.js +0 -41
- package/dist/esm-node/server/fileCache.js +0 -49
- package/dist/esm-node/server/fileCache.spec.js +0 -27
- package/dist/esm-node/server/index.js +0 -34
- package/dist/esm-node/server/staticMiddleware.js +0 -43
- package/dist/esm-node/server/staticMiddleware.spec.js +0 -162
- package/dist/esm-node/ssr-runtime/SSRLiveReload.js +0 -19
- package/dist/esm-node/ssr-runtime/devPlugin.js +0 -37
- package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -17
- package/dist/esm-node/types/index.js +0 -0
- package/dist/types/cli/configPlugin.d.ts +0 -21
- package/dist/types/cli/configPlugin.spec.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -6
- package/dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts +0 -3
- package/dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts +0 -3
- package/dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts +0 -3
- package/dist/types/cli/server/data-fetch-server-plugin.d.ts +0 -3
- package/dist/types/cli/ssrPlugin.d.ts +0 -6
- package/dist/types/cli/utils.d.ts +0 -6
- package/dist/types/constant.d.ts +0 -2
- package/dist/types/interfaces/bundler.d.ts +0 -18
- package/dist/types/logger.d.ts +0 -2
- package/dist/types/runtime/index.d.ts +0 -14
- package/dist/types/server/fileCache.d.ts +0 -14
- package/dist/types/server/fileCache.spec.d.ts +0 -1
- package/dist/types/server/index.d.ts +0 -4
- package/dist/types/server/staticMiddleware.d.ts +0 -6
- package/dist/types/server/staticMiddleware.spec.d.ts +0 -1
- package/dist/types/ssr-runtime/SSRLiveReload.d.ts +0 -1
- package/dist/types/ssr-runtime/devPlugin.d.ts +0 -2
- package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +0 -4
- package/dist/types/types/index.d.ts +0 -24
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { kit } from "@module-federation/react/pure";
|
|
2
|
-
const { callDataFetch, injectDataFetch, setSSREnv } = kit;
|
|
3
|
-
const injectDataFetchFunctionPlugin = ({ fetchServerQuery }) => ({
|
|
4
|
-
name: "@module-federation/inject-data-fetch-function-plugin",
|
|
5
|
-
setup: (api) => {
|
|
6
|
-
api.onBeforeRender(async () => {
|
|
7
|
-
setSSREnv({
|
|
8
|
-
fetchServerQuery
|
|
9
|
-
});
|
|
10
|
-
injectDataFetch();
|
|
11
|
-
await callDataFetch();
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
injectDataFetchFunctionPlugin
|
|
17
|
-
};
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isWebTarget, skipByTarget } from './utils';
|
|
2
|
-
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
-
import { PluginOptions } from '../types';
|
|
4
|
-
import type { InternalModernPluginOptions } from '../types';
|
|
5
|
-
import type { AppTools, webpack, UserConfig, Rspack, CliPluginFuture } from '@modern-js/app-tools';
|
|
6
|
-
import type { BundlerChainConfig } from '../interfaces/bundler';
|
|
7
|
-
export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
|
|
8
|
-
export declare function setEnv(enableSSR: boolean): void;
|
|
9
|
-
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
10
|
-
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean, remoteIpStrategy?: "ipv4" | "inherit", enableSSR?: boolean) => moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
11
|
-
export declare function addMyTypes2Ignored(chain: BundlerChainConfig, mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions): void;
|
|
12
|
-
export declare function patchBundlerConfig(options: {
|
|
13
|
-
chain: BundlerChainConfig;
|
|
14
|
-
isServer: boolean;
|
|
15
|
-
modernjsConfig: UserConfig<AppTools>;
|
|
16
|
-
mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
17
|
-
enableSSR: boolean;
|
|
18
|
-
}): void;
|
|
19
|
-
export declare const moduleFederationConfigPlugin: (userConfig: InternalModernPluginOptions) => CliPluginFuture<AppTools>;
|
|
20
|
-
export default moduleFederationConfigPlugin;
|
|
21
|
-
export { isWebTarget, skipByTarget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CliPluginFuture, AppTools } from '@modern-js/app-tools';
|
|
2
|
-
import type { PluginOptions } from '../types';
|
|
3
|
-
export declare const moduleFederationPlugin: (userConfig?: PluginOptions) => CliPluginFuture<AppTools>;
|
|
4
|
-
export default moduleFederationPlugin;
|
|
5
|
-
export { createModuleFederationConfig } from '@module-federation/enhanced';
|
|
6
|
-
export type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CliPluginFuture, AppTools } from '@modern-js/app-tools';
|
|
2
|
-
import type { InternalModernPluginOptions } from '../types';
|
|
3
|
-
export declare function setEnv(): void;
|
|
4
|
-
export declare const CHAIN_MF_PLUGIN_ID = "plugin-module-federation-server";
|
|
5
|
-
export declare const moduleFederationSSRPlugin: (pluginOptions: Required<InternalModernPluginOptions>) => CliPluginFuture<AppTools>;
|
|
6
|
-
export default moduleFederationSSRPlugin;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { webpack, Rspack } from '@modern-js/app-tools';
|
|
2
|
-
export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
|
|
3
|
-
export declare const getIPV4: () => string;
|
|
4
|
-
export declare const isWebTarget: (target: string[] | string) => boolean;
|
|
5
|
-
export declare const skipByTarget: (target: string[] | string) => boolean;
|
|
6
|
-
export declare function isDev(): boolean;
|
package/dist/types/constant.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AppTools, Bundler, UserConfig } from '@modern-js/app-tools';
|
|
2
|
-
type AppToolsUserConfig<T extends Bundler> = AppTools<T>['userConfig']['tools'];
|
|
3
|
-
type ExcludeUndefined<T> = T extends undefined ? never : T;
|
|
4
|
-
type ExtractObjectType<T> = T extends (...args: any[]) => any ? never : T;
|
|
5
|
-
type OmitArrayConfiguration<T> = T extends Array<any> ? (T extends (infer U)[] ? U : T) : ExtractObjectType<T>;
|
|
6
|
-
type WebpackConfigs = ExcludeUndefined<AppToolsUserConfig<'webpack'>> extends {
|
|
7
|
-
webpack?: infer U;
|
|
8
|
-
} ? U : never;
|
|
9
|
-
type ObjectWebpack = ExtractObjectType<OmitArrayConfiguration<WebpackConfigs>>;
|
|
10
|
-
type RspackConfigs = ExcludeUndefined<AppToolsUserConfig<'rspack'>> extends {
|
|
11
|
-
rspack?: infer U;
|
|
12
|
-
} ? U : never;
|
|
13
|
-
type ObjectRspack = ExtractObjectType<OmitArrayConfiguration<RspackConfigs>>;
|
|
14
|
-
type BundlerChain = ExcludeUndefined<ExcludeUndefined<UserConfig<AppTools>['tools']>['bundlerChain']>;
|
|
15
|
-
type BundlerChainFunc = Extract<BundlerChain, (chain: any, utils: any) => any>;
|
|
16
|
-
export type BundlerChainConfig = Parameters<BundlerChainFunc>[0];
|
|
17
|
-
export type BundlerConfig<T extends Bundler> = T extends 'rspack' ? ObjectRspack : ObjectWebpack;
|
|
18
|
-
export {};
|
package/dist/types/logger.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ERROR_TYPE } from '@module-federation/react/pure';
|
|
2
|
-
import type { CollectSSRAssetsOptions, CreateRemoteComponentOptions } from '@module-federation/react/pure';
|
|
3
|
-
export * from '@module-federation/enhanced/runtime';
|
|
4
|
-
export { ERROR_TYPE };
|
|
5
|
-
type NewCreateRemoteComponentOptions<T, E extends keyof T> = Omit<CreateRemoteComponentOptions<T, E>, 'runtime'>;
|
|
6
|
-
type NewCreateRemoteComponent = <T, E extends keyof T>(options: NewCreateRemoteComponentOptions<T, E>) => ReturnType<typeof import('@module-federation/react/pure').kit.createRemoteSSRComponent<T, E>>;
|
|
7
|
-
export declare const kit: {
|
|
8
|
-
readonly createRemoteSSRComponent: NewCreateRemoteComponent;
|
|
9
|
-
readonly createRemoteComponent: NewCreateRemoteComponent;
|
|
10
|
-
readonly collectSSRAssets: (options: Omit<CollectSSRAssetsOptions, "runtime">) => ReturnType<typeof import("@module-federation/react/pure").kit.collectSSRAssets>;
|
|
11
|
-
readonly wrapNoSSR: <T, E extends keyof T>(createComponentFn: NewCreateRemoteComponent) => (options: Omit<NewCreateRemoteComponentOptions<T, E>, "noSSR">) => ReturnType<NewCreateRemoteComponent>;
|
|
12
|
-
readonly injectDataFetch: typeof import("@module-federation/react/dist/types/module/data-fetch/inject-data-fetch").injectDataFetch;
|
|
13
|
-
};
|
|
14
|
-
export type { DataFetchParams } from '@module-federation/react/pure';
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function SSRLiveReload(): import("react").JSX.Element | null;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
|
-
import type { ModuleFederationPlugin as WebpackModuleFederationPlugin } from '@module-federation/enhanced';
|
|
3
|
-
import type { ModuleFederationPlugin as RspackModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
4
|
-
export interface PluginOptions {
|
|
5
|
-
config?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
6
|
-
configPath?: string;
|
|
7
|
-
ssr?: {
|
|
8
|
-
distOutputDir?: string;
|
|
9
|
-
} | boolean;
|
|
10
|
-
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
11
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
12
|
-
}
|
|
13
|
-
export interface InternalModernPluginOptions {
|
|
14
|
-
csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
15
|
-
ssrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
16
|
-
distOutputDir: string;
|
|
17
|
-
originPluginOptions: PluginOptions;
|
|
18
|
-
browserPlugin?: BundlerPlugin;
|
|
19
|
-
nodePlugin?: BundlerPlugin;
|
|
20
|
-
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
21
|
-
userConfig?: PluginOptions;
|
|
22
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
export type BundlerPlugin = WebpackModuleFederationPlugin | RspackModuleFederationPlugin;
|