@softarc/native-federation-orchestrator 4.6.1 → 4.8.0
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 +2 -2
- package/fesm2022/@softarc/native-federation-orchestrator.mjs +1880 -1281
- package/fesm2022/@softarc/native-federation-orchestrator.mjs.map +4 -4
- package/fesm2022/audit.mjs +1 -1
- package/fesm2022/audit.mjs.map +2 -2
- package/fesm2022/module-federation.mjs +199 -32
- package/fesm2022/module-federation.mjs.map +3 -3
- package/fesm2022/node.mjs +1867 -1257
- package/fesm2022/node.mjs.map +4 -4
- package/fesm2022/options.mjs +7 -3
- package/fesm2022/options.mjs.map +2 -2
- package/fesm2022/registry.mjs +1 -1
- package/fesm2022/registry.mjs.map +2 -2
- package/fesm2022/sdk.mjs +1 -1
- package/fesm2022/sdk.mjs.map +2 -2
- package/init-registry.mjs +1 -1
- package/node-loader/loader.mjs +7 -4
- package/node-loader/loader.mjs.map +2 -2
- package/package.json +9 -1
- package/quickstart.mjs +14 -15
- package/types/lib/core/1.domain/externals/basis.d.ts +2 -15
- package/types/lib/core/1.domain/externals/claims.d.ts +22 -0
- package/types/lib/core/1.domain/externals/compatibility.d.ts +9 -0
- package/types/lib/core/1.domain/externals/external.contract.d.ts +4 -0
- package/types/lib/core/1.domain/externals/rows.d.ts +9 -0
- package/types/lib/core/1.domain/externals/serving.d.ts +52 -0
- package/types/lib/core/1.domain/externals/specifier.d.ts +13 -0
- package/types/lib/core/1.domain/externals/version.contract.d.ts +2 -0
- package/types/lib/core/1.domain/pooling/builds.d.ts +20 -0
- package/types/lib/core/1.domain/pooling/election.d.ts +40 -0
- package/types/lib/core/1.domain/pooling/gate.d.ts +62 -0
- package/types/lib/core/1.domain/pooling/membership.d.ts +17 -0
- package/types/lib/core/1.domain/pooling/plan.d.ts +9 -0
- package/types/lib/core/1.domain/pooling/pool-state.d.ts +4 -0
- package/types/lib/core/1.domain/pooling/records.d.ts +16 -0
- package/types/lib/core/1.domain/pooling/rules.d.ts +6 -0
- package/types/lib/core/1.domain/remote-entry/load-actions.contract.d.ts +4 -0
- package/types/lib/core/1.domain/remote-entry/remote-entry.contract.d.ts +0 -2
- package/types/lib/core/2.app/config/index.d.ts +2 -1
- package/types/lib/core/2.app/config/mode.contract.d.ts +8 -5
- package/types/lib/core/2.app/config/orchestrator-global.contract.d.ts +15 -0
- package/types/lib/core/2.app/config/storage.contract.d.ts +19 -2
- package/types/lib/core/2.app/driver-ports/init/drivers.contract.d.ts +4 -2
- package/types/lib/core/2.app/driver-ports/init/for-committing-changes.port.d.ts +1 -0
- package/types/lib/core/2.app/driver-ports/init/for-deciding-serving-builds.port.d.ts +1 -0
- package/types/lib/core/2.app/driver-ports/init/for-determining-shared-externals.port.d.ts +1 -8
- package/types/lib/core/2.app/driver-ports/init/for-pooling-dynamic-externals.port.d.ts +2 -1
- package/types/lib/core/2.app/driver-ports/init/for-pooling-shared-externals.port.d.ts +1 -3
- package/types/lib/core/2.app/driver-ports/init/for-rolling-back-changes.port.d.ts +1 -0
- package/types/lib/core/2.app/driver-ports/init/for-updating-cache.d.ts +3 -2
- package/types/lib/core/2.app/driver-ports/init/index.d.ts +2 -0
- package/types/lib/core/2.app/driving-ports/for-remote-info-storage.port.d.ts +1 -0
- package/types/lib/core/2.app/driving-ports/for-scoped-externals-storage.port.d.ts +1 -0
- package/types/lib/core/2.app/driving-ports/for-shared-chunks-storage.port.d.ts +1 -0
- package/types/lib/core/2.app/driving-ports/for-shared-externals-storage.port.d.ts +5 -1
- package/types/lib/core/2.app/steps/apply-winner.d.ts +6 -13
- package/types/lib/core/2.app/steps/decide-serving-builds.d.ts +5 -0
- package/types/lib/core/2.app/steps/pooling/pool-shared-externals.d.ts +0 -29
- package/types/lib/core/2.app/steps/rollback-changes.d.ts +5 -0
- package/types/lib/core/2.app/steps/store-remote-entry.d.ts +2 -2
- package/types/lib/core/3.adapters/storage/cache-state.d.ts +5 -0
- package/types/lib/core/3.adapters/storage/chunk.repository.d.ts +1 -1
- package/types/lib/core/3.adapters/storage/remote-info.repository.d.ts +1 -1
- package/types/lib/core/3.adapters/storage/scoped-externals.repository.d.ts +1 -1
- package/types/lib/core/3.adapters/storage/shared-externals.repository.d.ts +1 -1
- package/types/lib/core/4.config/orchestrator-version.d.ts +1 -0
- package/types/lib/core/4.config/storage/publish-storage-info.d.ts +9 -0
- package/types/lib/core/4.config/storage/storage.config.d.ts +1 -1
- package/types/lib/core/5.di/federation-result.factory.d.ts +1 -1
- package/types/lib/sdk.index.d.ts +4 -0
- package/types/lib/utils/compare-strings.d.ts +2 -0
- package/types/lib/utils/deep-readonly.d.ts +3 -0
- package/types/lib/core/2.app/driver-ports/init/for-marking-pools-for-reelection.port.d.ts +0 -6
- package/types/lib/core/2.app/steps/pooling/anchoring.d.ts +0 -69
- package/types/lib/core/2.app/steps/pooling/mark-pools-for-reelection.d.ts +0 -5
- package/types/lib/core/2.app/steps/pooling/pool-graph.d.ts +0 -30
- package/types/lib/core/2.app/steps/pooling/pool-views.d.ts +0 -63
- package/types/lib/core/2.app/steps/pooling/pool.types.d.ts +0 -35
- package/types/lib/core/2.app/steps/pooling/pool.util.d.ts +0 -18
- package/types/lib/testing/handlers/log.handler.d.ts +0 -3
- package/types/lib/testing/pooling/no-tear.d.ts +0 -37
|
@@ -1,22 +1,9 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
1
2
|
import type { SharedVersion, SharedVersionMeta } from './version.contract';
|
|
2
3
|
export declare function isBetterBasis(candidate: SharedVersionMeta, basis: SharedVersionMeta): boolean;
|
|
3
4
|
export declare function addRemoteToVersion(version: SharedVersion, remote: SharedVersionMeta, isHost?: boolean): void;
|
|
4
5
|
export declare function versionDemands(version: SharedVersion): SharedVersionMeta[];
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function versionEntries(version: SharedVersion): Map<string, SharedVersionMeta>;
|
|
7
|
-
export declare function committedEntries(version: SharedVersion): Map<string, SharedVersionMeta>;
|
|
8
|
-
/**
|
|
9
|
-
* The walk both of those keep the first claim of: which copies of a version may publish a specifier, in basis
|
|
10
|
-
* precedence. Exposed so a caller that models the same fill order without needing the map — the pooling gates
|
|
11
|
-
* ask which build a consumer lands on, per specifier — reads the `servedBy` rule from here instead of
|
|
12
|
-
* restating it. It deliberately does not dedup: the callers do, and this way the walk allocates nothing.
|
|
13
|
-
*
|
|
14
|
-
* `accepts` is for a caller with a further reason to discount a copy (pooling islands one, so it self-serves).
|
|
15
|
-
* Filtering the *result* is not the same thing — that drops the specifier instead of letting the next copy
|
|
16
|
-
* claim it.
|
|
17
|
-
*/
|
|
18
|
-
export declare function forEachVersionEntry(version: SharedVersion, accepts: ((remote: SharedVersionMeta) => boolean) | undefined, visit: (entrypoint: string, remote: SharedVersionMeta) => void): void;
|
|
6
|
+
export declare function forEachVersionEntry(version: DeepReadonly<SharedVersion>, accepts: ((remote: SharedVersionMeta) => boolean) | undefined, visit: (entrypoint: string, remote: SharedVersionMeta) => void): void;
|
|
19
7
|
type Covered = Pick<ReadonlySet<string>, 'has'>;
|
|
20
|
-
export declare function uncoveredEntrypoints(remote: SharedVersionMeta, covered: Covered): string[];
|
|
21
8
|
export declare function countUncoveredEntrypoints(remote: SharedVersionMeta, covered: Covered): number;
|
|
22
9
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
2
|
+
import type { RemoteName } from '../remote/remote-info.contract';
|
|
3
|
+
import { type ExternalName, type SharedExternal } from './external.contract';
|
|
4
|
+
import type { SharedVersion, SharedVersionMeta, VersionName } from './version.contract';
|
|
5
|
+
import { type Specifier } from './specifier';
|
|
6
|
+
export type Claim = {
|
|
7
|
+
external: ExternalName;
|
|
8
|
+
tag: VersionName;
|
|
9
|
+
copy: SharedVersionMeta;
|
|
10
|
+
};
|
|
11
|
+
export type ClaimTable = {
|
|
12
|
+
claims: Map<Specifier, Claim>;
|
|
13
|
+
duplicates: Set<DeepReadonly<SharedVersion>>;
|
|
14
|
+
shareClaims: Map<Specifier, Claim>;
|
|
15
|
+
};
|
|
16
|
+
export declare function claimTable(externals: Iterable<readonly [ExternalName, DeepReadonly<SharedExternal>]>, publishes?: (copy: SharedVersionMeta) => boolean): ClaimTable;
|
|
17
|
+
export declare function committedClaims(externals: Iterable<readonly [ExternalName, DeepReadonly<SharedExternal>]>, { shareScope, without }: {
|
|
18
|
+
shareScope: string;
|
|
19
|
+
without?: RemoteName;
|
|
20
|
+
}): Map<Specifier, Claim>;
|
|
21
|
+
export declare const claimsByPackage: (claims: ReadonlyMap<Specifier, Claim>) => Map<ExternalName, [Specifier, Claim][]>;
|
|
22
|
+
export declare function versionClaims(version: DeepReadonly<SharedVersion>, servingBuild: RemoteName | undefined): Map<Specifier, SharedVersionMeta>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SharedExternal } from './external.contract';
|
|
2
|
+
import type { SharedVersion, SharedVersionMeta } from './version.contract';
|
|
3
|
+
export type AcceptsTag = (offered: string, ownTag: string, requiredVersion: string) => boolean;
|
|
4
|
+
export declare function createAcceptsTag(isCompatible: (tag: string, requiredVersion: string) => boolean, compare: (a: string, b: string) => number): AcceptsTag;
|
|
5
|
+
export type VersionAcceptance = {
|
|
6
|
+
accepts: (version: SharedVersion, tag: string) => boolean;
|
|
7
|
+
objector: (version: SharedVersion, tag: string) => SharedVersionMeta | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare function versionAcceptance(external: SharedExternal, acceptsTag: AcceptsTag): VersionAcceptance;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RemoteName } from '../remote/remote-info.contract';
|
|
1
2
|
import type { SharedVersion, ScopedVersion } from './version.contract';
|
|
2
3
|
export type ExternalName = string;
|
|
3
4
|
export type ScopedExternals = Record<string, ScopedExternal>;
|
|
@@ -5,6 +6,9 @@ export declare const GLOBAL_SCOPE = "__GLOBAL__";
|
|
|
5
6
|
export declare const STRICT_SCOPE = "strict";
|
|
6
7
|
export type SharedExternal = {
|
|
7
8
|
dirty: boolean;
|
|
9
|
+
poolName?: string;
|
|
10
|
+
poolWinner?: RemoteName;
|
|
11
|
+
servingBuild?: RemoteName;
|
|
8
12
|
versions: SharedVersion[];
|
|
9
13
|
};
|
|
10
14
|
export type shareScope = Record<string, SharedExternal>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RemoteName } from '../remote/remote-info.contract';
|
|
2
|
+
import type { AcceptsTag } from './compatibility';
|
|
3
|
+
import type { SharedVersion, SharedVersionAction, VersionName } from './version.contract';
|
|
4
|
+
export declare const byTag: (compare: (a: VersionName, b: VersionName) => number) => (a: SharedVersion, b: SharedVersion) => number;
|
|
5
|
+
export declare const rowAt: (versions: readonly SharedVersion[], tag: VersionName, action: SharedVersionAction) => SharedVersion | undefined;
|
|
6
|
+
export declare function mergeRows(versions: SharedVersion[], lead?: SharedVersion): SharedVersion[];
|
|
7
|
+
export declare function findVersionForTag(versions: SharedVersion[], tag: string): SharedVersion | undefined;
|
|
8
|
+
export declare function redirectRow(version: SharedVersion, tag: VersionName, acceptsTag: AcceptsTag): SharedVersion[];
|
|
9
|
+
export declare function scopeRemotes(versions: SharedVersion[], remotes: readonly RemoteName[]): SharedVersion[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
2
|
+
import type { RemoteName } from '../remote/remote-info.contract';
|
|
3
|
+
import type { AcceptsTag } from './compatibility';
|
|
4
|
+
import type { ExternalName, SharedExternal, shareScope } from './external.contract';
|
|
5
|
+
import { type Specifier } from './specifier';
|
|
6
|
+
import type { SharedVersion, SharedVersionMeta, VersionName } from './version.contract';
|
|
7
|
+
export type ServingBuild = {
|
|
8
|
+
remote: RemoteName;
|
|
9
|
+
tag: VersionName;
|
|
10
|
+
};
|
|
11
|
+
export type ServingCandidate = ServingBuild & {
|
|
12
|
+
host: boolean;
|
|
13
|
+
downloads: number;
|
|
14
|
+
fallbacks: number;
|
|
15
|
+
rootBasis: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type PackageExternals = readonly (readonly [ExternalName, DeepReadonly<SharedExternal>])[];
|
|
18
|
+
type Row = DeepReadonly<SharedVersion>;
|
|
19
|
+
type Placed = {
|
|
20
|
+
row: Row;
|
|
21
|
+
copy: DeepReadonly<SharedVersionMeta>;
|
|
22
|
+
};
|
|
23
|
+
export declare const byServingRank: (a: ServingCandidate, b: ServingCandidate) => number;
|
|
24
|
+
export declare const packagesOf: (scope: DeepReadonly<shareScope>) => Map<ExternalName, ExternalName[]>;
|
|
25
|
+
export declare const isPooled: (externals: PackageExternals) => boolean;
|
|
26
|
+
export declare function servingBuildOf(externals: PackageExternals, accepts: AcceptsTag): ServingBuild | undefined;
|
|
27
|
+
export declare function shareServingCopies(external: SharedExternal, serving: ServingBuild): void;
|
|
28
|
+
export type ServingObjector = {
|
|
29
|
+
copy: SharedVersionMeta;
|
|
30
|
+
tag: VersionName;
|
|
31
|
+
};
|
|
32
|
+
export declare function followServingBuild(external: SharedExternal, serving: ServingBuild, accepts: AcceptsTag): {
|
|
33
|
+
external: SharedExternal;
|
|
34
|
+
objector?: ServingObjector;
|
|
35
|
+
};
|
|
36
|
+
export declare const servedScopes: (scope: shareScope, strict: boolean) => shareScope[];
|
|
37
|
+
export declare function consumersOf(externals: PackageExternals): Map<RemoteName, Placed[]>;
|
|
38
|
+
type Cost = Pick<ServingCandidate, 'downloads' | 'fallbacks'>;
|
|
39
|
+
export declare function costTable(consumers: Map<RemoteName, Placed[]>, accepts: AcceptsTag): (build: ServingBuild) => Cost;
|
|
40
|
+
export declare function fallbacksOf(externals: PackageExternals, serving: ServingBuild | undefined, accepts: AcceptsTag): RemoteName[];
|
|
41
|
+
export declare function scopeFallbacks(externals: readonly (readonly [ExternalName, SharedExternal])[], serving: ServingBuild | undefined, accepts: AcceptsTag): void;
|
|
42
|
+
export declare function strictObjectorOf(externals: PackageExternals, serving: ServingBuild, accepts: AcceptsTag): (ServingObjector & {
|
|
43
|
+
external: ExternalName;
|
|
44
|
+
}) | undefined;
|
|
45
|
+
export declare const SCANNED_SURFACES_PER_TAG = 8;
|
|
46
|
+
export declare function loadSplitsPackage(copies: readonly {
|
|
47
|
+
tag: VersionName;
|
|
48
|
+
copy: SharedVersionMeta;
|
|
49
|
+
}[], claims: readonly (readonly [Specifier, {
|
|
50
|
+
tag: VersionName;
|
|
51
|
+
}])[], accepts: AcceptsTag): boolean;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExternalName } from './external.contract';
|
|
2
|
+
import type { VersionName } from './version.contract';
|
|
3
|
+
export type Specifier = string;
|
|
4
|
+
export declare function owningPackage(name: ExternalName): ExternalName | undefined;
|
|
5
|
+
export declare const packageOf: (name: ExternalName) => ExternalName;
|
|
6
|
+
export declare class SpecifierTags extends Map<Specifier, VersionName> {
|
|
7
|
+
private readonly packages;
|
|
8
|
+
constructor(entries?: Iterable<readonly [Specifier, VersionName]>);
|
|
9
|
+
set(specifier: Specifier, tag: VersionName): this;
|
|
10
|
+
clear(): void;
|
|
11
|
+
pinnedTag(specifier: Specifier): VersionName | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function groupByPackage<T>(items: Iterable<T>, nameOf: (item: T) => ExternalName): Map<ExternalName, T[]>;
|
|
@@ -13,6 +13,7 @@ export type SharedVersion = Version & {
|
|
|
13
13
|
remotes: SharedVersionMeta[];
|
|
14
14
|
};
|
|
15
15
|
export type SharedVersionAction = 'skip' | 'scope' | 'share';
|
|
16
|
+
export type PoolCause = 'incompatible' | 'uncovered';
|
|
16
17
|
export type SharedVersionMeta = {
|
|
17
18
|
requiredVersion: string;
|
|
18
19
|
strictVersion: boolean;
|
|
@@ -22,4 +23,5 @@ export type SharedVersionMeta = {
|
|
|
22
23
|
pool?: string;
|
|
23
24
|
entries: Record<string, string>;
|
|
24
25
|
servedBy?: RemoteName;
|
|
26
|
+
poolCause?: PoolCause;
|
|
25
27
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ExternalName, RemoteName, VersionName } from '..';
|
|
2
|
+
import { type Specifier, SpecifierTags } from '../externals/specifier';
|
|
3
|
+
import type { PoolMember } from './membership';
|
|
4
|
+
export type Copy = {
|
|
5
|
+
member: ExternalName;
|
|
6
|
+
tag: VersionName;
|
|
7
|
+
requiredVersion: string;
|
|
8
|
+
strict: boolean;
|
|
9
|
+
host: boolean;
|
|
10
|
+
specifiers: Specifier[];
|
|
11
|
+
};
|
|
12
|
+
export type Build = {
|
|
13
|
+
owner: RemoteName;
|
|
14
|
+
tags: SpecifierTags;
|
|
15
|
+
tagByMember: Map<ExternalName, VersionName>;
|
|
16
|
+
host: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function copiesByRemote(members: readonly PoolMember[]): Map<RemoteName, Copy[]>;
|
|
19
|
+
export declare const specifierCount: (copies: readonly Copy[]) => number;
|
|
20
|
+
export declare function buildOf(owner: RemoteName, copies: readonly Copy[]): Build;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ExternalName, PoolCause, RemoteName, VersionName } from '..';
|
|
2
|
+
import type { AcceptsTag } from '../externals/compatibility';
|
|
3
|
+
import { type Specifier, SpecifierTags } from '../externals/specifier';
|
|
4
|
+
import type { PoolMember } from './membership';
|
|
5
|
+
type ElectionInput = {
|
|
6
|
+
members: readonly PoolMember[];
|
|
7
|
+
acceptsTag: AcceptsTag;
|
|
8
|
+
compare: (a: VersionName, b: VersionName) => number;
|
|
9
|
+
previousWinner?: RemoteName;
|
|
10
|
+
latestFirst: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type PoolMiss = {
|
|
13
|
+
cause: 'incompatible';
|
|
14
|
+
member: ExternalName;
|
|
15
|
+
tag: VersionName;
|
|
16
|
+
strict: boolean;
|
|
17
|
+
} | {
|
|
18
|
+
cause: 'uncovered';
|
|
19
|
+
gap: Specifier;
|
|
20
|
+
unshipped?: true;
|
|
21
|
+
};
|
|
22
|
+
export type Placement = {
|
|
23
|
+
kind: 'global';
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'subpool';
|
|
26
|
+
owner: RemoteName;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'self';
|
|
29
|
+
cause: PoolCause;
|
|
30
|
+
};
|
|
31
|
+
export type Election = {
|
|
32
|
+
winner: RemoteName;
|
|
33
|
+
winnerIsHost: boolean;
|
|
34
|
+
globalTags: SpecifierTags;
|
|
35
|
+
placements: ReadonlyMap<RemoteName, Placement>;
|
|
36
|
+
misses: ReadonlyMap<RemoteName, PoolMiss | undefined>;
|
|
37
|
+
};
|
|
38
|
+
export declare function elect(input: ElectionInput): Election;
|
|
39
|
+
export declare function previousWinner(members: PoolMember[]): RemoteName | undefined;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ExternalName, type RemoteName, type VersionName } from '..';
|
|
2
|
+
import type { LoadActions } from '../remote-entry/load-actions.contract';
|
|
3
|
+
import type { AcceptsTag } from '../externals/compatibility';
|
|
4
|
+
import { type Specifier } from '../externals/specifier';
|
|
5
|
+
import { type Build, type Copy } from './builds';
|
|
6
|
+
import type { PoolMember } from './membership';
|
|
7
|
+
type Served = {
|
|
8
|
+
tag: VersionName;
|
|
9
|
+
remote: RemoteName;
|
|
10
|
+
file: string;
|
|
11
|
+
};
|
|
12
|
+
type CommittedView = {
|
|
13
|
+
builds: Map<RemoteName, Build>;
|
|
14
|
+
global: Map<Specifier, Served>;
|
|
15
|
+
runsOffMap: Map<RemoteName, Map<Specifier, Served>>;
|
|
16
|
+
};
|
|
17
|
+
export type GateMiss = {
|
|
18
|
+
cause: 'incompatible';
|
|
19
|
+
specifier: Specifier;
|
|
20
|
+
tag: VersionName;
|
|
21
|
+
} | {
|
|
22
|
+
cause: 'uncovered';
|
|
23
|
+
specifier: Specifier;
|
|
24
|
+
} | {
|
|
25
|
+
cause: 'uncovered';
|
|
26
|
+
unshipped: true;
|
|
27
|
+
} | {
|
|
28
|
+
cause: 'uncovered';
|
|
29
|
+
owner: RemoteName;
|
|
30
|
+
specifier: Specifier;
|
|
31
|
+
tag: VersionName;
|
|
32
|
+
};
|
|
33
|
+
type MapCover = {
|
|
34
|
+
name: ExternalName;
|
|
35
|
+
toSkip: boolean;
|
|
36
|
+
override: Record<Specifier, string>;
|
|
37
|
+
};
|
|
38
|
+
type MapPolicy = {
|
|
39
|
+
shareScope: string;
|
|
40
|
+
scopeUrlOf: (remote: RemoteName) => string | undefined;
|
|
41
|
+
};
|
|
42
|
+
export declare function committedView(members: PoolMember[], shipped: ReadonlyMap<RemoteName, readonly Copy[]>, recordOrder: ExternalName[], { shareScope, without }: {
|
|
43
|
+
shareScope: string;
|
|
44
|
+
without?: RemoteName;
|
|
45
|
+
}): CommittedView;
|
|
46
|
+
export declare function judgeRemote(copies: readonly Copy[], view: CommittedView, accepts: AcceptsTag): 'global' | GateMiss;
|
|
47
|
+
type Binding = {
|
|
48
|
+
owner: RemoteName;
|
|
49
|
+
specifier: Specifier;
|
|
50
|
+
tag: VersionName;
|
|
51
|
+
};
|
|
52
|
+
export type CoverResult = {
|
|
53
|
+
covers: MapCover[];
|
|
54
|
+
} | {
|
|
55
|
+
unmapped: RemoteName;
|
|
56
|
+
} | {
|
|
57
|
+
gap: Specifier;
|
|
58
|
+
} | {
|
|
59
|
+
bound: Binding;
|
|
60
|
+
};
|
|
61
|
+
export declare function coverFromMap(remote: RemoteName, mine: readonly PoolMember[], view: CommittedView, actions: Readonly<LoadActions>, policy: MapPolicy): CoverResult;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExternalName, SharedExternal, shareScope } from '..';
|
|
2
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
3
|
+
export type PoolName = string;
|
|
4
|
+
export type PoolMember = {
|
|
5
|
+
name: ExternalName;
|
|
6
|
+
external: DeepReadonly<SharedExternal>;
|
|
7
|
+
};
|
|
8
|
+
export type Membership = {
|
|
9
|
+
pools: Map<PoolName, PoolMember[]>;
|
|
10
|
+
labelledAlone: ExternalName[];
|
|
11
|
+
};
|
|
12
|
+
export type LabelledCopy = {
|
|
13
|
+
name: ExternalName;
|
|
14
|
+
pool?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function buildPools(sharedExternals: DeepReadonly<shareScope>): Membership;
|
|
17
|
+
export declare function pooledPackagesWith(sharedExternals: DeepReadonly<shareScope>, copies: readonly LabelledCopy[]): Set<ExternalName>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExternalName, SharedExternal, shareScope } from '../externals/external.contract';
|
|
2
|
+
import { type PoolMember, type PoolName } from './membership';
|
|
3
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
4
|
+
export type ElectionPlan = {
|
|
5
|
+
pools: Map<PoolName, PoolMember[]>;
|
|
6
|
+
stripped: Map<ExternalName, SharedExternal>;
|
|
7
|
+
labelledAlone: ExternalName[];
|
|
8
|
+
};
|
|
9
|
+
export declare function planElection(scope: DeepReadonly<shareScope>, poolable: boolean): ElectionPlan;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
2
|
+
import type { SharedExternal, shareScope } from '../externals/external.contract';
|
|
3
|
+
export declare function hasPoolResults(external: DeepReadonly<SharedExternal>): boolean;
|
|
4
|
+
export declare function scopeHasPoolState(scope: DeepReadonly<shareScope>): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../../../utils/deep-readonly';
|
|
2
|
+
import type { ExternalName, PoolCause, RemoteName, SharedExternal, shareScope, VersionName } from '..';
|
|
3
|
+
import type { Election } from './election';
|
|
4
|
+
import type { PoolMember, PoolName } from './membership';
|
|
5
|
+
export type PlacedPool = Election & {
|
|
6
|
+
poolName: PoolName;
|
|
7
|
+
};
|
|
8
|
+
export declare function memberRecord(member: PoolMember, pool: PlacedPool, compare: (a: VersionName, b: VersionName) => number): SharedExternal;
|
|
9
|
+
export type CopyMove = {
|
|
10
|
+
cause: PoolCause;
|
|
11
|
+
} | {
|
|
12
|
+
fromMap: true;
|
|
13
|
+
};
|
|
14
|
+
export declare function movedRecord(external: SharedExternal, remote: RemoteName, move: CopyMove, compare: (a: VersionName, b: VersionName) => number): SharedExternal;
|
|
15
|
+
export declare function withoutPoolResults(external: DeepReadonly<SharedExternal>): SharedExternal;
|
|
16
|
+
export declare function renamedRecords(scope: shareScope, pools: ReadonlyMap<PoolName, readonly PoolMember[]>): [ExternalName, SharedExternal][];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AcceptsTag } from '../externals/compatibility';
|
|
2
|
+
import type { Specifier, SpecifierTags } from '../externals/specifier';
|
|
3
|
+
import type { Build, Copy } from './builds';
|
|
4
|
+
export declare function agrees(copies: readonly Copy[], tags: SpecifierTags): boolean;
|
|
5
|
+
export declare function serves(copies: readonly Copy[], tags: SpecifierTags, acceptsTag: AcceptsTag): boolean;
|
|
6
|
+
export declare function unwitnessedGap(copies: readonly Copy[], tags: SpecifierTags, builds: Iterable<Build>): Specifier | undefined;
|
|
@@ -11,7 +11,5 @@ type RemoteEntry = Omit<FederationInfo, 'shared'> & {
|
|
|
11
11
|
type SharedInfoActions = Record<string, {
|
|
12
12
|
action: SharedVersionAction;
|
|
13
13
|
override?: Record<string, string>;
|
|
14
|
-
covered?: string[];
|
|
15
|
-
sameVersion?: boolean;
|
|
16
14
|
}>;
|
|
17
15
|
export { RawRemoteEntry, RemoteEntry, FederationInfo, ExposesInfo, SharedInfo, DenseSharedInfo, SharedInfoActions, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ImportMapOptions, ImportMapConfig } from './import-map.contract';
|
|
2
2
|
export { LoggingOptions, LogLevel, LogType, LoggingConfig, LogHandler, Logger, } from './log.contract';
|
|
3
|
-
export { StorageOptions, StorageEntry, StorageEntryKey, StorageConfig } from './storage.contract';
|
|
3
|
+
export { StorageOptions, StorageEntry, StorageEntryKey, StorageConfig, StorageType, StorageKey, } from './storage.contract';
|
|
4
|
+
export { NFOrchestratorGlobal, NFOrchestratorStorageInfo } from './orchestrator-global.contract';
|
|
4
5
|
export { ModeOptions, ModeConfig } from './mode.contract';
|
|
5
6
|
export { HostOptions, HostConfig } from './host.contract';
|
|
6
7
|
export { NFOptions, ConfigContract } from './config.contract';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export type ModeProfileConfig = {
|
|
2
2
|
latestSharedExternal: boolean;
|
|
3
3
|
skipInvalidExternalVersions: boolean;
|
|
4
|
-
scopeUncoveredEntrypoints: boolean;
|
|
5
4
|
overrideCachedRemotes: 'always' | 'never' | 'init-only';
|
|
6
5
|
overrideCachedRemotesIfURLMatches: boolean;
|
|
7
6
|
cacheTag?: string;
|
|
8
7
|
};
|
|
9
8
|
export type ModeFeatureConfig = {
|
|
10
9
|
convertFlatSharedInfo: boolean;
|
|
11
|
-
useAutoExternalPooling: boolean;
|
|
12
10
|
};
|
|
13
11
|
export type ModeStrictnessConfig = {
|
|
14
12
|
strictRemoteEntry: boolean;
|
|
@@ -16,7 +14,6 @@ export type ModeStrictnessConfig = {
|
|
|
16
14
|
strictExternalSameVersionCompatibility: boolean;
|
|
17
15
|
strictExternalVersion: boolean;
|
|
18
16
|
strictImportMap: boolean;
|
|
19
|
-
strictEntryPointCoverage: boolean;
|
|
20
17
|
};
|
|
21
18
|
export type ModeConfig = {
|
|
22
19
|
strict: ModeStrictnessConfig;
|
|
@@ -24,7 +21,13 @@ export type ModeConfig = {
|
|
|
24
21
|
feature: ModeFeatureConfig;
|
|
25
22
|
};
|
|
26
23
|
export type ModeOptions = {
|
|
27
|
-
strict?: Partial<ModeStrictnessConfig>
|
|
28
|
-
|
|
24
|
+
strict?: (Partial<ModeStrictnessConfig> & {
|
|
25
|
+
/** @deprecated Removed in 4.8.0 and ignored: a package always runs from one build. */
|
|
26
|
+
strictEntryPointCoverage?: boolean;
|
|
27
|
+
}) | boolean;
|
|
28
|
+
profile?: Partial<ModeProfileConfig> & {
|
|
29
|
+
/** @deprecated Removed in 4.8.0 and ignored: a package always runs from one build. */
|
|
30
|
+
scopeUncoveredEntrypoints?: boolean;
|
|
31
|
+
};
|
|
29
32
|
feature?: Partial<ModeFeatureConfig>;
|
|
30
33
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StorageKey, StorageType } from './storage.contract';
|
|
2
|
+
type NFOrchestratorStorageInfo = Readonly<{
|
|
3
|
+
version: string;
|
|
4
|
+
type: StorageType;
|
|
5
|
+
namespace: string;
|
|
6
|
+
keys: readonly StorageKey[];
|
|
7
|
+
get?: (key: string) => unknown;
|
|
8
|
+
}>;
|
|
9
|
+
type NFOrchestratorGlobal = Readonly<{
|
|
10
|
+
storage: Readonly<Record<string, NFOrchestratorStorageInfo>>;
|
|
11
|
+
}>;
|
|
12
|
+
declare global {
|
|
13
|
+
var __NF_ORCHESTRATOR__: NFOrchestratorGlobal | undefined;
|
|
14
|
+
}
|
|
15
|
+
export { NFOrchestratorGlobal, NFOrchestratorStorageInfo };
|
|
@@ -4,7 +4,23 @@ type StorageEntry<TValue> = {
|
|
|
4
4
|
clear: () => StorageEntry<TValue>;
|
|
5
5
|
};
|
|
6
6
|
type StorageEntryKey = number | symbol | string;
|
|
7
|
-
type
|
|
7
|
+
type StorageType = 'globalThis' | 'localStorage' | 'sessionStorage' | 'custom';
|
|
8
|
+
type StorageEntryCreator = {
|
|
9
|
+
(namespace: string): StorageEntryHandler;
|
|
10
|
+
type?: StorageType;
|
|
11
|
+
};
|
|
12
|
+
declare const STORAGE_KEYS: {
|
|
13
|
+
readonly remotes: "remotes";
|
|
14
|
+
readonly sharedExternals: "shared-externals";
|
|
15
|
+
readonly scopedExternals: "scoped-externals";
|
|
16
|
+
readonly sharedChunks: "shared-chunks";
|
|
17
|
+
readonly cacheState: "cache-state";
|
|
18
|
+
};
|
|
19
|
+
type StorageKey = (typeof STORAGE_KEYS)[keyof typeof STORAGE_KEYS];
|
|
20
|
+
type CacheState = {
|
|
21
|
+
version: string;
|
|
22
|
+
undecidedScopes: string[];
|
|
23
|
+
};
|
|
8
24
|
type StorageEntryHandler = <TValue>(key: string, initialValue: TValue) => StorageEntry<TValue>;
|
|
9
25
|
type StorageConfig = {
|
|
10
26
|
storage: StorageEntryHandler;
|
|
@@ -14,5 +30,6 @@ type StorageOptions = {
|
|
|
14
30
|
storage?: StorageEntryCreator;
|
|
15
31
|
clearStorage?: boolean;
|
|
16
32
|
storageNamespace?: string;
|
|
33
|
+
exposeStorageGetter?: boolean;
|
|
17
34
|
};
|
|
18
|
-
export { StorageEntry, StorageEntryKey, StorageEntryHandler, StorageConfig, StorageOptions, StorageEntryCreator, };
|
|
35
|
+
export { StorageEntry, StorageEntryKey, StorageEntryHandler, StorageConfig, StorageOptions, StorageEntryCreator, StorageType, StorageKey, STORAGE_KEYS, CacheState, };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ForCommittingChanges } from './for-committing-changes.port';
|
|
2
|
+
import type { ForRollingBackChanges } from './for-rolling-back-changes.port';
|
|
2
3
|
import type { ForDeterminingSharedExternals } from './for-determining-shared-externals.port';
|
|
3
4
|
import type { ForPoolingSharedExternals } from './for-pooling-shared-externals.port';
|
|
4
|
-
import type { ForMarkingPoolsForReelection } from './for-marking-pools-for-reelection.port';
|
|
5
5
|
import type { ForPoolingDynamicExternals } from './for-pooling-dynamic-externals.port';
|
|
6
|
+
import type { ForDecidingServingBuilds } from './for-deciding-serving-builds.port';
|
|
6
7
|
import type { ForExposingModuleLoader } from './for-exposing-module-loader.port';
|
|
7
8
|
import type { ForGeneratingImportMap } from './for-generating-import-map';
|
|
8
9
|
import type { ForGettingRemoteEntries } from './for-getting-remote-entries.port';
|
|
@@ -15,11 +16,12 @@ import type { DrivingContract } from '../../driving-ports/driving.contract';
|
|
|
15
16
|
export type InitDriversContract = {
|
|
16
17
|
getRemoteEntries: ForGettingRemoteEntries;
|
|
17
18
|
processRemoteEntries: ForProcessingRemoteEntries;
|
|
18
|
-
markPoolsForReelection: ForMarkingPoolsForReelection;
|
|
19
19
|
determineSharedExternals: ForDeterminingSharedExternals;
|
|
20
20
|
poolSharedExternals: ForPoolingSharedExternals;
|
|
21
|
+
decideServingBuilds: ForDecidingServingBuilds;
|
|
21
22
|
generateImportMap: ForGeneratingImportMap;
|
|
22
23
|
commitChanges: ForCommittingChanges;
|
|
24
|
+
rollbackChanges: ForRollingBackChanges;
|
|
23
25
|
exposeModuleLoader: ForExposingModuleLoader;
|
|
24
26
|
getRemoteEntry: ForGettingRemoteEntry;
|
|
25
27
|
updateCache: ForUpdatingCache;
|
|
@@ -2,5 +2,6 @@ import type { ImportMap } from '../../../1.domain/import-map/import-map.contract
|
|
|
2
2
|
export type CommitOptions = {
|
|
3
3
|
/** Replace the DOM importmap instead of appending a partial one to it. */
|
|
4
4
|
override?: boolean;
|
|
5
|
+
markUndecided?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export type ForCommittingChanges = (importMap: ImportMap, opts?: CommitOptions) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ForDecidingServingBuilds = () => Promise<void>;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* The externals this pass re-elected, per shareScope. Determine clears `dirty` before pooling runs,
|
|
4
|
-
* so this is the only signal left of what changed; a scope with nothing re-elected is absent rather
|
|
5
|
-
* than empty.
|
|
6
|
-
*/
|
|
7
|
-
export type TouchedExternals = ReadonlyMap<string, ReadonlySet<ExternalName>>;
|
|
8
|
-
export type ForDeterminingSharedExternals = () => Promise<TouchedExternals>;
|
|
1
|
+
export type ForDeterminingSharedExternals = () => Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { RemoteEntry, SharedInfoActions } from '../../../1.domain';
|
|
2
|
+
import type { LoadActions } from '../../../1.domain/remote-entry/load-actions.contract';
|
|
2
3
|
export type ForPoolingDynamicExternals = (input: {
|
|
3
4
|
entry: RemoteEntry;
|
|
4
|
-
actions:
|
|
5
|
+
actions: LoadActions;
|
|
5
6
|
}) => Promise<{
|
|
6
7
|
entry: RemoteEntry;
|
|
7
8
|
actions: SharedInfoActions;
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** Omitting `touched` means "no signal": every pool is processed, as before W2. */
|
|
3
|
-
export type ForPoolingSharedExternals = (touched?: TouchedExternals) => Promise<void>;
|
|
1
|
+
export type ForPoolingSharedExternals = () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ForRollingBackChanges = (label: string) => Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { RemoteEntry
|
|
1
|
+
import type { RemoteEntry } from '../../../1.domain/remote-entry/remote-entry.contract';
|
|
2
|
+
import type { LoadActions } from '../../../1.domain/remote-entry/load-actions.contract';
|
|
2
3
|
export type ForUpdatingCache = (remoteEntries: RemoteEntry) => Promise<{
|
|
3
4
|
entry: RemoteEntry;
|
|
4
|
-
actions:
|
|
5
|
+
actions: LoadActions;
|
|
5
6
|
}>;
|
|
@@ -3,8 +3,10 @@ export * from './for-processing-remote-entries.port';
|
|
|
3
3
|
export * from './for-determining-shared-externals.port';
|
|
4
4
|
export * from './for-pooling-shared-externals.port';
|
|
5
5
|
export * from './for-pooling-dynamic-externals.port';
|
|
6
|
+
export * from './for-deciding-serving-builds.port';
|
|
6
7
|
export * from './for-generating-import-map';
|
|
7
8
|
export * from './for-committing-changes.port';
|
|
9
|
+
export * from './for-rolling-back-changes.port';
|
|
8
10
|
export * from './for-exposing-module-loader.port';
|
|
9
11
|
export * from './for-getting-remote-entry.port';
|
|
10
12
|
export * from './for-updating-cache';
|
|
@@ -3,5 +3,6 @@ export type ForSharedChunksStorage = {
|
|
|
3
3
|
addOrReplace: (remote: string, bundleName: string, chunks: string[]) => ForSharedChunksStorage;
|
|
4
4
|
remove: (remote: string) => ForSharedChunksStorage;
|
|
5
5
|
commit: () => ForSharedChunksStorage;
|
|
6
|
+
rollback: () => ForSharedChunksStorage;
|
|
6
7
|
tryGet: (remote: string, bundleName: string) => Optional<string[]>;
|
|
7
8
|
};
|
|
@@ -9,6 +9,10 @@ export type ForSharedExternalsStorage = {
|
|
|
9
9
|
scopeType: (shareScope?: string) => 'global' | 'strict' | 'shareScope';
|
|
10
10
|
removeFromAllScopes: (remoteNames: ReadonlySet<RemoteName>) => void;
|
|
11
11
|
addOrUpdate: (name: string, external: SharedExternal, shareScope?: string) => ForSharedExternalsStorage;
|
|
12
|
-
|
|
12
|
+
uncommittedScopes: () => string[];
|
|
13
|
+
markUndecided: (shareScope: string) => void;
|
|
14
|
+
isUndecided: (shareScope: string) => boolean;
|
|
15
|
+
markDecided: (shareScope: string) => void;
|
|
13
16
|
commit: () => ForSharedExternalsStorage;
|
|
17
|
+
rollback: () => ForSharedExternalsStorage;
|
|
14
18
|
};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import type { SharedExternal, SharedVersion, SharedVersionMeta } from '../../1.domain';
|
|
2
|
+
import type { AcceptsTag, VersionAcceptance } from '../../1.domain/externals/compatibility';
|
|
2
3
|
import type { LoggingConfig } from '../config/log.contract';
|
|
3
4
|
import type { ModeConfig } from '../config/mode.contract';
|
|
4
|
-
export
|
|
5
|
-
export type VersionAcceptance = {
|
|
6
|
-
accepts: (version: SharedVersion, tag: string) => boolean;
|
|
7
|
-
objector: (version: SharedVersion, tag: string) => SharedVersionMeta | undefined;
|
|
8
|
-
};
|
|
9
|
-
export declare function versionAcceptance(external: SharedExternal, isCompatible: IsCompatible): VersionAcceptance;
|
|
5
|
+
export declare function rejectIncompatible(config: LoggingConfig, copy: SharedVersionMeta, rejected: string, servedAt: string): never;
|
|
10
6
|
/**
|
|
11
|
-
* The tail of winner election: derive every other version's verdict from the chosen one,
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* A hazard for anyone who ever adds a second caller that re-points a winner: `findTears` keys off the
|
|
16
|
-
* winner's merged entries, so moving the winner moves the surface coverage is measured against.
|
|
7
|
+
* The tail of winner election: derive every other version's verdict from the chosen one, clear `dirty`.
|
|
8
|
+
* `determine` is the only caller, and passes its `acceptsTag` plus the `acceptance` it already built for
|
|
9
|
+
* the election.
|
|
17
10
|
*/
|
|
18
|
-
export declare function createApplyWinner(config: LoggingConfig & ModeConfig): (externalName: string, external: SharedExternal, winner: SharedVersion,
|
|
11
|
+
export declare function createApplyWinner(config: LoggingConfig & ModeConfig): (externalName: string, external: SharedExternal, winner: SharedVersion, acceptsTag: AcceptsTag, acceptance: VersionAcceptance) => SharedExternal;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ForDecidingServingBuilds } from '../driver-ports/init/for-deciding-serving-builds.port';
|
|
2
|
+
import type { DrivingContract } from '../driving-ports/driving.contract';
|
|
3
|
+
import type { LoggingConfig } from '../config/log.contract';
|
|
4
|
+
import type { ModeConfig } from '../config/mode.contract';
|
|
5
|
+
export declare function createDecideServingBuilds(config: LoggingConfig & ModeConfig, ports: Pick<DrivingContract, 'versionCheck' | 'sharedExternalsRepo'>): ForDecidingServingBuilds;
|