@module-federation/sdk 0.2.2 → 0.2.4
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 +266 -888
- package/dist/index.esm.js +266 -888
- 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/dom.d.ts +2 -2
- package/dist/src/normalizeOptions.d.ts +1 -1
- 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/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;
|