@softarc/native-federation 4.1.1 → 4.1.2
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 +1 -1
- package/src/config.d.ts +1 -1
- package/src/config.js +1 -1
- package/src/lib/config/share-utils.js +2 -1
- package/src/lib/config/with-native-federation.js +1 -0
- package/src/lib/core/build-for-federation.js +1 -1
- package/src/lib/core/bundle-exposed-and-mappings.js +1 -1
- package/src/lib/core/bundle-shared.js +2 -2
- package/src/lib/core/rebuild-for-federation.js +1 -1
- package/src/lib/domain/config/federation-config.contract.d.ts +2 -0
- package/src/lib/domain/core/federation-options.contract.d.ts +0 -1
package/package.json
CHANGED
package/src/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './lib/domain/config/index.js';
|
|
2
2
|
export { withNativeFederation } from './lib/config/with-native-federation.js';
|
|
3
|
-
export { findRootTsConfigJson, share, shareAll } from './lib/config/share-utils.js';
|
|
3
|
+
export { findRootTsConfigJson, share, shareAll, setInferVersion, } from './lib/config/share-utils.js';
|
|
4
4
|
export { DEFAULT_SKIP_LIST } from './lib/config/default-skip-list.js';
|
package/src/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './lib/domain/config/index.js';
|
|
2
2
|
export { withNativeFederation } from './lib/config/with-native-federation.js';
|
|
3
|
-
export { findRootTsConfigJson, share, shareAll } from './lib/config/share-utils.js';
|
|
3
|
+
export { findRootTsConfigJson, share, shareAll, setInferVersion, } from './lib/config/share-utils.js';
|
|
4
4
|
export { DEFAULT_SKIP_LIST } from './lib/config/default-skip-list.js';
|
|
@@ -264,7 +264,8 @@ export function share(configuredShareObjects, projectPath = '', skipList = DEFAU
|
|
|
264
264
|
includeSecondaries = false;
|
|
265
265
|
const shareObject = shareObjects[key];
|
|
266
266
|
if (shareObject.requiredVersion === 'auto' ||
|
|
267
|
-
(inferVersion && typeof shareObject.requiredVersion === 'undefined')
|
|
267
|
+
(inferVersion && typeof shareObject.requiredVersion === 'undefined') ||
|
|
268
|
+
shareObject.requiredVersion.length < 1) {
|
|
268
269
|
const version = lookupVersion(key, projectPath);
|
|
269
270
|
shareObject.requiredVersion = version;
|
|
270
271
|
shareObject.version = version.replace(/^\D*/, '');
|
|
@@ -18,6 +18,7 @@ export function withNativeFederation(config) {
|
|
|
18
18
|
mappingVersion: config.features?.mappingVersion ?? true,
|
|
19
19
|
ignoreUnusedDeps: config.features?.ignoreUnusedDeps ?? true,
|
|
20
20
|
denseChunking: config.features?.denseChunking ?? false,
|
|
21
|
+
integrityHashes: config.features?.integrityHashes ?? false,
|
|
21
22
|
},
|
|
22
23
|
...(config.shareScope && { shareScope: config.shareScope }),
|
|
23
24
|
};
|
|
@@ -87,7 +87,7 @@ export async function buildForFederation(config, fedOptions, externals, signal)
|
|
|
87
87
|
if (artifactInfo?.chunks) {
|
|
88
88
|
federationInfo.chunks = { ...(federationInfo.chunks ?? {}), ...artifactInfo?.chunks };
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
90
|
+
if (config.features.integrityHashes) {
|
|
91
91
|
federationInfo.integrity = {
|
|
92
92
|
...(fedOptions.federationCache.integrity ?? {}),
|
|
93
93
|
...(artifactInfo?.integrity ?? {}),
|
|
@@ -100,7 +100,7 @@ export async function bundleExposedAndMappings(config, fedOptions, externals, mo
|
|
|
100
100
|
}
|
|
101
101
|
// Must run after rewriteChunkImports so SRI matches the final on-disk bytes.
|
|
102
102
|
let integrity;
|
|
103
|
-
if (
|
|
103
|
+
if (config.features.integrityHashes) {
|
|
104
104
|
integrity = {};
|
|
105
105
|
for (const filePath of [...entryFiles, ...chunkPaths]) {
|
|
106
106
|
if (!fs.existsSync(filePath))
|
|
@@ -22,7 +22,7 @@ export async function bundleShared(sharedBundles, config, fedOptions, externals,
|
|
|
22
22
|
logger.debug(`Checksum of ${buildOptions.bundleName} matched, Skipped artifact bundling`);
|
|
23
23
|
bundleCache.copyFiles(path.join(fedOptions.workspaceRoot, fedOptions.outputPath));
|
|
24
24
|
let integrity = cacheMetadata.integrity;
|
|
25
|
-
if (
|
|
25
|
+
if (config.features.integrityHashes && !integrity) {
|
|
26
26
|
integrity = computeIntegrityForFiles(cacheMetadata.files, fedOptions.federationCache.cachePath);
|
|
27
27
|
}
|
|
28
28
|
return {
|
|
@@ -122,7 +122,7 @@ export async function bundleShared(sharedBundles, config, fedOptions, externals,
|
|
|
122
122
|
}
|
|
123
123
|
const persistedFiles = bundleResult.map(r => r.fileName.split(path.sep).pop() ?? r.fileName);
|
|
124
124
|
// Must run after rewriteImports so SRI matches the bytes copied to dist.
|
|
125
|
-
const integrity =
|
|
125
|
+
const integrity = config.features.integrityHashes
|
|
126
126
|
? computeIntegrityForFiles(persistedFiles, fedOptions.federationCache.cachePath)
|
|
127
127
|
: undefined;
|
|
128
128
|
bundleCache.persist({
|
|
@@ -31,7 +31,7 @@ export async function rebuildForFederation(config, fedOptions, externals, modifi
|
|
|
31
31
|
if (artifactInfo?.chunks) {
|
|
32
32
|
federationInfo.chunks = { ...(federationInfo.chunks ?? {}), ...artifactInfo?.chunks };
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if (config.features.integrityHashes) {
|
|
35
35
|
federationInfo.integrity = {
|
|
36
36
|
...(federationCache.integrity ?? {}),
|
|
37
37
|
...(artifactInfo?.integrity ?? {}),
|
|
@@ -15,6 +15,7 @@ export interface FederationConfig {
|
|
|
15
15
|
mappingVersion?: boolean;
|
|
16
16
|
ignoreUnusedDeps?: boolean;
|
|
17
17
|
denseChunking?: boolean;
|
|
18
|
+
integrityHashes?: boolean;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
export interface NormalizedFederationConfig {
|
|
@@ -31,5 +32,6 @@ export interface NormalizedFederationConfig {
|
|
|
31
32
|
mappingVersion: boolean;
|
|
32
33
|
ignoreUnusedDeps: boolean;
|
|
33
34
|
denseChunking: boolean;
|
|
35
|
+
integrityHashes: boolean;
|
|
34
36
|
};
|
|
35
37
|
}
|
|
@@ -13,7 +13,6 @@ export interface FederationOptions {
|
|
|
13
13
|
packageJson?: string;
|
|
14
14
|
entryPoints?: string[];
|
|
15
15
|
buildNotifications?: BuildNotificationOptions;
|
|
16
|
-
integrity?: boolean;
|
|
17
16
|
}
|
|
18
17
|
export interface NormalizedFederationOptions<TBundlerCache = unknown> extends FederationOptions {
|
|
19
18
|
federationCache: FederationCache<TBundlerCache>;
|