zephyr-xpack-internal
Version:
Xpack internals for Zephyr
72 lines • 4.22 kB
text/typescript
import { type ZephyrEngine } from 'zephyr-agent';
import type { ConvertedGraph, ZeUploadBuildStats, ZephyrBuildTarget } from 'zephyr-edge-contract';
import type { ModuleFederationPlugin, XChunk, XCompiler, XFederatedRemotesConfig, XStats, XStatsChunk, XStatsCompilation } from '../../../xpack.types.mjs';
import type { TopLevelPackage } from '../convert-to-graph/validate-params.mjs';
import type { FederationDashboardPluginOptions } from './federation-dashboard-plugin-options.mjs';
import type { Exposes } from './federation-dashboard-types.mjs';
interface ProcessWebpackGraphParams {
stats: XStats;
stats_json: XStatsCompilation;
pluginOptions: {
zephyr_engine: ZephyrEngine;
mfConfig?: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
target?: ZephyrBuildTarget | undefined;
};
}
interface FederationPluginOptions {
name?: string;
remotes?: XFederatedRemotesConfig['remotes'];
/** See the Repack compatibility note on the class field. */
bundle_name?: string;
filename?: string;
exposes?: Exposes;
}
export interface ResolvedFederationGraphConfiguration {
/** Every independently emitted container represented by this compilation. */
configurations: FederationPluginOptions[];
/** The legacy graph has one owner, so multi-container builds use the application name. */
graphConfiguration: FederationPluginOptions;
/** Union of all remotes, without dropping containers after the first plugin. */
remoteNames: string[];
}
/**
* Converts bundler plugin wrappers into the serializable configuration needed by the
* legacy graph. A multi-container compilation deliberately has no selected container: the
* graph is attributed to the application and the per-container details are carried by the
* build-stat `federation` array.
*/
export declare function resolveFederationGraphConfiguration(mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined, fallback: FederationPluginOptions, applicationName: string | undefined): ResolvedFederationGraphConfiguration;
export declare class FederationDashboardPlugin {
_options: FederationDashboardPluginOptions;
_dashData: string | undefined;
allArgumentsUsed: [file: string, applicationID: string, name: string][];
FederationPluginOptions: FederationPluginOptions;
constructor(options: Partial<FederationDashboardPluginOptions>);
/** @param {Compiler} compiler */
apply(compiler: XCompiler): void;
processWebpackGraph({ stats, stats_json, pluginOptions, }: ProcessWebpackGraphParams): ConvertedGraph | undefined;
/** Finds the compiler chunk named after a single Module Federation container. */
getRemoteEntryChunk(stats: XStatsCompilation, FederationPluginOptions: typeof this.FederationPluginOptions): XStatsChunk | undefined;
/** Serializes referenced chunks for the dashboard without bundler-private `_groups`. */
getChunkDependencies(validChunkArray: XChunk[]): Record<string, never>;
buildVendorFederationMap(liveStats: XStats): TopLevelPackage;
mapToObjectRec(m: Record<string, XChunk[keyof XChunk]> | Map<string, XChunk[keyof XChunk]> | XChunk[keyof XChunk][]): Record<string, unknown>;
/**
* In a remote application, this function is used to find all the chunks that are
* referenced by the remote entry chunk It won't return anything from HostApp
*/
buildValidChunkArray(liveStats: XStats, FederationPluginOptions: typeof this.FederationPluginOptions): XChunk[];
/**
* We are doing this because the filename in React Native is the actual JS bundle, "How
* we understand the filename is different in react native" - filename would be at the
* end of the URL modified in get_mf_config.ts If we don't attach the remote bundle name
* to metadata, we will have no track record of the actual bundle when we need it later
* -- this is RePack specific.
*/
attach_remote_bundle_name_to_metadata(configurations?: readonly FederationPluginOptions[]): Record<string, string> | undefined;
postDashboardData(): Promise<{
value: ZeUploadBuildStats;
} | undefined>;
}
export {};
//# sourceMappingURL=FederationDashboardPlugin.d.mts.map