@module-federation/sdk 0.0.0-next-20240626050252 → 0.0.0-next-20240701101956
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/dist/index.cjs.js +274 -893
- package/dist/index.esm.js +274 -894
- package/dist/normalize-webpack-path.cjs.js +9 -12
- package/dist/normalize-webpack-path.esm.js +9 -12
- package/dist/package.json +1 -1
- package/dist/src/constant.d.ts +7 -0
- package/dist/src/dom.d.ts +2 -2
- package/dist/src/normalizeOptions.d.ts +1 -1
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +5 -6
- package/dist/src/types/snapshot.d.ts +0 -3
- package/dist/src/types/stats.d.ts +1 -2
- package/package.json +1 -1
|
@@ -8,23 +8,20 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
10
10
|
|
|
11
|
-
function getWebpackPath(compiler
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
11
|
+
function getWebpackPath(compiler, options = {
|
|
12
|
+
framework: 'other'
|
|
13
|
+
}) {
|
|
15
14
|
try {
|
|
16
15
|
// @ts-ignore just throw err
|
|
17
16
|
compiler.webpack();
|
|
18
17
|
return '';
|
|
19
18
|
} catch (err) {
|
|
20
19
|
var _err_stack;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var webpackPath = webpackLocationWithDetail.split(':').slice(0, -2).join(':');
|
|
27
|
-
if ((options === null || options === void 0 ? void 0 : options.framework) === 'nextjs') {
|
|
20
|
+
const trace = ((_err_stack = err.stack) == null ? void 0 : _err_stack.split('\n')) || [];
|
|
21
|
+
const webpackErrLocation = trace.find((item)=>item.includes('at webpack')) || '';
|
|
22
|
+
const webpackLocationWithDetail = webpackErrLocation.replace(/[^\(\)]+/, '').slice(1, -1);
|
|
23
|
+
const webpackPath = webpackLocationWithDetail.split(':').slice(0, -2).join(':');
|
|
24
|
+
if ((options == null ? void 0 : options.framework) === 'nextjs') {
|
|
28
25
|
if (webpackPath.endsWith('webpack.js')) {
|
|
29
26
|
return webpackPath.replace('webpack.js', 'index.js');
|
|
30
27
|
}
|
|
@@ -37,7 +34,7 @@ function getWebpackPath(compiler) {
|
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
|
|
37
|
+
const normalizeWebpackPath = (fullPath)=>{
|
|
41
38
|
if (fullPath === 'webpack') {
|
|
42
39
|
return process.env['FEDERATION_WEBPACK_PATH'] || fullPath;
|
|
43
40
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
|
|
3
|
-
function getWebpackPath(compiler
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
function getWebpackPath(compiler, options = {
|
|
4
|
+
framework: 'other'
|
|
5
|
+
}) {
|
|
7
6
|
try {
|
|
8
7
|
// @ts-ignore just throw err
|
|
9
8
|
compiler.webpack();
|
|
10
9
|
return '';
|
|
11
10
|
} catch (err) {
|
|
12
11
|
var _err_stack;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var webpackPath = webpackLocationWithDetail.split(':').slice(0, -2).join(':');
|
|
19
|
-
if ((options === null || options === void 0 ? void 0 : options.framework) === 'nextjs') {
|
|
12
|
+
const trace = ((_err_stack = err.stack) == null ? void 0 : _err_stack.split('\n')) || [];
|
|
13
|
+
const webpackErrLocation = trace.find((item)=>item.includes('at webpack')) || '';
|
|
14
|
+
const webpackLocationWithDetail = webpackErrLocation.replace(/[^\(\)]+/, '').slice(1, -1);
|
|
15
|
+
const webpackPath = webpackLocationWithDetail.split(':').slice(0, -2).join(':');
|
|
16
|
+
if ((options == null ? void 0 : options.framework) === 'nextjs') {
|
|
20
17
|
if (webpackPath.endsWith('webpack.js')) {
|
|
21
18
|
return webpackPath.replace('webpack.js', 'index.js');
|
|
22
19
|
}
|
|
@@ -29,7 +26,7 @@ function getWebpackPath(compiler) {
|
|
|
29
26
|
});
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
const normalizeWebpackPath = (fullPath)=>{
|
|
33
30
|
if (fullPath === 'webpack') {
|
|
34
31
|
return process.env['FEDERATION_WEBPACK_PATH'] || fullPath;
|
|
35
32
|
}
|
package/dist/package.json
CHANGED
package/dist/src/constant.d.ts
CHANGED
|
@@ -22,3 +22,10 @@ export declare const MFModuleType: {
|
|
|
22
22
|
};
|
|
23
23
|
export declare const MODULE_DEVTOOL_IDENTIFIER = "__MF_DEVTOOLS_MODULE_INFO__";
|
|
24
24
|
export declare const ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX";
|
|
25
|
+
export declare const MFPrefetchCommon: {
|
|
26
|
+
identifier: string;
|
|
27
|
+
globalKey: string;
|
|
28
|
+
library: string;
|
|
29
|
+
exportsKey: string;
|
|
30
|
+
fileName: string;
|
|
31
|
+
};
|
package/dist/src/dom.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function createScript(info: {
|
|
|
9
9
|
cb?: (value: void | PromiseLike<void>) => void;
|
|
10
10
|
attrs?: Record<string, any>;
|
|
11
11
|
needDeleteScript?: boolean;
|
|
12
|
-
createScriptHook?: (url: string) => CreateScriptHookReturn;
|
|
12
|
+
createScriptHook?: (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturn;
|
|
13
13
|
}): {
|
|
14
14
|
script: HTMLScriptElement;
|
|
15
15
|
needAttach: boolean;
|
|
@@ -26,5 +26,5 @@ export declare function createLink(info: {
|
|
|
26
26
|
};
|
|
27
27
|
export declare function loadScript(url: string, info: {
|
|
28
28
|
attrs?: Record<string, any>;
|
|
29
|
-
createScriptHook?: (url: string) => CreateScriptHookReturn;
|
|
29
|
+
createScriptHook?: (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturn;
|
|
30
30
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function normalizeOptions<T>(enableDefault: boolean, defaultOptions: T, key: string): <U extends boolean |
|
|
1
|
+
export declare function normalizeOptions<T>(enableDefault: boolean, defaultOptions: T, key: string): <U extends boolean | undefined | T>(options: U) => T | false;
|
|
@@ -65,6 +65,10 @@ export type Shared = (SharedItem | SharedObject)[] | SharedObject;
|
|
|
65
65
|
* A module that should be shared in the share scope.
|
|
66
66
|
*/
|
|
67
67
|
export type SharedItem = string;
|
|
68
|
+
/**
|
|
69
|
+
* Enable Data Prefetch
|
|
70
|
+
*/
|
|
71
|
+
export type DataPrefetch = boolean;
|
|
68
72
|
export interface AdditionalDataOptions {
|
|
69
73
|
stats: Stats;
|
|
70
74
|
manifest?: Manifest;
|
|
@@ -91,7 +95,6 @@ export interface DtsHostOptions {
|
|
|
91
95
|
deleteTypesFolder?: boolean;
|
|
92
96
|
maxRetries?: number;
|
|
93
97
|
consumeAPITypes?: boolean;
|
|
94
|
-
runtimePkgs?: string[];
|
|
95
98
|
}
|
|
96
99
|
export interface DtsRemoteOptions {
|
|
97
100
|
tsConfigPath?: string;
|
|
@@ -113,10 +116,6 @@ export interface PluginDtsOptions {
|
|
|
113
116
|
extraOptions?: Record<string, any>;
|
|
114
117
|
implementation?: string;
|
|
115
118
|
}
|
|
116
|
-
export type AsyncBoundaryOptions = {
|
|
117
|
-
eager?: RegExp | ((module: any) => boolean);
|
|
118
|
-
excludeChunk?: (chunk: any) => boolean;
|
|
119
|
-
};
|
|
120
119
|
export interface ModuleFederationPluginOptions {
|
|
121
120
|
/**
|
|
122
121
|
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
|
@@ -169,7 +168,7 @@ export interface ModuleFederationPluginOptions {
|
|
|
169
168
|
manifest?: boolean | PluginManifestOptions;
|
|
170
169
|
dev?: boolean | PluginDevOptions;
|
|
171
170
|
dts?: boolean | PluginDtsOptions;
|
|
172
|
-
|
|
171
|
+
dataPrefetch?: DataPrefetch;
|
|
173
172
|
}
|
|
174
173
|
/**
|
|
175
174
|
* Modules that should be exposed by this container. Property names are used as public paths.
|
|
@@ -23,8 +23,6 @@ interface BasicModuleInfo {
|
|
|
23
23
|
export interface BasicProviderModuleInfo extends BasicModuleInfo {
|
|
24
24
|
remoteEntry: string;
|
|
25
25
|
remoteEntryType: RemoteEntryType;
|
|
26
|
-
ssrRemoteEntry?: string;
|
|
27
|
-
ssrRemoteEntryType?: RemoteEntryType;
|
|
28
26
|
remoteManifest?: string;
|
|
29
27
|
globalName: string;
|
|
30
28
|
modules: Array<{
|
|
@@ -44,7 +42,6 @@ interface BasicProviderModuleInfoWithGetPublicPath extends BasicProviderModuleIn
|
|
|
44
42
|
}
|
|
45
43
|
export interface ManifestProvider {
|
|
46
44
|
remoteEntry: string;
|
|
47
|
-
ssrRemoteEntry?: string;
|
|
48
45
|
version?: string;
|
|
49
46
|
}
|
|
50
47
|
export interface PureEntryProvider extends ManifestProvider {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RemoteWithEntry, RemoteWithVersion } from './common';
|
|
2
2
|
export type RemoteEntryType = 'var' | 'module' | 'assign' | 'assign-properties' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | string;
|
|
3
|
-
|
|
3
|
+
interface ResourceInfo {
|
|
4
4
|
path: string;
|
|
5
5
|
name: string;
|
|
6
6
|
type: RemoteEntryType;
|
|
@@ -20,7 +20,6 @@ export interface BasicStatsMetaData {
|
|
|
20
20
|
globalName: string;
|
|
21
21
|
buildInfo: StatsBuildInfo;
|
|
22
22
|
remoteEntry: ResourceInfo;
|
|
23
|
-
ssrRemoteEntry?: ResourceInfo;
|
|
24
23
|
prefetchInterface?: boolean;
|
|
25
24
|
prefetchEntry?: ResourceInfo;
|
|
26
25
|
types: MetaDataTypes;
|