webloom-framework 0.2.0 → 0.4.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 +74 -43
- package/dist/advanced.d.ts +168 -0
- package/dist/advanced.js +441 -0
- package/dist/advanced.js.map +1 -0
- package/dist/chunk-4DSINPZD.js +158 -0
- package/dist/chunk-4DSINPZD.js.map +1 -0
- package/dist/chunk-JHJZIO2H.js +4018 -0
- package/dist/chunk-JHJZIO2H.js.map +1 -0
- package/dist/chunk-RAQOFUZY.js +1737 -0
- package/dist/chunk-RAQOFUZY.js.map +1 -0
- package/dist/chunk-YOIH6H36.js +433 -0
- package/dist/chunk-YOIH6H36.js.map +1 -0
- package/dist/index.d.ts +38 -443
- package/dist/index.js +38 -1967
- package/dist/index.js.map +1 -1
- package/dist/messageBus-CtrwkjrO.d.ts +5 -0
- package/dist/messagePortServiceTransport-B0FyJr43.d.ts +264 -0
- package/dist/react.d.ts +41 -28
- package/dist/react.js +79 -88
- package/dist/react.js.map +1 -1
- package/dist/runtimeTypes-DquUCHz-.d.ts +1640 -0
- package/dist/sharedWorkerHost-Cb2a1_KD.d.ts +190 -0
- package/dist/testing.d.ts +18 -17
- package/dist/testing.js +23 -15
- package/dist/testing.js.map +1 -1
- package/dist/windowRuntime-B6Ue8jso.d.ts +23 -0
- package/docs/api.md +149 -111
- package/docs/migration-baseline.md +2 -2
- package/docs/proposals/browser-runtime-v1/implementation-plan.md +7 -1
- package/docs/proposals/browser-runtime-v1/requirements.md +6 -1
- package/docs/proposals/browser-runtime-v1/verification.md +20 -13
- package/docs/proposals/shared-worker-call-first/SWCF-009-typed-transfer-follow-up.md +34 -0
- package/docs/proposals/shared-worker-call-first/implementation-plan.md +567 -0
- package/docs/proposals/webloom-v4/implementation-plan.md +443 -0
- package/docs/proposals/webloom-v4/requirements.md +555 -0
- package/docs/proposals/webloom-v4/verification.md +84 -0
- package/package.json +9 -2
- package/dist/chunk-URY3E6UH.js +0 -3802
- package/dist/chunk-URY3E6UH.js.map +0 -1
- package/dist/createPluginHost-ChJNBTsX.d.ts +0 -1339
- package/dist/resourceRegistry-MNM1c7od.d.ts +0 -157
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { i as PluginSetup, aL as RuntimeUnitImplementationRegistry, M as MessageBus, W as LifecycleScopeKind, u as LifecycleScopeIdentity, t as LifecycleScope, L as LifecycleDisposeResult, af as PluginIntentSnapshot, ad as PluginIntentController, aw as RemoteServiceTransport, q as RemoteServiceBridge, n as RemoteServiceReference, ar as RemoteServiceCallContext, o as RemoteServiceMessageCodec, aC as ResourceRegistry, aA as ResourceDefinition } from './createPluginHost-ChJNBTsX.js';
|
|
2
|
-
|
|
3
|
-
interface RuntimeUnitImplementation {
|
|
4
|
-
/** 产品标识。 */
|
|
5
|
-
pluginId: string;
|
|
6
|
-
/** 稳定运行单元标识。 */
|
|
7
|
-
unitId: string;
|
|
8
|
-
/** 当前环境的可执行入口。 */
|
|
9
|
-
setup: PluginSetup;
|
|
10
|
-
}
|
|
11
|
-
/** 创建一个拒绝重复注册、按产品和单元查找实现的运行时注册表。 */
|
|
12
|
-
declare function createRuntimeUnitImplementationRegistry(implementations?: readonly RuntimeUnitImplementation[]): RuntimeUnitImplementationRegistry & {
|
|
13
|
-
register(implementation: RuntimeUnitImplementation): void;
|
|
14
|
-
unregister(pluginId: string, unitId: string): void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
declare function createMessageBus(): MessageBus;
|
|
18
|
-
|
|
19
|
-
interface CreateResourceScopeOptions {
|
|
20
|
-
/** 可选固定作用域标识;生产代码通常省略,让实现生成不可复用 ID。 */
|
|
21
|
-
scopeId?: string;
|
|
22
|
-
/** 运行实例标识;省略时与 scopeId 同源生成。 */
|
|
23
|
-
instanceId?: string;
|
|
24
|
-
/** 作用域类型。 */
|
|
25
|
-
kind: LifecycleScopeKind;
|
|
26
|
-
/** 绑定插件和宿主只读属性。 */
|
|
27
|
-
metadata?: Omit<Partial<LifecycleScopeIdentity>, "scopeId" | "instanceId" | "kind">;
|
|
28
|
-
/** 测试或宿主诊断使用的状态变更回调。 */
|
|
29
|
-
onChange?: (scope: LifecycleScope) => void;
|
|
30
|
-
/** 子作用域生成最终清理结果后的内部通知;用于更新父级登记。 */
|
|
31
|
-
onDisposeResult?: (result: LifecycleDisposeResult) => void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* 创建一个可嵌套的生命周期作用域。
|
|
35
|
-
*
|
|
36
|
-
* `createResourceScope` 是 `createLifecycleScope` 的同义入口,方便不同
|
|
37
|
-
* 模块按“作用域”或“资源”语义调用;两者不代表两套实现。
|
|
38
|
-
*/
|
|
39
|
-
declare function createLifecycleScope(options: CreateResourceScopeOptions): LifecycleScope;
|
|
40
|
-
/** 语义别名:资源管理代码通常以 ResourceScope 称呼同一原语。 */
|
|
41
|
-
declare const createResourceScope: typeof createLifecycleScope;
|
|
42
|
-
type ResourceScopeOptions = CreateResourceScopeOptions;
|
|
43
|
-
|
|
44
|
-
interface CreatePluginIntentControllerOptions {
|
|
45
|
-
/** 当前控制面启动身份;Worker 重启时应传入新值。 */
|
|
46
|
-
authorityInstanceId?: string;
|
|
47
|
-
/** Worker 恢复后读取的平台意图。 */
|
|
48
|
-
initial?: Partial<PluginIntentSnapshot>;
|
|
49
|
-
/** 将候选快照原子写入平台存储;缺省表示内存控制面(测试用)。 */
|
|
50
|
-
persist?: (snapshot: PluginIntentSnapshot) => Promise<void>;
|
|
51
|
-
/** 有界去重记录数量,避免 commandId 永久增长。 */
|
|
52
|
-
maxCommandRecords?: number;
|
|
53
|
-
}
|
|
54
|
-
/** 创建单一控制面上的插件意图控制器。 */
|
|
55
|
-
declare function createPluginIntentController(options?: CreatePluginIntentControllerOptions): PluginIntentController;
|
|
56
|
-
|
|
57
|
-
interface CreateServiceBridgeOptions {
|
|
58
|
-
/** 桥协议版本;握手要求精确匹配。 */
|
|
59
|
-
protocolVersion: string;
|
|
60
|
-
/** 实际端口 RPC 传输;桥不负责重放请求。 */
|
|
61
|
-
transport: RemoteServiceTransport;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* 创建一个绑定端口的服务桥。
|
|
65
|
-
*
|
|
66
|
-
* 快照规则:必须先接受 baseline;后续 revision 必须连续递增。发现缺口后
|
|
67
|
-
* 立即清空代理,等待新 baseline,不能拿旧服务继续运行。
|
|
68
|
-
*/
|
|
69
|
-
declare function createServiceBridge(options: CreateServiceBridgeOptions): RemoteServiceBridge;
|
|
70
|
-
/** 兼容“服务桥 / 远程服务桥”两种调用语义;实现仍只有一套。 */
|
|
71
|
-
declare const createRemoteServiceBridge: typeof createServiceBridge;
|
|
72
|
-
|
|
73
|
-
/** MessagePort 上的调用请求;request 内容由具体服务契约定义。 */
|
|
74
|
-
interface RemoteServicePortCallMessage {
|
|
75
|
-
/** 固定协议类型,避免与业务 MessageBus 事件混用。 */
|
|
76
|
-
/** codec 绑定的调用消息类型。 */
|
|
77
|
-
type: string;
|
|
78
|
-
/** 由传输层生成的唯一关联键;不接受调用方提供的业务 ID。 */
|
|
79
|
-
callId: string;
|
|
80
|
-
/** 实际端口连接标识。 */
|
|
81
|
-
connectionId: string;
|
|
82
|
-
/** 提供者运行实例;响应必须原样回显。 */
|
|
83
|
-
providerInstanceId: string;
|
|
84
|
-
/** 调用方可复用的业务操作标识;不参与 pending 映射。 */
|
|
85
|
-
operationId?: string;
|
|
86
|
-
/** 外部授权标识;Provider 最终边界必须核验。 */
|
|
87
|
-
grantId?: string;
|
|
88
|
-
/** Provider 必须在最终边界重新核验的服务引用。 */
|
|
89
|
-
reference: RemoteServiceReference;
|
|
90
|
-
/** 具体服务请求体;桥不解释也不重放。 */
|
|
91
|
-
request: unknown;
|
|
92
|
-
}
|
|
93
|
-
/** MessagePort 上的成功响应。 */
|
|
94
|
-
interface RemoteServicePortResultMessage {
|
|
95
|
-
/** codec 绑定的成功消息类型。 */
|
|
96
|
-
type: string;
|
|
97
|
-
callId: string;
|
|
98
|
-
connectionId: string;
|
|
99
|
-
providerInstanceId: string;
|
|
100
|
-
result: unknown;
|
|
101
|
-
}
|
|
102
|
-
/** MessagePort 上的失败响应;只传可序列化错误信息。 */
|
|
103
|
-
interface RemoteServicePortErrorMessage {
|
|
104
|
-
/** codec 绑定的失败消息类型。 */
|
|
105
|
-
type: string;
|
|
106
|
-
callId: string;
|
|
107
|
-
connectionId: string;
|
|
108
|
-
providerInstanceId: string;
|
|
109
|
-
error: {
|
|
110
|
-
name?: string;
|
|
111
|
-
message: string;
|
|
112
|
-
code?: string;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
/** 请求取消通知;Provider 仍需在最终提交前做自己的世代校验。 */
|
|
116
|
-
interface RemoteServicePortCancelMessage {
|
|
117
|
-
/** codec 绑定的取消消息类型。 */
|
|
118
|
-
type: string;
|
|
119
|
-
callId: string;
|
|
120
|
-
connectionId: string;
|
|
121
|
-
providerInstanceId: string;
|
|
122
|
-
}
|
|
123
|
-
type RemoteServicePortResponseMessage = RemoteServicePortResultMessage | RemoteServicePortErrorMessage;
|
|
124
|
-
interface CreateMessagePortServiceTransportOptions {
|
|
125
|
-
/** 已由实际 Worker / Window 连接产生的双工端口。 */
|
|
126
|
-
port: MessagePort;
|
|
127
|
-
/** 可选 transferable 提取器;默认只发送结构化克隆数据。 */
|
|
128
|
-
transferForRequest?: (request: unknown, context: RemoteServiceCallContext) => readonly Transferable[];
|
|
129
|
-
/** dispose 时是否关闭端口;默认不关闭,由端口所有者决定。 */
|
|
130
|
-
closeOnDispose?: boolean;
|
|
131
|
-
/** wire 消息 codec;默认使用 webloom.remote-service.*。 */
|
|
132
|
-
codec?: RemoteServiceMessageCodec;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 创建一个真实 MessagePort 传输。
|
|
136
|
-
*
|
|
137
|
-
* 返回对象的 `dispose()` 只关闭本端请求表和监听器;默认不关闭端口,
|
|
138
|
-
* 以免误伤同一端口上的握手 / 快照订阅。需要独占端口时可显式设置
|
|
139
|
-
* `closeOnDispose: true`。
|
|
140
|
-
*/
|
|
141
|
-
declare function createMessagePortServiceTransport(options: CreateMessagePortServiceTransportOptions): RemoteServiceTransport & {
|
|
142
|
-
dispose(): void;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 资源注册表实现
|
|
147
|
-
*
|
|
148
|
-
* 设计缘由:管理资源定义的注册和查询,支持 owner-aware 生命周期。
|
|
149
|
-
* 重复 id 抛错,disable 时可回收。
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
|
-
/** 资源注册表实现 */
|
|
153
|
-
declare function createResourceRegistry(): ResourceRegistry;
|
|
154
|
-
/** Internal runtime hook; deliberately absent from ResourceRegistry's public type. */
|
|
155
|
-
declare function registerOwnedResource(registry: ResourceRegistry, ownerId: string, definition: ResourceDefinition<any, any>): void;
|
|
156
|
-
|
|
157
|
-
export { type CreateMessagePortServiceTransportOptions as C, type RemoteServicePortCallMessage as R, type CreatePluginIntentControllerOptions as a, type CreateResourceScopeOptions as b, type CreateServiceBridgeOptions as c, type RemoteServicePortCancelMessage as d, type RemoteServicePortErrorMessage as e, type RemoteServicePortResponseMessage as f, type RemoteServicePortResultMessage as g, type ResourceScopeOptions as h, type RuntimeUnitImplementation as i, createLifecycleScope as j, createMessageBus as k, createMessagePortServiceTransport as l, createPluginIntentController as m, createRemoteServiceBridge as n, createResourceRegistry as o, createResourceScope as p, createRuntimeUnitImplementationRegistry as q, createServiceBridge as r, registerOwnedResource as s };
|