@softarc/native-federation 4.0.0 → 4.0.1
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/package.json
CHANGED
|
@@ -55,7 +55,10 @@ export async function bundleExposedAndMappings(config, fedOptions, externals, mo
|
|
|
55
55
|
}
|
|
56
56
|
throw error;
|
|
57
57
|
}
|
|
58
|
-
const resultMap = createBuildResultMap(result, hash
|
|
58
|
+
const resultMap = createBuildResultMap(result, hash, [
|
|
59
|
+
...shared.map(s => s.outName),
|
|
60
|
+
...exposes.map(e => e.outName),
|
|
61
|
+
]);
|
|
59
62
|
const sharedResult = [];
|
|
60
63
|
const entryFiles = [];
|
|
61
64
|
// Pick shared-mappings
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NFBuildAdapterResult } from '../domain/core/build-adapter.contract.js';
|
|
2
|
-
export declare function createBuildResultMap(buildResult: NFBuildAdapterResult[], isHashed: boolean): Record<string, string>;
|
|
2
|
+
export declare function createBuildResultMap(buildResult: NFBuildAdapterResult[], isHashed: boolean, expectedNames?: string[]): Record<string, string>;
|
|
3
3
|
export declare function lookupInResultMap(map: Record<string, string>, requestName: string): string;
|
|
4
4
|
export declare function popFromResultMap(map: Record<string, string>, requestName: string): string;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
|
|
2
|
+
function stripHash(fileName) {
|
|
3
|
+
const start = fileName.lastIndexOf('-');
|
|
4
|
+
const end = fileName.lastIndexOf('.');
|
|
5
|
+
if (start < 0 || end < 0 || start > end)
|
|
6
|
+
return fileName;
|
|
7
|
+
return fileName.substring(0, start) + fileName.substring(end);
|
|
8
|
+
}
|
|
9
|
+
export function createBuildResultMap(buildResult, isHashed, expectedNames = []) {
|
|
10
|
+
const expected = new Set(expectedNames.map(n => path.basename(n)));
|
|
3
11
|
const map = {};
|
|
4
12
|
for (const item of buildResult) {
|
|
5
13
|
const resultName = path.basename(item.fileName);
|
|
6
|
-
|
|
7
|
-
if (isHashed) {
|
|
8
|
-
const start = resultName.lastIndexOf('-');
|
|
9
|
-
const end = resultName.lastIndexOf('.');
|
|
10
|
-
const part1 = resultName.substring(0, start);
|
|
11
|
-
const part2 = resultName.substring(end);
|
|
12
|
-
requestName = part1 + part2;
|
|
13
|
-
}
|
|
14
|
+
const requestName = isHashed && expected.has(stripHash(resultName)) ? stripHash(resultName) : resultName;
|
|
14
15
|
map[requestName] = item.fileName;
|
|
15
16
|
}
|
|
16
17
|
return map;
|