@module-federation/enhanced 0.0.8 → 0.0.9

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 (55) hide show
  1. package/dist/package.json +2 -1
  2. package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +57 -0
  3. package/dist/src/declarations/plugins/container/ContainerPlugin.d.ts +187 -0
  4. package/dist/src/declarations/plugins/container/ContainerReferencePlugin.d.ts +80 -0
  5. package/dist/src/declarations/plugins/container/Dependency.d.ts +285 -0
  6. package/dist/src/declarations/plugins/container/Module.d.ts +138 -0
  7. package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +33 -0
  8. package/dist/src/declarations/plugins/container/ModuleFederationPlugin.d.ts +320 -0
  9. package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +4 -0
  10. package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +28 -0
  11. package/dist/src/declarations/plugins/container/Template.d.ts +198 -0
  12. package/dist/src/declarations/plugins/container/WebpackError.d.ts +32 -0
  13. package/dist/src/declarations/plugins/container/WebpackOptions.d.ts +140 -0
  14. package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +74 -0
  15. package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +67 -0
  16. package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +78 -0
  17. package/dist/src/lib/container/ContainerEntryDependency.d.ts +22 -20
  18. package/dist/src/lib/container/ContainerEntryModule.d.ts +70 -81
  19. package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +14 -10
  20. package/dist/src/lib/container/ContainerExposedDependency.d.ts +18 -25
  21. package/dist/src/lib/container/ContainerPlugin.d.ts +31 -10
  22. package/dist/src/lib/container/ContainerReferencePlugin.d.ts +27 -12
  23. package/dist/src/lib/container/FallbackDependency.d.ts +14 -20
  24. package/dist/src/lib/container/FallbackItemDependency.d.ts +3 -10
  25. package/dist/src/lib/container/FallbackModule.d.ts +52 -70
  26. package/dist/src/lib/container/FallbackModuleFactory.d.ts +10 -10
  27. package/dist/src/lib/container/ModuleFederationPlugin.d.ts +22 -15
  28. package/dist/src/lib/container/ModuleFederationPlugin.js +2 -2
  29. package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
  30. package/dist/src/lib/container/ModuleFederationPluginTypes.d.ts +271 -0
  31. package/dist/src/lib/container/ModuleFederationPluginTypes.js +8 -0
  32. package/dist/src/lib/container/ModuleFederationPluginTypes.js.map +1 -0
  33. package/dist/src/lib/container/RemoteModule.d.ts +88 -73
  34. package/dist/src/lib/container/RemoteRuntimeModule.d.ts +10 -7
  35. package/dist/src/lib/container/RemoteToExternalDependency.d.ts +3 -9
  36. package/dist/src/lib/container/options.d.ts +12 -4
  37. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +11 -2
  38. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -1
  39. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +3 -10
  40. package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +97 -104
  41. package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +28 -6
  42. package/dist/src/lib/sharing/ConsumeSharedPlugin.js +1 -1
  43. package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
  44. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +29 -11
  45. package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +3 -11
  46. package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +35 -37
  47. package/dist/src/lib/sharing/ProvideSharedModule.d.ts +65 -83
  48. package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +17 -10
  49. package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +37 -19
  50. package/dist/src/lib/sharing/SharePlugin.d.ts +39 -13
  51. package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
  52. package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +12 -8
  53. package/dist/src/lib/sharing/utils.d.ts +21 -29
  54. package/dist/src/schemas/container/ModuleFederationPlugin.check.d.ts +9 -7
  55. package/package.json +5 -4
@@ -1,10 +1,4 @@
1
- import type { Compiler } from 'webpack';
2
- import type { ProvideSharedPluginOptions, ProvidesConfig } from '../../declarations/plugins/sharing/ProvideSharedPlugin';
3
- export type ProvideOptions = ProvidesConfig;
4
- export type ResolvedProvideMap = Map<string, {
5
- config: ProvideOptions;
6
- version: string | undefined | false;
7
- }>;
1
+ export = ProvideSharedPlugin;
8
2
  /**
9
3
  * @typedef {Object} ProvideOptions
10
4
  * @property {string} shareKey
@@ -14,16 +8,40 @@ export type ResolvedProvideMap = Map<string, {
14
8
  */
15
9
  /** @typedef {Map<string, { config: ProvideOptions, version: string | undefined | false }>} ResolvedProvideMap */
