@module-federation/sdk 2.1.0 → 2.2.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.
Files changed (45) hide show
  1. package/README.md +9 -3
  2. package/dist/createModuleFederationConfig.d.ts +0 -2
  3. package/dist/dom.cjs +15 -1
  4. package/dist/dom.cjs.map +1 -1
  5. package/dist/dom.d.ts +0 -2
  6. package/dist/dom.js +15 -1
  7. package/dist/dom.js.map +1 -1
  8. package/dist/env.cjs +3 -1
  9. package/dist/env.cjs.map +1 -1
  10. package/dist/env.d.ts +2 -1
  11. package/dist/env.js +3 -2
  12. package/dist/env.js.map +1 -1
  13. package/dist/generateSnapshotFromManifest.d.ts +0 -2
  14. package/dist/index.cjs +15 -0
  15. package/dist/index.d.ts +4 -3
  16. package/dist/index.js +4 -2
  17. package/dist/node.cjs.map +1 -1
  18. package/dist/node.d.ts +0 -2
  19. package/dist/node.js.map +1 -1
  20. package/dist/types/index.d.ts +2 -1
  21. package/dist/types/plugins/ConsumeSharedPlugin.cjs +13 -0
  22. package/dist/types/plugins/ConsumeSharedPlugin.cjs.map +1 -0
  23. package/dist/types/plugins/ConsumeSharedPlugin.d.ts +109 -0
  24. package/dist/types/plugins/ConsumeSharedPlugin.js +8 -0
  25. package/dist/types/plugins/ConsumeSharedPlugin.js.map +1 -0
  26. package/dist/types/plugins/ContainerPlugin.cjs.map +1 -1
  27. package/dist/types/plugins/ContainerPlugin.d.ts +15 -13
  28. package/dist/types/plugins/ContainerPlugin.js.map +1 -1
  29. package/dist/types/plugins/ContainerReferencePlugin.cjs.map +1 -1
  30. package/dist/types/plugins/ContainerReferencePlugin.d.ts +4 -3
  31. package/dist/types/plugins/ContainerReferencePlugin.js.map +1 -1
  32. package/dist/types/plugins/ModuleFederationPlugin.cjs.map +1 -1
  33. package/dist/types/plugins/ModuleFederationPlugin.d.ts +213 -190
  34. package/dist/types/plugins/ModuleFederationPlugin.js.map +1 -1
  35. package/dist/types/plugins/ProvideSharedPlugin.cjs +13 -0
  36. package/dist/types/plugins/ProvideSharedPlugin.cjs.map +1 -0
  37. package/dist/types/plugins/ProvideSharedPlugin.d.ts +97 -0
  38. package/dist/types/plugins/ProvideSharedPlugin.js +8 -0
  39. package/dist/types/plugins/ProvideSharedPlugin.js.map +1 -0
  40. package/dist/types/plugins/SharePlugin.cjs.map +1 -1
  41. package/dist/types/plugins/SharePlugin.d.ts +9 -12
  42. package/dist/types/plugins/SharePlugin.js.map +1 -1
  43. package/dist/types/plugins/index.d.ts +3 -1
  44. package/dist/utils.d.ts +0 -2
  45. package/package.json +8 -1
@@ -0,0 +1,8 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+
3
+ //#region src/types/plugins/ProvideSharedPlugin.ts
4
+ var ProvideSharedPlugin_exports = /* @__PURE__ */ __exportAll({});
5
+
6
+ //#endregion
7
+ export { ProvideSharedPlugin_exports };
8
+ //# sourceMappingURL=ProvideSharedPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProvideSharedPlugin.js","names":[],"sources":["../../../src/types/plugins/ProvideSharedPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type { IncludeExcludeOptions } from './ConsumeSharedPlugin';\n\n/**\n * Request to a module that should be provided as shared module to the share scope (will be resolved when relative).\n */\nexport type ProvidesItem = string;\n\n/**\n * Advanced configuration for modules that should be provided as shared modules to the share scope.\n */\nexport interface ProvidesConfig {\n /**\n * Include the provided module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Key in the share scope under which the shared modules should be stored.\n */\n shareKey?: string;\n /**\n * Import request to match on\n */\n request?: string;\n /**\n * Share scope name.\n */\n shareScope?: string | string[];\n /**\n * Version requirement from module in share scope.\n */\n requiredVersion?: false | string;\n /**\n * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).\n */\n strictVersion?: boolean;\n /**\n * Allow only a single version of the shared module in share scope (disabled by default).\n */\n singleton?: boolean;\n /**\n * Layer in which the shared module should be placed.\n */\n layer?: string;\n /**\n * Layer of the issuer.\n */\n issuerLayer?: string;\n /**\n * Version of the provided module. Will replace lower matching versions, but not higher.\n */\n version?: false | string;\n /**\n * Filter for the shared module.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Options for including only certain versions or requests of the provided module. Cannot be used with 'exclude'.\n */\n include?: IncludeExcludeOptions;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Tree shaking mode for the shared module.\n */\n treeShakingMode?: 'server-calc' | 'runtime-infer';\n}\n\n/**\n * Modules that should be provided as shared modules to the share scope. Property names are used as share keys.\n */\nexport interface ProvidesObject {\n [k: string]: ProvidesConfig | ProvidesItem;\n}\n\n/**\n * Modules that should be provided as shared modules to the share scope. When provided, property name is used to match modules, otherwise this is automatically inferred from share key.\n */\nexport type Provides = (ProvidesItem | ProvidesObject)[] | ProvidesObject;\n\nexport interface ProvideSharedPluginOptions {\n provides: Provides;\n /**\n * Share scope name used for all provided modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable reconstructed lookup for node_modules paths */\n allowNodeModulesSuffixMatch?: boolean;\n };\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"SharePlugin.cjs","names":[],"sources":["../../../src/types/plugins/SharePlugin.ts"],"sourcesContent":["import type { Shared } from './ModuleFederationPlugin';\n\n/**\n * Options for shared modules.\n */\nexport interface SharePluginOptions {\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared: Shared;\n}\nexport declare class SharePlugin {\n constructor(options: SharePluginOptions);\n\n /**\n * Apply the plugin\n */\n apply(compiler: any): void;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"SharePlugin.cjs","names":[],"sources":["../../../src/types/plugins/SharePlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type { Shared } from './ModuleFederationPlugin';\n\nexport interface SharePluginOptions {\n /**\n * Enable/disable asynchronous loading of runtime modules. When enabled, entry points will be wrapped in asynchronous chunks.\n */\n async?: boolean;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n shared: Shared;\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable reconstructed lookup for node_modules paths */\n allowNodeModulesSuffixMatch?: boolean;\n };\n}\n"],"mappings":""}
@@ -2,27 +2,24 @@ import { Shared } from "./ModuleFederationPlugin.js";
2
2
 
