@proteus-vue/render-backend 0.1.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 +75 -0
- package/dist/basic-containers.d.ts +87 -0
- package/dist/borrow-checker.d.ts +21 -0
- package/dist/conformance-component.d.ts +32 -0
- package/dist/conformance.d.ts +18 -0
- package/dist/container-conformance.d.ts +53 -0
- package/dist/container-spi.d.ts +169 -0
- package/dist/dispatcher.d.ts +98 -0
- package/dist/flutter.d.ts +16 -0
- package/dist/headless.d.ts +12 -0
- package/dist/host-conformance.d.ts +71 -0
- package/dist/host-matrix.d.ts +74 -0
- package/dist/hot-switch.d.ts +24 -0
- package/dist/hybrid.d.ts +60 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +4291 -0
- package/dist/native.d.ts +42 -0
- package/dist/ownership-observability.d.ts +99 -0
- package/dist/ownership.d.ts +206 -0
- package/dist/page-ownership.d.ts +55 -0
- package/dist/pss.d.ts +54 -0
- package/dist/spi.d.ts +73 -0
- package/dist/stack-container.d.ts +43 -0
- package/dist/superapp-container.d.ts +47 -0
- package/dist/vue-bridge.d.ts +22 -0
- package/dist/vue-dom.d.ts +6 -0
- package/dist/web-host.d.ts +35 -0
- package/package.json +30 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createVueDomBackend } from './vue-dom';
|
|
2
|
+
import type { ProteusRenderBackend } from './spi';
|
|
3
|
+
export type HostId = 'web' | 'ios' | 'android' | 'harmony' | 'flutter' | 'miniprogram';
|
|
4
|
+
export type EngineId = 'vue-dom' | 'headless' | 'native-ios' | 'native-android' | 'native-harmony' | 'flutter';
|
|
5
|
+
/** Tier:1 = 承诺验证(一等公民组合)/ 3 = 混入可行不承诺(Tier 3 自绘/嵌入)/ 0 = 不合法跨生态组合 */
|
|
6
|
+
export type ComboTier = 0 | 1 | 3;
|
|
7
|
+
export declare const HOSTS: readonly HostId[];
|
|
8
|
+
export declare const ENGINES: readonly EngineId[];
|
|
9
|
+
/**
|
|
10
|
+
* ★G-41 B6:宿主 × 引擎 Tier 矩阵(G-30 接入侧声明)。
|
|
11
|
+
* Tier 1 原则:宿主的原生引擎 + headless(SSR/测试/Agent 通用验证引擎)+ 混入自然的自绘(iOS/Android + Flutter);
|
|
12
|
+
* 跨生态原生引擎(如 web + native-ios)= 0 不合法;可行但不承诺的组合 = 3(Tier 3 自绘/嵌入混入)。
|
|
13
|
+
*/
|
|
14
|
+
export declare const HOST_ENGINE_MATRIX: Record<HostId, Record<EngineId, ComboTier>>;
|
|
15
|
+
export interface MatrixCombo {
|
|
16
|
+
readonly host: HostId;
|
|
17
|
+
readonly engine: EngineId;
|
|
18
|
+
readonly tier: ComboTier;
|
|
19
|
+
}
|
|
20
|
+
export declare function matrixCombos(filter?: {
|
|
21
|
+
tier?: ComboTier;
|
|
22
|
+
}): MatrixCombo[];
|
|
23
|
+
export declare function createEngine(engine: EngineId, documentLike?: Parameters<typeof createVueDomBackend>[0]): ProteusRenderBackend;
|
|
24
|
+
export interface ComboCheck {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
readonly message?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ComboConformanceResult {
|
|
30
|
+
readonly host: HostId;
|
|
31
|
+
readonly engine: EngineId;
|
|
32
|
+
readonly ok: boolean;
|
|
33
|
+
readonly total: number;
|
|
34
|
+
readonly failed: number;
|
|
35
|
+
readonly checks: readonly ComboCheck[];
|
|
36
|
+
}
|
|
37
|
+
export interface ComboConformanceOptions {
|
|
38
|
+
/** vue-dom 引擎的 document 注入(缺省全局 document——happy-dom/浏览器可用) */
|
|
39
|
+
documentLike?: Parameters<typeof createVueDomBackend>[0];
|
|
40
|
+
}
|
|
41
|
+
/** ★G-41 B6:单组合 conformance(宿主×引擎×框架三方正交性的机器验证——failed === 0 准入) */
|
|
42
|
+
export interface ComboConformanceOptions {
|
|
43
|
+
/** vue-dom 引擎的 document 注入(缺省全局 document——happy-dom/浏览器可用) */
|
|
44
|
+
documentLike?: Parameters<typeof createVueDomBackend>[0];
|
|
45
|
+
}
|
|
46
|
+
export declare function runComboConformance(opts: {
|
|
47
|
+
host: HostId;
|
|
48
|
+
engine: EngineId;
|
|
49
|
+
} & ComboConformanceOptions): Promise<ComboConformanceResult>;
|
|
50
|
+
export interface MatrixRow {
|
|
51
|
+
readonly host: HostId;
|
|
52
|
+
readonly engine: EngineId;
|
|
53
|
+
readonly tier: ComboTier;
|
|
54
|
+
/** tier 1 组合:验证结果;tier 0/3:未验证(null) */
|
|
55
|
+
readonly result: ComboConformanceResult | null;
|
|
56
|
+
}
|
|
57
|
+
export interface MatrixReport {
|
|
58
|
+
readonly totalCombos: number;
|
|
59
|
+
readonly tier1Combos: number;
|
|
60
|
+
readonly verified: number;
|
|
61
|
+
readonly failed: number;
|
|
62
|
+
readonly rows: readonly MatrixRow[];
|
|
63
|
+
}
|
|
64
|
+
export interface MatrixOptions extends ComboConformanceOptions {
|
|
65
|
+
/** 只跑指定宿主/引擎(调试用) */
|
|
66
|
+
only?: {
|
|
67
|
+
host?: HostId;
|
|
68
|
+
engine?: EngineId;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** ★G-41 B6:跑宿主×引擎矩阵——全部 Tier 1 组合验证(failed === 0 准入;Tier 0/3 诚实标注未验证) */
|
|
72
|
+
export declare function runHostEngineMatrix(opts?: MatrixOptions): Promise<MatrixReport>;
|
|
73
|
+
/** ★G-41 B6:矩阵报告(面板/CLI 文本形态) */
|
|
74
|
+
export declare function formatMatrixReport(report: MatrixReport): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IRNode, NodeHandle, ProteusRenderBackend } from './spi';
|
|
2
|
+
import type { HotSwitchStrategy, ProteusNodeOpsDispatcher } from './dispatcher';
|
|
3
|
+
export interface HotSwitchOptions {
|
|
4
|
+
strategy?: HotSwitchStrategy;
|
|
5
|
+
/** 切换前钩子(旧树清理/状态保存) */
|
|
6
|
+
onBeforeSwitch?: (from: ProteusRenderBackend, to: ProteusRenderBackend) => void;
|
|
7
|
+
/** 切换后钩子(挂载引用替换/新树就绪通知) */
|
|
8
|
+
onAfterSwitch?: (from: ProteusRenderBackend, to: ProteusRenderBackend, root: NodeHandle | null) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface BackendSwitcher {
|
|
11
|
+
readonly dispatch: ProteusNodeOpsDispatcher;
|
|
12
|
+
/** 当前活跃 IR(业务状态载体——rehydrate 的「保状态」来源;null = 未挂载) */
|
|
13
|
+
readonly currentIR: IRNode | null;
|
|
14
|
+
/** 当前渲染根(rehydrate 后为新后端重建的树;rebuild/hybrid 后为 null——由调用方处置) */
|
|
15
|
+
readonly root: NodeHandle | null;
|
|
16
|
+
/** 首次挂载:在 dispatch.currentBackend 上建树 */
|
|
17
|
+
mount(ir: IRNode): NodeHandle;
|
|
18
|
+
/** 生产级热切换:策略下处理已渲染节点;返回新 root(rehydrate)或 null(rebuild/hybrid) */
|
|
19
|
+
switchBackend(next: ProteusRenderBackend, opts?: HotSwitchOptions): NodeHandle | null;
|
|
20
|
+
/** 清理活跃引用 */
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
/** ★G-41 B5:生产级热切换管理器 */
|
|
24
|
+
export declare function createBackendSwitcher(dispatch: ProteusNodeOpsDispatcher): BackendSwitcher;
|
package/dist/hybrid.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BackendId, IRNode, NodeHandle, ProteusRenderBackend } from './spi';
|
|
2
|
+
/** 区域路由(match 命中 → 该后端渲染此节点子树) */
|
|
3
|
+
export interface HybridRegion {
|
|
4
|
+
/** 区域名(DevTools trace 展示) */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** 节点匹配(semantic/type 判定——页面级/区域级切后端) */
|
|
7
|
+
match(node: IRNode): boolean;
|
|
8
|
+
backend: ProteusRenderBackend;
|
|
9
|
+
}
|
|
10
|
+
export interface HybridRendererOptions {
|
|
11
|
+
/** 缺省后端(region 未命中 → 兜底) */
|
|
12
|
+
defaultBackend: ProteusRenderBackend;
|
|
13
|
+
/** 区域路由表(按序首中即用) */
|
|
14
|
+
regions?: HybridRegion[];
|
|
15
|
+
/** 是否记录路由 trace(DevTools 可视化;缺省 true) */
|
|
16
|
+
devtools?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** DevTools 路由决策记录(每 createElement 一条) */
|
|
19
|
+
export interface HybridRouteTrace {
|
|
20
|
+
/** IR 语义(可空——兼容层标签) */
|
|
21
|
+
semantic?: string;
|
|
22
|
+
type: string;
|
|
23
|
+
/** 命中后端 id */
|
|
24
|
+
backendId: BackendId;
|
|
25
|
+
/** 命中区域(缺省路由 → 'default') */
|
|
26
|
+
region: string;
|
|
27
|
+
}
|
|
28
|
+
/** 混合渲染器(统一 ProteusRenderBackend 面 + 混合专属能力) */
|
|
29
|
+
export interface HybridRenderer extends ProteusRenderBackend {
|
|
30
|
+
/** 节点 → 归属后端(路由决策——子节点可跨后端) */
|
|
31
|
+
routeFor(node: IRNode): ProteusRenderBackend;
|
|
32
|
+
/** 节点句柄 → 归属后端(委托用) */
|
|
33
|
+
backendOf(handle: NodeHandle): ProteusRenderBackend | undefined;
|
|
34
|
+
/** DevTools 路由 trace(累积;clearTraces 清空) */
|
|
35
|
+
traces(): HybridRouteTrace[];
|
|
36
|
+
clearTraces(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* ★createHybridRenderer:混合渲染器工厂
|
|
40
|
+
* 用法:const hybrid = createHybridRenderer({ defaultBackend: vueDom, regions: [{ name: 'video', match: (n) => n.semantic === 'ui.media', backend: native }] })
|
|
41
|
+
* 设计:createElement 路由 → 归属后端;其余 nodeOps 委托归属后端(父子跨后端合法——混合渲染核心);
|
|
42
|
+
* 纹理共享:registerExternalTexture 广播到所有 textureSharing 后端(同一 id 全局可引用)
|
|
43
|
+
*/
|
|
44
|
+
export declare function createHybridRenderer(options: HybridRendererOptions): HybridRenderer;
|
|
45
|
+
/** 纹理引用(跨后端 patchProp 用——注册 id → 纹理) */
|
|
46
|
+
export interface HybridTextureRef {
|
|
47
|
+
textureId: string;
|
|
48
|
+
}
|
|
49
|
+
/** 便捷:构造纹理引用 prop 值(后端 patchProp 可识别) */
|
|
50
|
+
export declare function textureRef(textureId: string): HybridTextureRef;
|
|
51
|
+
/** ★B6 conformance:混合渲染器自检(对齐 runBackendConformance 形状) */
|
|
52
|
+
export interface HybridConformanceResult {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
checks: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
pass: boolean;
|
|
57
|
+
detail?: string;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
export declare function runHybridConformance(renderer: HybridRenderer): HybridConformanceResult;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type { BackendId, BackendCapabilities, IRNode, NodeHandle, LayoutConstraints, Size, NormalizedInputEvent, ExternalTexture, ProteusRenderBackend, } from './spi';
|
|
2
|
+
export { runBackendConformance } from './conformance';
|
|
3
|
+
export type { ConformanceCheck, ConformanceResult } from './conformance';
|
|
4
|
+
export { createHeadlessBackend, toPlainTree } from './headless';
|
|
5
|
+
export type { HeadlessNode } from './headless';
|
|
6
|
+
export { createVueDomBackend } from './vue-dom';
|
|
7
|
+
export { createNativeBackend, createMockNativeAdapter } from './native';
|
|
8
|
+
export type { NativeViewDescriptor, NativeViewAdapter, MockNativeAdapter, NativePlatform } from './native';
|
|
9
|
+
export { createFlutterBackend, mapWidgetType, toWidgetTree } from './flutter';
|
|
10
|
+
export type { FlutterWidgetDescriptor } from './flutter';
|
|
11
|
+
export { renderComponentSnapshot, createControlReader } from './conformance-component';
|
|
12
|
+
export type { RenderNodeSnapshot, ControlReader } from './conformance-component';
|
|
13
|
+
export { createHybridRenderer, textureRef, runHybridConformance } from './hybrid';
|
|
14
|
+
export type { HybridRegion, HybridRendererOptions, HybridRouteTrace, HybridRenderer, HybridTextureRef, HybridConformanceResult } from './hybrid';
|
|
15
|
+
export { createNodeOpsDispatcher, renderIRTree, semanticSequence, DispatcherError } from './dispatcher';
|
|
16
|
+
export type { ProteusNodeOpsDispatcher, DispatcherNodeOps, NodeOpsCall, HotSwitchStrategy } from './dispatcher';
|
|
17
|
+
export { runHostConformance, formatHostConformance, createHostRuntimeStub, createCarrierStub } from './host-conformance';
|
|
18
|
+
export type { HostConformanceResult, HostConformanceSummary, HostConformanceOptions, HostRuntimeLike, CarrierLike } from './host-conformance';
|
|
19
|
+
export { createVueRendererOptions, createProteusRenderer, createProteusRendererForBackend } from './vue-bridge';
|
|
20
|
+
export type { ProteusRenderer } from './vue-bridge';
|
|
21
|
+
export { createWebHostRuntime } from './web-host';
|
|
22
|
+
export type { WebHostRuntime, WebWorkerHandle, WebHostOptions } from './web-host';
|
|
23
|
+
export { createBackendSwitcher } from './hot-switch';
|
|
24
|
+
export type { BackendSwitcher, HotSwitchOptions } from './hot-switch';
|
|
25
|
+
export { CONTAINER_PROFILES, PAGE_STATE_TRANSITIONS, canTransitionPageState, FIVE_ATOMIC_STEPS, assertAtomicDestroy, createDestroyReport, DEFAULT_STACK_POLICY, profileOfContainer, } from './container-spi';
|
|
26
|
+
export type { ContainerCapabilities, PageState, PageHandle, ResourcePool, DestroyReport, DestroyStep, QuotaManager, QuotaHandle, QuotaUsage, PressureLevel, StackPolicy, SuperAppPolicy, BizManifest, BusinessSandbox, ContainerContext, ContainerEvent, ProteusHostContainer, } from './container-spi';
|
|
27
|
+
export { createStackContainer, createResourcePool, createQuotaManager } from './stack-container';
|
|
28
|
+
export type { StackContainer, StackContainerOptions } from './stack-container';
|
|
29
|
+
export { runContainerConformance, formatContainerConformance, scanRepoForFork, checkBizManifest, checkCapabilityAuthorization, FORK_SIGNATURES, SENSITIVE_CAPABILITIES } from './container-conformance';
|
|
30
|
+
export type { ContainerConformanceResult, ContainerConformanceSummary, ForkHit } from './container-conformance';
|
|
31
|
+
export { createSuperAppContainer } from './superapp-container';
|
|
32
|
+
export type { SuperAppContainer, SuperAppOptions, SuperSandbox, SandboxExecutionResult } from './superapp-container';
|
|
33
|
+
export { createSinglePageContainer, createEmbeddedContainer, createWindowContainer, createMiniProgramContainer } from './basic-containers';
|
|
34
|
+
export type { SinglePageContainer, EmbeddedContainer, WindowContainer, WindowContainerOptions, MiniProgramContainer, MiniProgramContainerOptions, MiniProgramTabConfig, MiniProgramSandbox, } from './basic-containers';
|
|
35
|
+
export { OwnershipGraph, Owned, Borrow, Weak, Managed, ManagedRegistry, createQuotaTracker, OWNERSHIP_ERRORS, OwnershipError, getProteusOwnershipGraph } from './ownership';
|
|
36
|
+
export type { OwnedState, GraphNode, GraphEdge, LeakInfo, OwnershipErrorCode } from './ownership';
|
|
37
|
+
export { analyzeOwnershipSource } from './borrow-checker';
|
|
38
|
+
export type { BorrowDiagnostic, BorrowAnalysisResult, BorrowRule, BorrowSeverity, PssMode, BorrowCheckerOptions } from './borrow-checker';
|
|
39
|
+
export { createPageOwnership } from './page-ownership';
|
|
40
|
+
export type { PageOwnership, PageOwnershipOptions, PageAllocOptions, PageOwnershipDestroyReport } from './page-ownership';
|
|
41
|
+
export { createOwnershipHistory, createOwnershipCounters, diagnoseOwnershipIssues, buildOwnershipTimeline, formatOwnershipDiagnosis } from './ownership-observability';
|
|
42
|
+
export type { OwnershipHistory, OwnershipHistoryOptions, OwnershipRecord, OwnershipRecordKind, OwnershipCounters, TypeCounter, OwnershipDiagnosis, OwnershipDiagnosisOptions, LongBorrow, CrossPageRef, OwnershipTimeline, TimelineEvent, } from './ownership-observability';
|
|
43
|
+
export type { OwnershipMutation } from './ownership';
|
|
44
|
+
export { resolvePssMode, analyzePss, insertScopeDrops, runPss } from './pss';
|
|
45
|
+
export type { PssRule, PssDiagnostic, PssAnalysisResult, PssAnalysisOptions, ScopeDropInsertion, ScopeDropResult, PssPipelineOptions, PssPipelineResult } from './pss';
|
|
46
|
+
export type { OwnedStateListener } from './ownership';
|
|
47
|
+
export { HOSTS, ENGINES, HOST_ENGINE_MATRIX, matrixCombos, createEngine, runComboConformance, runHostEngineMatrix, formatMatrixReport } from './host-matrix';
|
|
48
|
+
export type { HostId, EngineId, ComboTier, MatrixCombo, ComboCheck, ComboConformanceResult, ComboConformanceOptions, MatrixRow, MatrixReport, MatrixOptions, } from './host-matrix';
|