16
10
  declare class ProvideSharedPlugin {
17
- private _provides;
18
- /**
19
- * @param {ProvideSharedPluginOptions} options options
20
- */
21
- constructor(options: ProvideSharedPluginOptions);
22
- /**
23
- * Apply the plugin
24
- * @param {Compiler} compiler the compiler instance
25
- * @returns {void}
26
- */
27
- apply(compiler: Compiler): void;
11
+ /**
12
+ * @param {ProvideSharedPluginOptions} options options
13
+ */
14
+ constructor(options: any);
15
+ _provides: [string, ProvideOptions][];
16
+ /**
17
+ * Apply the plugin
18
+ * @param {Compiler} compiler the compiler instance
19
+ * @returns {void}
20
+ */
21
+ apply(compiler: Compiler): void;
22
+ }
23
+ declare namespace ProvideSharedPlugin {
24
+ export {
25
+ ProvideSharedPluginOptions,
26
+ Compilation,
27
+ Compiler,
28
+ ProvideOptions,
29
+ ResolvedProvideMap,
30
+ };
28
31
  }
29
- export default ProvideSharedPlugin;
32
+ type ProvideOptions = {
33
+ shareKey: string;
34
+ shareScope: string;
35
+ version: string | undefined | false;
36
+ eager: boolean;
37
+ };
38
+ type Compiler = import('webpack/lib/Compiler');
39
+ type ProvideSharedPluginOptions = any;
40
+ type Compilation = import('webpack/lib/Compilation');
41
+ type ResolvedProvideMap = Map<
42
+ string,
43
+ {
44
+ config: ProvideOptions;
45
+ version: string | undefined | false;
46
+ }
47
+ >;
@@ -1,15 +1,41 @@
1
- import type { Compiler } from 'webpack';
2
- import type { SharePluginOptions } from '../../declarations/plugins/sharing/SharePlugin';
1
+ export = SharePlugin;
2
+ /** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */
3
+ /** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */
4
+ /** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */
5
+ /** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */
6
+ /** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */
7
+ /** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */
8
+ /** @typedef {import("webpack/lib/Compiler")} Compiler */
3
9
  declare class SharePlugin {
4
- private _shareScope;
5
- private _consumes;
6
- private _provides;
7
- constructor(options: SharePluginOptions);
8
- /**
9
- * Apply the plugin
10
- * @param {Compiler} compiler the compiler instance
11
- * @returns {void}
12
- */
13
- apply(compiler: Compiler): void;
10
+ /**
11
+ * @param {SharePluginOptions} options options
12
+ */
13
+ constructor(options: any);
14
+ _shareScope: any;
15
+ _consumes: Record<string, any>[];
16
+ _provides: Record<string, any>[];
17
+ /**
18
+ * Apply the plugin
19
+ * @param {Compiler} compiler the compiler instance
20
+ * @returns {void}
21
+ */
22
+ apply(compiler: Compiler): void;
14
23
  }
15
- export default SharePlugin;
24
+ declare namespace SharePlugin {
25
+ export {
26
+ ConsumeSharedPluginOptions,
27
+ ConsumesConfig,
28
+ ProvideSharedPluginOptions,
29
+ ProvidesConfig,
30
+ SharePluginOptions,
31
+ SharedConfig,
32
+ Compiler,
33
+ };
34
+ }
35
+ type Compiler = import('webpack/lib/Compiler');
36
+ type ConsumeSharedPluginOptions = any;
37
+ type ConsumesConfig = any;
38
+ type ProvideSharedPluginOptions = any;
39
+ type ProvidesConfig = any;
40
+ type SharePluginOptions = any;
41
+ type SharedConfig = any;
@@ -1,9 +1,14 @@
1
- declare const RuntimeModule: typeof import("webpack").RuntimeModule;
1
+ export = ShareRuntimeModule;
2
+ /** @typedef {import("webpack/lib/Chunk")} Chunk */
3
+ /** @typedef {import("webpack/lib/ChunkGraph")} ChunkGraph */
4
+ /** @typedef {import("webpack/lib/Compilation")} Compilation */
2
5
  declare class ShareRuntimeModule extends RuntimeModule {
3
- constructor();
4
- /**
5
- * @returns {string | null} runtime code
6
- */
7
- generate(): string | null;
6
+ constructor();
8
7
  }
