remote-reload-utils 0.0.14 → 0.0.17

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/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@
7
7
 
8
8
  ## [未发布]
9
9
 
10
+ ## [0.0.17] - 2026-03-19
11
+
12
+ ### Release
13
+
14
+ - Published version 0.0.17 with patch bump
15
+
16
+
17
+ ## [0.0.16] - 2026-03-18
18
+
19
+ ### Release
20
+
21
+ - Published version 0.0.16 with patch bump
22
+
23
+
24
+ ## [0.0.15] - 2026-03-17
25
+
26
+ ### Release
27
+
28
+ - Published version 0.0.15 with patch bump
29
+
30
+
10
31
  ## [0.0.14] - 2026-03-17
11
32
 
12
33
  ### Release
@@ -158,6 +179,12 @@
158
179
 
159
180
  | 版本 | 日期 | 主要变更 |
160
181
  |------|------|----------|
182
+ | 0.0.17 | 2026-03-19 | patch 版本发布 |
183
+ |------|------|----------|
184
+ | 0.0.16 | 2026-03-18 | patch 版本发布 |
185
+ |------|------|----------|
186
+ | 0.0.15 | 2026-03-17 | patch 版本发布 |
187
+ |------|------|----------|
161
188
  | 0.0.14 | 2026-03-17 | patch 版本发布 |
162
189
  |------|------|----------|
163
190
  | 0.0.13 | 2026-03-17 | patch 版本发布 |
package/dist/index.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- import './styles/index.css';
2
1
  export { loadReactVersion } from './version/react';
3
2
  export { checkVersionCompatibility, satisfiesVersion, findCompatibleVersion, getCompatibleReactVersions, fetchAvailableVersions, sortVersions, getLatestVersion, getStableVersions, extractMajorVersion, isPrerelease, compareVersions, parseVersion, } from './version';
4
- export { loadRemoteMultiVersion } from './loader';
5
- export { fetchLatestVersion, getVersionCache, setVersionCache, buildCdnUrls, tryLoadRemote, getFinalSharedConfig, resolveFinalVersion, buildFinalUrls, type LoadResult, } from './loader/utils';
3
+ export { loadRemoteMultiVersion, createRemoteSourcePlugin, type RemoteSourcePlugin, type RemoteSourcePluginContext, type LoadRemoteExtraOptions, } from './loader';
4
+ export { fetchLatestVersion, getVersionCache, setVersionCache, buildCdnUrls, tryLoadRemote, getFinalSharedConfig, resolveFinalVersion, buildFinalUrls, type LoadResult, type RuntimeRemote, } from './loader/utils';
6
5
  export { preloadRemote, preloadRemoteList, cancelPreload, clearPreloadCache, getPreloadStatus, } from './preload';
7
6
  export { unloadRemote, unloadAll, registerRemoteInstance, registerLoadedModule, getLoadedRemotes, isRemoteLoaded, } from './unload';
8
7
  export { checkRemoteHealth, checkModuleLoadable, getRemoteHealthReport, formatHealthStatus, } from './health';
9
8
  export { eventBus, createEventBus, } from './event-bus';
10
9
  export type { LoadRemoteOptions, VersionCache, PreloadOptions, PreloadCacheItem, PreloadStatus, } from './types';
11
10
  export { fallbackPlugin } from './plugins/fallback';
12
- export { ErrorBoundary, RemoteModuleProvider, RemoteModuleRenderer, useRemoteModule, lazyRemote, SuspenseRemote, SuspenseRemoteLoader, withRemote, useRemoteModuleHook, } from './components';
13
- export type { ErrorBoundaryProps, RemoteModuleCardProps, UseRemoteModuleOptions, LazyRemoteOptions, SuspenseRemoteProps, SuspenseRemoteWithPropsProps, } from './components';
@@ -1,6 +1,8 @@
1
- import { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1
+ import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
2
2
  import type { LoadRemoteOptions } from '../types';
3
+ import { createRemoteSourcePlugin, type LoadRemoteExtraOptions, type RemoteSourcePlugin, type RemoteSourcePluginContext } from './remote-source';
4
+ export { createRemoteSourcePlugin, type RemoteSourcePlugin, type RemoteSourcePluginContext, type LoadRemoteExtraOptions, };
3
5
  /**
4
6
  * 多版本共存的 loadRemote
5
7
  */
6
- export declare function loadRemoteMultiVersion(options: LoadRemoteOptions, plugins: ModuleFederationRuntimePlugin[]): Promise<import("./utils").LoadResult>;
8
+ export declare function loadRemoteMultiVersion(options: LoadRemoteOptions, plugins?: ModuleFederationRuntimePlugin[], extraOptions?: LoadRemoteExtraOptions): Promise<import("./utils").LoadResult>;
@@ -0,0 +1,28 @@
1
+ import type { LoadRemoteOptions } from '../../types';
2
+ import type { RuntimeRemote } from '../utils';
3
+ type MaybePromise<T> = T | Promise<T>;
4
+ export interface RemoteSourcePluginContext {
5
+ options: LoadRemoteOptions;
6
+ scopeName: string;
7
+ pkg: string;
8
+ finalVersion: string;
9
+ currentEntry: string;
10
+ allEntries: string[];
11
+ }
12
+ export interface RemoteSourcePlugin {
13
+ name: string;
14
+ registerRemotes?: (context: RemoteSourcePluginContext) => MaybePromise<RuntimeRemote[] | void>;
15
+ }
16
+ export interface LoadRemoteExtraOptions {
17
+ remoteSourcePlugins?: RemoteSourcePlugin[];
18
+ baseRemotes?: RuntimeRemote[];
19
+ registerOptions?: {
20
+ force?: boolean;
21
+ };
22
+ }
23
+ export declare function resolveRegisteredRemotes(context: RemoteSourcePluginContext, baseRemotes: RuntimeRemote[], remoteSourcePlugins: RemoteSourcePlugin[]): Promise<RuntimeRemote[]>;
24
+ /**
25
+ * 创建静态 remote 来源插件
26
+ */
27
+ export declare function createRemoteSourcePlugin(name: string, remotes: RuntimeRemote[]): RemoteSourcePlugin;
28
+ export {};
@@ -20,10 +20,14 @@ export interface LoadResult {
20
20
  scopeName: string;
21
21
  mf: ReturnType<typeof createInstance>;
22
22
  }
23
+ export type RuntimeRemote = Parameters<ReturnType<typeof createInstance>['registerRemotes']>[0][number];
23
24
  /**
24
- * 尝试加载单个远程模块 URL,包含重试逻辑
25
+ * 尝试加载单个远程模块 URL
26
+ * 注意:实际的重试机制在外层 loadRemoteMultiVersion 的 URL 遍历中实现
25
27
  */
26
- export declare function tryLoadRemote(scopeName: string, url: string, retries: number, delay: number, sharedConfig: Record<string, any>, plugins: ModuleFederationRuntimePlugin[]): Promise<LoadResult>;
28
+ export declare function tryLoadRemote(scopeName: string, url: string, _retries: number, _delay: number, sharedConfig: Record<string, any>, plugins: ModuleFederationRuntimePlugin[], extraRemotes?: RuntimeRemote[], registerOptions?: {
29
+ force?: boolean;
30
+ }): Promise<LoadResult>;
27
31
  /**
28
32
  * 获取最终的共享配置
29
33
  */