-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.ts
More file actions
89 lines (74 loc) · 2.85 KB
/
Copy pathmod.ts
File metadata and controls
89 lines (74 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Embedder conventions layer (contracts/embedder-api.md; docs/consumers.md).
//
// The host-facing surface: camelCase facades, resource classes on both sides,
// stream/future handles, version-canonical import resolution and the branded
// error model, built from the plan's type tables for typed or untyped callers.
// Generated bindings verify their world digest and delegate to this facade.
// Copy registration (contracts/embedder-api.md §"Module identity and
// @polyengine/protocol"; issue #83). Runs at module evaluation, so
// merely importing the embedder surface puts this copy on the census — which
// is what makes every cross-copy diagnostic below able to name both sides.
// Multiple copies are DIAGNOSED, NEVER REFUSED: two isolated bundles on one
// page that exchange no values are legal.
import { PROTOCOL_GENERATION, registerRuntimeCopy } from "@polyengine/protocol";
import { COPY_URL, RUNTIME_VERSION } from "./copy.ts";
registerRuntimeCopy({
// `COPY_URL` (embedder/copy.ts) rather than this module's own
// `import.meta.url`, so the census and every cross-copy message name the
// copy identically — one module owns the identity.
url: COPY_URL,
runtimeVersion: RUNTIME_VERSION,
protocolGeneration: PROTOCOL_GENERATION,
});
export { COPY_URL, RUNTIME_VERSION } from "./copy.ts";
// Application machinery lives here. Host modules import ABI vocabulary
// (errors, brands, suspension marks, realm crossing) from @polyengine/protocol.
export {
artifactsFromEnvelope,
type ComponentArtifacts,
type EmbedderInstance,
type EmbedderOptions,
instantiate,
instantiateEmbedder,
type InstantiateSource,
resolveArtifacts,
type UntranslatedArtifacts,
} from "./instantiate.ts";
export {
type FuncSummary,
type ImportLeaf,
type PlanLike,
requiredImports,
} from "./imports.ts";
// Naming failures belong to facade construction/value adaptation, not host ABI.
export { NameCollisionError } from "./errors.ts";
export { type ElemCodec } from "./streams.ts";
// The application creates pairs; host modules use protocol handle interfaces.
import { Stream as InternalStream } from "./streams.ts";
import type {
Stream as ProtocolStream,
StreamWriter as ProtocolStreamWriter,
} from "@polyengine/protocol";
/** Create a stream/writer pair. Writer operations wait until passing the
* stream to a guest binds its element type. */
export function createStream<T>(): {
stream: ProtocolStream<T>;
writer: ProtocolStreamWriter<T>;
} {
return InternalStream.create<T>();
}
export { GuestResource, HostResourceRegistry } from "./resources.ts";
export { camelCase, pascalCase } from "./casing.ts";
export {
ImportRegistrationError,
ImportResolutionError,
ImportResolver,
} from "./version.ts";
export {
type AdapterOptions,
BorrowScope,
fromHost,
toHost,
type ValueBridge,
} from "./values.ts";
export { type Sync, sync } from "./sync.ts";