9
- export default ShareRuntimeModule;
8
+ declare namespace ShareRuntimeModule {
9
+ export { Chunk, ChunkGraph, Compilation };
10
+ }
11
+ import RuntimeModule = require('webpack/lib/RuntimeModule');
12
+ type Chunk = import('webpack/lib/Chunk');
13
+ type ChunkGraph = import('webpack/lib/ChunkGraph');
14
+ type Compilation = import('webpack/lib/Compilation');
@@ -1,8 +1,12 @@
1
- import type { Compilation } from 'webpack';
2
- interface MatchedConfigs<T> {
3
- resolved: Map<string, T>;
4
- unresolved: Map<string, T>;
5
- prefixed: Map<string, T>;
6
- }
7
- export declare function resolveMatchedConfigs<T>(compilation: Compilation, configs: [string, T][]): Promise<MatchedConfigs<T>>;
8
- export {};
1
+ export function resolveMatchedConfigs<T>(
2
+ compilation: Compilation,
3
+ configs: [string, T][],
4
+ ): Promise<MatchedConfigs<T>>;
5
+ export type Compilation = import('webpack/lib/Compilation');
6
+ export type ResolveOptionsWithDependencyType =
7
+ import('webpack/lib/ResolverFactory').ResolveOptionsWithDependencyType;
8
+ export type MatchedConfigs<T> = {
9
+ resolved: Map<string, T>;
10
+ unresolved: Map<string, T>;
11
+ prefixed: Map<string, T>;
12
+ };
@@ -1,18 +1,19 @@
1
- import type { ConsumeOptions } from 'webpack/lib/sharing/ConsumeSharedModule';
2
- import type { InputFileSystem } from 'webpack/lib/util/fs';
1
+ export function getRequiredVersionFromDescriptionFile(
2
+ data: any,
3
+ packageName: any,
4
+ ): string;
5
+ export type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
3
6
  /**
4
7
  * @param {string} str maybe required version
5
8
  * @returns {boolean} true, if it looks like a version
6
9
  */
7
- declare function isRequiredVersion(str: string): boolean;
8
- export { isRequiredVersion };
10
+ export function isRequiredVersion(str: string): boolean;
9
11
  /**
10
12
  * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies
11
13
  * @param {string} versionDesc version to be normalized
12
14
  * @returns {string} normalized version
13
15
  */
14
- declare function normalizeVersion(versionDesc: string): string;
15
- export { normalizeVersion };
16
+ export function normalizeVersion(versionDesc: string): string;
16
17
  /**
17
18
  *
18
19
  * @param {InputFileSystem} fs file system
@@ -20,26 +21,17 @@ export { normalizeVersion };
20
21
  * @param {string[]} descriptionFiles possible description filenames
21
22
  * @param {function((Error | null)=, {data: object, path: string}=): void} callback callback
22
23
  */
23
- declare const getDescriptionFile: (fs: InputFileSystem, directory: string, descriptionFiles: string[], callback: (err: Error | null, data?: {
24
- data: object;
25
- path: string;
26
- } | undefined) => void) => void;
27
- export { getDescriptionFile };
28
- /**
29
- * Get required version from description file
30
- * @param {Record<string, any>} data - The data object
31
- * @param {string} packageName - The package name
32
- * @returns {string | undefined} The normalized version
33
- */
34
- export declare function getRequiredVersionFromDescriptionFile(data: Record<string, any>, packageName: string): string | undefined | void;
35
- export declare function normalizeConsumeShareOptions(consumeOptions: ConsumeOptions): {
36
- shareConfig: {
37
- fixedDependencies: boolean;
38
- requiredVersion: false | import("../../../../../webpack/lib/util/semver").SemVerRange;
39
- strictVersion: boolean;
40
- singleton: boolean;
41
- eager: boolean;
42
- };
43
- shareScope: string;
44
- shareKey: string;
45
- };
24
+ export function getDescriptionFile(
25
+ fs: InputFileSystem,
26
+ directory: string,
27
+ descriptionFiles: string[],
28
+ callback: (
29
+ arg0: (Error | null) | undefined,
30
+ arg1:
31
+ | {
32
+ data: object;
33
+ path: string;
34
+ }
35
+ | undefined,
36
+ ) => void,
37
+ ): void;
@@ -1,7 +1,9 @@
1
- declare function validate48(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
2
- instancePath?: string | undefined;
3
- parentData: any;
4
- parentDataProperty: any;
5
- rootData?: any;
6
- }): boolean;
7
- export default validate48;
1
+ /*
2
+ * This file was automatically generated.
3
+ * DO NOT MODIFY BY HAND.
4
+ * Run `yarn special-lint-fix` to update
5
+ */
6
+ declare const check: (
7
+ options: import('../../../declarations/plugins/container/ModuleFederationPlugin').ModuleFederationPluginOptions,
8
+ ) => boolean;
9
+ export = check;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/enhanced",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "files": [
@@ -16,6 +16,7 @@
16
16
  "exports": {
17
17
  ".": {
18
18
  "require": "./dist/src/index.js",
19
+ "import": "./dist/src/index.js",
19
20
  "types": "./dist/index.d.ts"
20
21
  }
21
22
  },
@@ -27,10 +28,10 @@
27
28
  }
28
29
  },
29
30
  "devDependencies": {
30
- "@module-federation/webpack-bundler-runtime": "0.0.8"
31
+ "@module-federation/webpack-bundler-runtime": "0.0.9"
31
32
  },
32
33
  "dependencies": {
33
- "@module-federation/sdk": "0.0.8",
34
- "@module-federation/runtime-tools": "0.0.8"
34
+ "@module-federation/sdk": "0.0.9",
35
+ "@module-federation/runtime-tools": "0.0.9"
35
36
  }
36
37
  }