Skip to content

Commit 0e6f1f5

Browse files
doc:update runtime types (#3489)
Co-authored-by: CocooDanielle <[email protected]>
1 parent a5b7ef8 commit 0e6f1f5

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

apps/website-new/docs/en/guide/basic/runtime.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type InitOptions = {
7373
name: string;
7474
// The list of remote modules to depend on
7575
// When using the version content, it needs to be used with snapshot, which is still under construction
76-
remotes: Array<RemoteInfo>;
76+
remotes: Array<Remote>;
7777
// The list of dependencies that the current consumer needs to share
7878
// When using the build plugin, users can configure the dependencies to be shared in the build plugin, and the build plugin will inject the shared dependencies into the runtime sharing configuration
7979
// Shared must be manually passed in the version instance when passed at runtime because it cannot be directly passed at runtime.
@@ -98,9 +98,7 @@ type SharedBaseArgs = {
9898

9999
type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
100100

101-
type RemoteInfo = (RemotesWithEntry | RemotesWithVersion) & {
102-
alias?: string;
103-
};
101+
type Remote = (RemotesWithEntry | RemotesWithVersion) & RemoteInfoCommon;
104102

105103
interface RemotesWithVersion {
106104
name: string;
@@ -111,6 +109,15 @@ interface RemotesWithEntry {
111109
name: string;
112110
entry: string;
113111
};
112+
113+
interface RemoteInfoCommon {
114+
alias?: string;
115+
shareScope?: string;
116+
type?: RemoteEntryType;
117+
entryGlobalName?: string;
118+
}
119+
120+
type RemoteEntryType =|'var'|'module'|'assign'|'assign-properties'|'this'|'window'|'self'|'global'|'commonjs'|'commonjs2'|'commonjs-module'| 'commonjs-static'|'amd'|'amd-require'|'umd'|'umd2'|'jsonp'|'system'| string;
114121
```
115122

116123
### loadRemote

apps/website-new/docs/zh/guide/basic/runtime.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type InitOptions {
6767
name: string;
6868
// 依赖的远程模块列表
6969
// 使用 version 内容的时候需要配合 snapshot 使用,该内容还在施工中
70-
remotes: Array<RemoteInfo>;
70+
remotes: Array<Remote>;
7171
// 当前消费者需要共享的依赖项列表
7272
// 当使用构建插件时,用户可以在构建插件中配置需要共享的依赖项,而构建插件会将需要共享的依赖项注入到运行时共享配置中
7373
// Shared 在运行时传入时必须在版本实例引用中手动传入,因为它不能在运行时直接传入。
@@ -90,9 +90,7 @@ type SharedBaseArgs = {
9090

9191
type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
9292

93-
type RemoteInfo = (RemotesWithEntry | RemotesWithVersion) & {
94-
alias?: string;
95-
};
93+
type Remote = (RemotesWithEntry | RemotesWithVersion) & RemoteInfoCommon
9694

9795
interface RemotesWithVersion {
9896
name: string;
@@ -104,6 +102,15 @@ interface RemotesWithEntry {
104102
entry: string;
105103
}
106104

105+
interface RemoteInfoCommon {
106+
alias?: string;
107+
shareScope?: string;
108+
type?: RemoteEntryType;
109+
entryGlobalName?: string;
110+
}
111+
112+
type RemoteEntryType =|'var'|'module'|'assign'|'assign-properties'|'this'|'window'|'self'|'global'|'commonjs'|'commonjs2'|'commonjs-module'| 'commonjs-static'|'amd'|'amd-require'|'umd'|'umd2'|'jsonp'|'system'| string;
113+
107114
type ShareInfos = {
108115
// 依赖的包名、依赖的基本信息和共享策略
109116
[pkgName: string]: Share;

0 commit comments

Comments
 (0)