Skip to content

Commit

Permalink
doc:update runtime types (#3489)
Browse files Browse the repository at this point in the history
Co-authored-by: CocooDanielle <[email protected]>
  • Loading branch information
neversleeppy and danpeen authored Feb 10, 2025
1 parent a5b7ef8 commit 0e6f1f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
15 changes: 11 additions & 4 deletions apps/website-new/docs/en/guide/basic/runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type InitOptions = {
name: string;
// The list of remote modules to depend on
// When using the version content, it needs to be used with snapshot, which is still under construction
remotes: Array<RemoteInfo>;
remotes: Array<Remote>;
// The list of dependencies that the current consumer needs to share
// 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
// Shared must be manually passed in the version instance when passed at runtime because it cannot be directly passed at runtime.
Expand All @@ -98,9 +98,7 @@ type SharedBaseArgs = {

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

type RemoteInfo = (RemotesWithEntry | RemotesWithVersion) & {
alias?: string;
};
type Remote = (RemotesWithEntry | RemotesWithVersion) & RemoteInfoCommon;

interface RemotesWithVersion {
name: string;
Expand All @@ -111,6 +109,15 @@ interface RemotesWithEntry {
name: string;
entry: string;
};

interface RemoteInfoCommon {
alias?: string;
shareScope?: string;
type?: RemoteEntryType;
entryGlobalName?: string;
}

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;
```

### loadRemote
Expand Down
15 changes: 11 additions & 4 deletions apps/website-new/docs/zh/guide/basic/runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type InitOptions {
name: string;
// 依赖的远程模块列表
// 使用 version 内容的时候需要配合 snapshot 使用,该内容还在施工中
remotes: Array<RemoteInfo>;
remotes: Array<Remote>;
// 当前消费者需要共享的依赖项列表
// 当使用构建插件时,用户可以在构建插件中配置需要共享的依赖项,而构建插件会将需要共享的依赖项注入到运行时共享配置中
// Shared 在运行时传入时必须在版本实例引用中手动传入,因为它不能在运行时直接传入。
Expand All @@ -90,9 +90,7 @@ type SharedBaseArgs = {

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

type RemoteInfo = (RemotesWithEntry | RemotesWithVersion) & {
alias?: string;
};
type Remote = (RemotesWithEntry | RemotesWithVersion) & RemoteInfoCommon

interface RemotesWithVersion {
name: string;
Expand All @@ -104,6 +102,15 @@ interface RemotesWithEntry {
entry: string;
}

interface RemoteInfoCommon {
alias?: string;
shareScope?: string;
type?: RemoteEntryType;
entryGlobalName?: string;
}

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;

type ShareInfos = {
// 依赖的包名、依赖的基本信息和共享策略
[pkgName: string]: Share;
Expand Down

0 comments on commit 0e6f1f5

Please sign in to comment.