@softarc/native-federation 4.3.0 → 4.3.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/README.md CHANGED
@@ -614,7 +614,7 @@ For a zero-build integration, declare your remotes in a manifest and include the
614
614
  <script>
615
615
  window.addEventListener(
616
616
  'mfe-loader-available',
617
- (e) => {
617
+ e => {
618
618
  e.detail.loadRemoteModule('team/mfe1', './Button');
619
619
  e.detail.loadRemoteModule('team/mfe2', './Header');
620
620
  },
@@ -623,7 +623,7 @@ For a zero-build integration, declare your remotes in a manifest and include the
623
623
  </script>
624
624
 
625
625
  <!-- Include the orchestrator -->
626
- <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.3.0/quickstart.mjs"></script>
626
+ <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.5.1/quickstart.mjs"></script>
627
627
  ```
628
628
 
629
629
  The `mfe-loader-available` event signals that the orchestrator has fetched the
@@ -0,0 +1,6 @@
1
+ export * from '../lib/utils/errors.js';
2
+ export { densifyExternals, toDenseSharedInfoFormat } from '../lib/core/output/densify-externals.js';
3
+ export { isInSkipList, prepareSkipList } from '../lib/config/default-skip-list.js';
4
+ export type { PathToImport } from '../lib/domain/utils/mapped-path.contract.js';
5
+ export type { NormalizedExternalConfig, NormalizedSharedExternalsConfig, } from '../lib/domain/config/external-config.contract.js';
6
+ export type { NormalizedFederationConfig } from '../lib/domain/config/federation-config.contract.js';
@@ -0,0 +1,9 @@
1
+ export * from "../lib/utils/errors.js";
2
+ import { densifyExternals, toDenseSharedInfoFormat } from "../lib/core/output/densify-externals.js";
3
+ import { isInSkipList, prepareSkipList } from "../lib/config/default-skip-list.js";
4
+ export {
5
+ densifyExternals,
6
+ isInSkipList,
7
+ prepareSkipList,
8
+ toDenseSharedInfoFormat
9
+ };
@@ -1,15 +1,15 @@
1
+ /**
2
+ * Internal API's of the native-federation builder.
3
+ *
4
+ * Might change between minors.
5
+ */
6
+ export * from './internal/browser.js';
1
7
  export * from './lib/core/build/build-result-map.js';
2
8
  export { hashFile } from './lib/utils/hash-file.js';
3
- export * from './lib/utils/errors.js';
4
9
  export { logger, setLogLevel } from './lib/utils/logger.js';
5
- export type { PathToImport } from './lib/domain/utils/mapped-path.contract.js';
6
10
  export { RebuildQueue, type TrackResult } from './lib/core/rebuild-queue.js';
7
11
  export { writeImportMap } from './lib/core/output/write-import-map.js';
8
- export type { NormalizedExternalConfig, NormalizedSharedExternalsConfig, } from './lib/domain/config/external-config.contract.js';
9
- export type { NormalizedFederationConfig } from './lib/domain/config/federation-config.contract.js';
10
12
  export { getDefaultCachePath, getChecksum } from './lib/core/cache/cache-persistence.js';
11
13
  export { isESMExport, type ExportCondition, type ExportEntry, } from './lib/utils/package/package-info.js';
12
- export { isInSkipList, prepareSkipList } from './lib/config/default-skip-list.js';
13
- export { densifyExternals } from './lib/core/output/densify-externals.js';
14
14
  export type { NfFileWatcher, NfFileWatcherOptions, } from './lib/domain/utils/file-watcher.contract.js';
15
15
  export { syncNfFileWatcher, createNfWatcher } from './lib/utils/file-watcher.js';
package/dist/internal.js CHANGED
@@ -1,6 +1,6 @@
1
+ export * from "./internal/browser.js";
1
2
  export * from "./lib/core/build/build-result-map.js";
2
3
  import { hashFile } from "./lib/utils/hash-file.js";
3
- export * from "./lib/utils/errors.js";
4
4
  import { logger, setLogLevel } from "./lib/utils/logger.js";
5
5
  import { RebuildQueue } from "./lib/core/rebuild-queue.js";
6
6
  import { writeImportMap } from "./lib/core/output/write-import-map.js";
@@ -8,20 +8,15 @@ import { getDefaultCachePath, getChecksum } from "./lib/core/cache/cache-persist
8
8
  import {
9
9
  isESMExport
10
10
  } from "./lib/utils/package/package-info.js";
11
- import { isInSkipList, prepareSkipList } from "./lib/config/default-skip-list.js";
12
- import { densifyExternals } from "./lib/core/output/densify-externals.js";
13
11
  import { syncNfFileWatcher, createNfWatcher } from "./lib/utils/file-watcher.js";
14
12
  export {
15
13
  RebuildQueue,
16
14
  createNfWatcher,
17
- densifyExternals,
18
15
  getChecksum,
19
16
  getDefaultCachePath,
20
17
  hashFile,
21
18
  isESMExport,
22
- isInSkipList,
23
19
  logger,
24
- prepareSkipList,
25
20
  setLogLevel,
26
21
  syncNfFileWatcher,
27
22
  writeImportMap
@@ -6,3 +6,4 @@ import type { SharedInfo, DenseSharedInfo } from '../../domain/core/federation-i
6
6
  * already-dense entries pass through unchanged.
7
7
  */
8
8
  export declare function densifyExternals(shared: Array<SharedInfo | DenseSharedInfo>): Array<SharedInfo | DenseSharedInfo>;
9
+ export declare function toDenseSharedInfoFormat(shared: Array<SharedInfo | DenseSharedInfo>): DenseSharedInfo[];
@@ -3,17 +3,22 @@ import { inferPackageFromSecondary } from "../../utils/normalize.js";
3
3
  function isDense(entry) {
4
4
  return "entries" in entry;
5
5
  }
6
- function isChunk(entry) {
7
- return entry.packageName.startsWith(CHUNK_PREFIX + "/");
6
+ function isFlatChunk(entry) {
7
+ return entry.packageName.startsWith(CHUNK_PREFIX);
8
8
  }
9
9
  function densifyExternals(shared) {
10
10
  const result = [];
11
11
  const groupIndex = /* @__PURE__ */ new Map();
12
12
  for (const entry of shared) {
13
- if (isDense(entry) || isChunk(entry)) {
13
+ if (isDense(entry)) {
14
14
  result.push(entry);
15
15
  continue;
16
16
  }
17
+ if (isFlatChunk(entry)) {
18
+ const { outFileName, ...rest } = entry;
19
+ result.push({ ...rest, entries: { [entry.packageName]: outFileName } });
20
+ continue;
21
+ }
17
22
  const parent = inferPackageFromSecondary(entry.packageName);
18
23
  const sig = JSON.stringify({
19
24
  singleton: entry.singleton,
@@ -44,6 +49,17 @@ function densifyExternals(shared) {
44
49
  }
45
50
  return result;
46
51
  }
52
+ function toDenseSharedInfoFormat(shared) {
53
+ return shared.map((external) => {
54
+ if ("entries" in external) return external;
55
+ const { outFileName, ...baseSharedInfoProps } = external;
56
+ return {
57
+ ...baseSharedInfoProps,
58
+ entries: { [external.packageName]: outFileName }
59
+ };
60
+ });
61
+ }
47
62
  export {
48
- densifyExternals
63
+ densifyExternals,
64
+ toDenseSharedInfoFormat
49
65
  };
@@ -6,7 +6,7 @@ function writeFederationInfoCore(io, federationInfo, fedOptions) {
6
6
  fedOptions.outputPath,
7
7
  "remoteEntry.json"
8
8
  );
9
- io.writeText(metaDataPath, JSON.stringify(federationInfo, null, 2));
9
+ io.writeText(metaDataPath, JSON.stringify({ $version: "v4", ...federationInfo }, null, 2));
10
10
  }
11
11
  function writeFederationInfo(federationInfo, fedOptions) {
12
12
  writeFederationInfoCore(nodeIo, federationInfo, fedOptions);
@@ -1,4 +1,5 @@
1
1
  export interface FederationInfo {
2
+ $version?: string;
2
3
  name: string;
3
4
  exposes: ExposesInfo[];
4
5
  shared: Array<SharedInfo | DenseSharedInfo>;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@softarc/native-federation",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
+ "packageManager": "pnpm@11.11.0",
6
7
  "scripts": {
7
8
  "build": "node esbuild.config.mjs && tsc -p tsconfig.build.json",
8
9
  "lint": "eslint src",
@@ -55,6 +56,11 @@
55
56
  "types": "./dist/internal.d.ts",
56
57
  "import": "./dist/internal.js",
57
58
  "default": "./dist/internal.js"
59
+ },
60
+ "./internal/browser": {
61
+ "types": "./dist/internal/browser.d.ts",
62
+ "import": "./dist/internal/browser.js",
63
+ "default": "./dist/internal/browser.js"
58
64
  }
59
65
  },
60
66
  "main": "./dist/index.js",