@module-federation/managers 2.0.1 → 2.1.0

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.
@@ -0,0 +1,10 @@
1
+ export declare class BasicPluginOptionsManager<T> {
2
+ private _options?;
3
+ private _root;
4
+ constructor(root?: string);
5
+ get enable(): boolean;
6
+ get options(): T;
7
+ get root(): string;
8
+ init(options: T, extraArgs?: Record<string, any>): void;
9
+ setOptions(options: T): void;
10
+ }
@@ -0,0 +1,20 @@
1
+ import type { containerPlugin, ManifestModuleInfos, moduleFederationPlugin } from '@module-federation/sdk';
2
+ import type { EntryObject } from 'webpack';
3
+ import { BasicPluginOptionsManager } from './BasicPluginOptionsManager';
4
+ declare class ContainerManager extends BasicPluginOptionsManager<moduleFederationPlugin.ModuleFederationPluginOptions> {
5
+ private _manifestModuleInfos?;
6
+ private _parsedOptions?;
7
+ get enable(): boolean;
8
+ get globalEntryName(): string | undefined;
9
+ get containerPluginExposesOptions(): containerPlugin.ContainerPluginOptions['exposes'];
10
+ get fileExposeKeyMap(): Record<string, Set<string>>;
11
+ get exposeFileNameImportMap(): Record<string, string[]>;
12
+ get exposeObject(): Record<string, string[]>;
13
+ get exposeFiles(): string[];
14
+ get manifestModuleInfos(): ManifestModuleInfos;
15
+ get webpackEntry(): EntryObject;
16
+ private _parseOptions;
17
+ init(options: moduleFederationPlugin.ModuleFederationPluginOptions): void;
18
+ validate(name?: string): void;
19
+ }
20
+ export { ContainerManager };
@@ -0,0 +1,6 @@
1
+ export declare class PKGJsonManager {
2
+ private _pkg?;
3
+ setPKGJson(pkg: Record<string, any>): void;
4
+ readPKGJson(root?: string): Record<string, any>;
5
+ getExposeGarfishModuleType(root?: string): string;
6
+ }
@@ -0,0 +1,18 @@
1
+ import { RemoteEntryInfo, StatsRemote, containerReferencePlugin, moduleFederationPlugin } from '@module-federation/sdk';
2
+ import { BasicPluginOptionsManager } from './BasicPluginOptionsManager';
3
+ interface NormalizedRemote {
4
+ [remoteName: string]: RemoteEntryInfo & {
5
+ alias: string;
6
+ shareScope: string | string[];
7
+ };
8
+ }
9
+ declare class RemoteManager extends BasicPluginOptionsManager<moduleFederationPlugin.ModuleFederationPluginOptions> {
10
+ normalizedOptions: NormalizedRemote;
11
+ get enable(): boolean;
12
+ get statsRemoteWithEmptyUsedIn(): StatsRemote[];
13
+ get dtsRemotes(): Record<string, string>;
14
+ get remotes(): moduleFederationPlugin.ModuleFederationPluginOptions['remotes'];
15
+ normalizeOptions(options?: containerReferencePlugin.ContainerReferencePluginOptions['remotes']): void;
16
+ init(options: moduleFederationPlugin.ModuleFederationPluginOptions): void;
17
+ }
18
+ export { RemoteManager };
@@ -0,0 +1,19 @@
1
+ import { moduleFederationPlugin, sharePlugin } from '@module-federation/sdk';
2
+ import { NormalizedSharedOptions } from './types';
3
+ import { BasicPluginOptionsManager } from './BasicPluginOptionsManager';
4
+ type SharePluginOptions = ConstructorParameters<typeof sharePlugin.SharePlugin>[0];
5
+ declare class SharedManager extends BasicPluginOptionsManager<moduleFederationPlugin.ModuleFederationPluginOptions> {
6
+ normalizedOptions: NormalizedSharedOptions;
7
+ get enable(): boolean;
8
+ get sharedPluginOptions(): SharePluginOptions;
9
+ findPkg(name: string, shareConfig: moduleFederationPlugin.SharedConfig): {
10
+ pkg: Record<string, any>;
11
+ path: string;
12
+ pkgPath: string;
13
+ };
14
+ get enableTreeShaking(): boolean;
15
+ transformSharedConfig(sharedConfig: moduleFederationPlugin.SharedConfig): moduleFederationPlugin.SharedConfig;
16
+ normalizeOptions(options: moduleFederationPlugin.ModuleFederationPluginOptions['shared']): void;
17
+ init(options: moduleFederationPlugin.ModuleFederationPluginOptions): void;
18
+ }
19
+ export { SharedManager };
@@ -0,0 +1,2 @@
1
+ export declare const LOCAL_BUILD_VERSION = "local";
2
+ export declare const UNKNOWN_MODULE_NAME = "UNKNOWN";
@@ -0,0 +1,8 @@
1
+ export { BasicPluginOptionsManager } from './BasicPluginOptionsManager';
2
+ export { ContainerManager } from './ContainerManager';
3
+ export { PKGJsonManager } from './PKGJsonManager';
4
+ export { RemoteManager } from './RemoteManager';
5
+ export { SharedManager } from './SharedManager';
6
+ export { UNKNOWN_MODULE_NAME } from './constant';
7
+ export * as utils from './utils';
8
+ export * as types from './types';
@@ -0,0 +1,16 @@
1
+ import { WebpackOptionsNormalized } from 'webpack';
2
+ import { moduleFederationPlugin } from '@module-federation/sdk';
3
+ export type EntryStaticNormalized = Awaited<ReturnType<Extract<WebpackOptionsNormalized['entry'], () => any>>>;
4
+ export type EntryDescriptionNormalized = EntryStaticNormalized[keyof EntryStaticNormalized];
5
+ export type ContainerOptionsFormat<T> = (string | Record<string, string | string[] | T>)[] | Record<string, string | string[] | T>;
6
+ export type NormalizeSimple<R> = (value: string | string[], key: string) => R;
7
+ export type NormalizeOptions<T, R> = (value: T, key: string) => R;
8
+ export type ProcessFN<R> = (key: string, normalizedOptions: R) => void;
9
+ export type ParsedContainerOptions<T> = [string, T][];
10
+ export type NormalizedSharedOption = {
11
+ name: string;
12
+ version: string;
13
+ } & moduleFederationPlugin.SharedConfig;
14
+ export interface NormalizedSharedOptions {
15
+ [depName: string]: NormalizedSharedOption;
16
+ }
@@ -0,0 +1,4 @@
1
+ import { ContainerOptionsFormat, NormalizeSimple, NormalizeOptions, ParsedContainerOptions } from './types';
2
+ export declare function parseOptions<T, R>(options: ContainerOptionsFormat<T>, normalizeSimple: NormalizeSimple<R>, normalizeOptions: NormalizeOptions<T, R>): ParsedContainerOptions<R>;
3
+ export declare function getBuildVersion(root?: string): string;
4
+ export declare function getBuildName(): string | undefined;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@module-federation/managers",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Provide managers for helping handle mf data .",
6
6
  "keywords": [
7
7
  "Module Federation"
8
8
  ],
9
+ "type": "commonjs",
9
10
  "files": [
10
11
  "dist/",
11
12
  "README.md"
@@ -26,7 +27,7 @@
26
27
  "dependencies": {
27
28
  "find-pkg": "2.0.0",
28
29
  "fs-extra": "9.1.0",
29
- "@module-federation/sdk": "2.0.1"
30
+ "@module-federation/sdk": "2.1.0"
30
31
  },
31
32
  "devDependencies": {
32
33
  "webpack": "5.104.1"
@@ -34,7 +35,7 @@
34
35
  "exports": {
35
36
  ".": {
36
37
  "import": {
37
- "types": "./dist/index.d.ts",
38
+ "types": "./dist/index.d.mts",
38
39
  "default": "./dist/index.mjs"
39
40
  },
40
41
  "require": {