@softarc/native-federation-orchestrator 4.1.1 → 4.2.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.
Files changed (32) hide show
  1. package/README.md +5 -0
  2. package/fesm2022/@softarc/native-federation-orchestrator.mjs +47 -47
  3. package/fesm2022/@softarc/native-federation-orchestrator.mjs.map +3 -3
  4. package/fesm2022/node.mjs +2973 -0
  5. package/fesm2022/node.mjs.map +7 -0
  6. package/fesm2022/options.mjs +1 -1
  7. package/fesm2022/options.mjs.map +2 -2
  8. package/fesm2022/registry.mjs +78 -30
  9. package/fesm2022/registry.mjs.map +4 -4
  10. package/fesm2022/sdk.mjs +1 -1
  11. package/fesm2022/sdk.mjs.map +2 -2
  12. package/init-registry.mjs +1 -1
  13. package/node-loader/loader.mjs +92 -0
  14. package/node-loader/loader.mjs.map +7 -0
  15. package/package.json +12 -4
  16. package/quickstart.mjs +11 -11
  17. package/types/lib/1.domain/registry/event-registry.contract.d.ts +4 -1
  18. package/types/lib/1.domain/registry/index.d.ts +0 -1
  19. package/types/lib/2.app/config/registry.contract.d.ts +2 -2
  20. package/types/lib/2.app/flows/registry/setup-registry.d.ts +2 -2
  21. package/types/lib/3.adapters/node/fs-manifest-provider.d.ts +3 -0
  22. package/types/lib/3.adapters/node/fs-remote-entry-provider.d.ts +3 -0
  23. package/types/lib/3.adapters/node/loader-url.d.ts +8 -0
  24. package/types/lib/3.adapters/node/node-loader.client.d.ts +9 -0
  25. package/types/lib/3.adapters/node/noop-sse.d.ts +3 -0
  26. package/types/lib/4.config/import-map/use-node.d.ts +6 -0
  27. package/types/lib/init-federation.node.d.ts +6 -0
  28. package/types/lib/node.index.d.ts +5 -0
  29. package/types/lib/utils/node/read-source.d.ts +1 -0
  30. package/types/lib/utils/node/to-url.d.ts +3 -0
  31. package/types/node-loader.d.ts +41 -0
  32. package/types/lib/1.domain/registry/registry-options.contract.d.ts +0 -11
@@ -0,0 +1,6 @@
1
+ import type { FederationManifest } from './1.domain';
2
+ import type { NFOptions } from './2.app/config/config.contract';
3
+ import type { NativeFederationResult } from './init-federation.contract';
4
+ export type InitNodeFederationOptions = NFOptions;
5
+ declare const initNodeFederation: (remotesOrManifestUrl: string | FederationManifest, options?: InitNodeFederationOptions) => Promise<NativeFederationResult>;
6
+ export { initNodeFederation };
@@ -0,0 +1,5 @@
1
+ export { initNodeFederation } from './init-federation.node';
2
+ export type { InitNodeFederationOptions } from './init-federation.node';
3
+ export { NFError } from './native-federation.error';
4
+ export type { LoadRemoteModule, LoadRemoteModuleOf, NativeFederationResult, } from './init-federation.contract';
5
+ export type { FederationManifest } from './1.domain/remote-entry/manifest.contract';
@@ -0,0 +1 @@
1
+ export declare const readSourceBytes: (input: string) => Promise<ArrayBuffer>;
@@ -0,0 +1,3 @@
1
+ import type { HostOptions } from '../../2.app/config/host.contract';
2
+ export declare const toUrl: (pathOrUrl: string) => string;
3
+ export declare const normalizeHostRemoteEntry: (hostRemoteEntry: HostOptions["hostRemoteEntry"]) => HostOptions["hostRemoteEntry"];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Node.js module customization hooks for native-federation.
3
+ *
4
+ * Registered via `module.register(<this file>, import.meta.url, { data: { port }, transferList: [port] })`
5
+ * from the orchestrator. The main thread posts the resolved import map over the
6
+ * MessagePort whenever it changes; this loader rewrites `import` specifiers
7
+ * accordingly and fetches http(s) modules into the loader as source text.
8
+ */
9
+ import type { MessagePort } from 'node:worker_threads';
10
+ type Imports = Record<string, string>;
11
+ type Scopes = Record<string, Imports>;
12
+ type ImportMap = {
13
+ imports: Imports;
14
+ scopes?: Scopes;
15
+ };
16
+ type InitData = {
17
+ port?: MessagePort;
18
+ initialImportMap?: ImportMap;
19
+ };
20
+ export declare function initialize(data?: InitData): void;
21
+ type ResolveContext = {
22
+ parentURL?: string;
23
+ };
24
+ type ResolveResult = {
25
+ url: string;
26
+ format?: string | null;
27
+ shortCircuit?: boolean;
28
+ };
29
+ type NextResolve = (specifier: string, context?: ResolveContext) => Promise<ResolveResult>;
30
+ export declare function resolve(specifier: string, context: ResolveContext, nextResolve: NextResolve): Promise<ResolveResult>;
31
+ type LoadContext = {
32
+ format?: string | null;
33
+ };
34
+ type LoadResult = {
35
+ format: string;
36
+ source?: string | ArrayBuffer | Uint8Array;
37
+ shortCircuit?: boolean;
38
+ };
39
+ type NextLoad = (url: string, context?: LoadContext) => Promise<LoadResult>;
40
+ export declare function load(url: string, context: LoadContext, nextLoad: NextLoad): Promise<LoadResult>;
41
+ export {};
@@ -1,11 +0,0 @@
1
- import type { NFEventErrorHandler } from './event.contract';
2
- export interface RegistryOptions {
3
- timeout?: number;
4
- retries?: number;
5
- onError?: NFEventErrorHandler;
6
- }
7
- export type EventStreamOptions = {
8
- maxEvents?: number;
9
- ttl?: number;
10
- enableLatest?: boolean;
11
- };