3
3
  //#region src/types/plugins/SharePlugin.d.ts
4
4
  declare namespace SharePlugin_d_exports {
5
- export { SharePlugin, SharePluginOptions };
5
+ export { SharePluginOptions };
6
6
  }
7
- /**
8
- * Options for shared modules.
9
- */
10
7
  interface SharePluginOptions {
11
8
  /**
12
- * Share scope name used for all shared modules (defaults to 'default').
9
+ * Enable/disable asynchronous loading of runtime modules. When enabled, entry points will be wrapped in asynchronous chunks.
13
10
  */
14
- shareScope?: string | string[];
11
+ async?: boolean;
15
12
  /**
16
- * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
13
+ * Share scope name used for all shared modules (defaults to 'default').
17
14
  */
15
+ shareScope?: string | string[];
18
16
  shared: Shared;
19
- }
20
- declare class SharePlugin {
21
- constructor(options: SharePluginOptions);
22
17
  /**
23
- * Apply the plugin
18
+ * Experimental features configuration
24
19
  */
25
- apply(compiler: any): void;
20
+ experiments?: {
21
+ /** Enable reconstructed lookup for node_modules paths */allowNodeModulesSuffixMatch?: boolean;
22
+ };
26
23
  }
27
24
  //#endregion
28
25
  export { SharePlugin_d_exports };
@@ -1 +1 @@
1
- {"version":3,"file":"SharePlugin.js","names":[],"sources":["../../../src/types/plugins/SharePlugin.ts"],"sourcesContent":["import type { Shared } from './ModuleFederationPlugin';\n\n/**\n * Options for shared modules.\n */\nexport interface SharePluginOptions {\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared: Shared;\n}\nexport declare class SharePlugin {\n constructor(options: SharePluginOptions);\n\n /**\n * Apply the plugin\n */\n apply(compiler: any): void;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"SharePlugin.js","names":[],"sources":["../../../src/types/plugins/SharePlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type { Shared } from './ModuleFederationPlugin';\n\nexport interface SharePluginOptions {\n /**\n * Enable/disable asynchronous loading of runtime modules. When enabled, entry points will be wrapped in asynchronous chunks.\n */\n async?: boolean;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n shared: Shared;\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable reconstructed lookup for node_modules paths */\n allowNodeModulesSuffixMatch?: boolean;\n };\n}\n"],"mappings":""}
@@ -1,4 +1,6 @@
1
1
  import { ModuleFederationPlugin_d_exports } from "./ModuleFederationPlugin.js";
2
2
  import { ContainerPlugin_d_exports } from "./ContainerPlugin.js";
3
3
  import { ContainerReferencePlugin_d_exports } from "./ContainerReferencePlugin.js";
4
- import { SharePlugin_d_exports } from "./SharePlugin.js";
4
+ import { SharePlugin_d_exports } from "./SharePlugin.js";
5
+ import { ConsumeSharedPlugin_d_exports } from "./ConsumeSharedPlugin.js";
6
+ import { ProvideSharedPlugin_d_exports } from "./ProvideSharedPlugin.js";
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { RemoteEntryInfo } from "./types/common.js";
2
2
  import { ModuleInfo } from "./types/snapshot.js";
3
- import "./types/index.js";
4
-
5
3
  //#region src/utils.d.ts
6
4
  declare const parseEntry: (str: string, devVerOrUrl?: string, separator?: string) => RemoteEntryInfo;
7
5
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A sdk for support module federation",
@@ -60,5 +60,12 @@
60
60
  "./dist/normalize-webpack-path.d.ts"
61
61
  ]
62
62
  }
63
+ },
64
+ "scripts": {
65
+ "build": "tsdown --config tsdown.config.ts",
66
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
67
+ "test": "pnpm exec jest --config jest.config.cjs --passWithNoTests",
68
+ "test:ci": "pnpm exec jest --config jest.config.cjs --passWithNoTests --ci --coverage",
69
+ "pre-release": "pnpm run test && pnpm run build"
63
70
  }
64
71
  }