@tlockney/cdp-kernel 0.6.0 → 0.7.1
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 +5 -3
- package/dist/browser/channels.d.ts +27 -0
- package/dist/browser/channels.js +90 -0
- package/dist/browser/kernel.js +29800 -0
- package/dist/browser/kernel.js.map +7 -0
- package/dist/browser/mod.d.ts +25 -0
- package/dist/browser/mod.js +41 -0
- package/dist/browser/target.d.ts +94 -0
- package/dist/browser/target.js +264 -0
- package/dist/browser/worker.js +1071 -0
- package/dist/browser/worker.js.map +7 -0
- package/dist/bun-target.d.ts +2 -0
- package/dist/bun-target.js +15 -2
- package/dist/cdp.d.ts +11 -0
- package/dist/cdp.js +34 -7
- package/dist/celld-target.js +3 -2
- package/dist/debugger.d.ts +2 -0
- package/dist/debugger.js +63 -11
- package/dist/kernel-core.d.ts +78 -0
- package/dist/kernel-core.js +824 -0
- package/dist/kernel.d.ts +6 -1
- package/dist/kernel.js +104 -723
- package/dist/main.js +11 -4
- package/dist/message.d.ts +34 -0
- package/dist/message.js +14 -0
- package/dist/package.d.ts +2 -2
- package/dist/package.js +2 -2
- package/dist/target-api.d.ts +92 -0
- package/dist/target-api.js +48 -0
- package/dist/target.d.ts +5 -76
- package/dist/target.js +62 -33
- package/dist/traceback.d.ts +75 -0
- package/dist/traceback.js +200 -0
- package/dist/transform.d.ts +1 -0
- package/dist/transform.js +8 -1
- package/dist/wire.d.ts +4 -24
- package/dist/wire.js +3 -12
- package/dist/workerd-target.d.ts +6 -1
- package/dist/workerd-target.js +56 -12
- package/dist/workers-project.d.ts +1 -1
- package/dist/workers-project.js +4 -3
- package/dist/zmq-channels.d.ts +14 -0
- package/dist/zmq-channels.js +59 -0
- package/package.json +9 -2
- package/runtime/bootstrap.mjs +2 -0
- package/runtime/browser-worker.mjs +202 -0
- package/runtime/cdn.d.mts +2 -0
- package/runtime/cdn.mjs +17 -0
- package/runtime/display.mjs +202 -1
- package/runtime/evaluator.mjs +2 -0
- package/runtime/format.d.mts +2 -0
- package/runtime/format.mjs +125 -0
- package/runtime/workerd-worker.mjs +2 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type JsonObject, type KernelMessage, type OutgoingMessage } from "./message.ts";
|
|
2
|
+
import { type KernelTarget, type TargetEvents } from "./target-api.ts";
|
|
3
|
+
import type { Debugger } from "./debugger.ts";
|
|
4
|
+
import type { CompletionResult } from "./notebook-types.ts";
|
|
5
|
+
import { type CellTransformOptions, type TypeStripper, type TypeStripperName } from "./transform.ts";
|
|
6
|
+
/** The channels a frontend sends requests on. */
|
|
7
|
+
export type ChannelName = "shell" | "control" | "stdin";
|
|
8
|
+
/** A request, and which of the frontend's connections it came on. */
|
|
9
|
+
export interface Received {
|
|
10
|
+
peer: string;
|
|
11
|
+
msg: KernelMessage;
|
|
12
|
+
}
|
|
13
|
+
/** How messages reach the kernel and leave it: ZeroMQ (src/zmq-channels.ts), or a page (src/browser/). */
|
|
14
|
+
export interface KernelChannels {
|
|
15
|
+
/** Settles once every channel can carry messages. */
|
|
16
|
+
readonly ready: Promise<unknown>;
|
|
17
|
+
/** The next message on a channel; null for one that is dropped (malformed, or unsigned). */
|
|
18
|
+
recv(channel: ChannelName): Promise<Received | null>;
|
|
19
|
+
/** Shell messages received but not yet taken by recv. */
|
|
20
|
+
shellQueued(): number;
|
|
21
|
+
reply(channel: ChannelName, peer: string, msg: OutgoingMessage): void;
|
|
22
|
+
publish(msg: OutgoingMessage): void;
|
|
23
|
+
/** How many frontends listen on stdin. */
|
|
24
|
+
stdinPeers(): number;
|
|
25
|
+
/** To every frontend listening on stdin. */
|
|
26
|
+
sendStdin(msg: OutgoingMessage): void;
|
|
27
|
+
}
|
|
28
|
+
/** Typed completion and tooltips (src/language-service.ts). */
|
|
29
|
+
export interface TypeService {
|
|
30
|
+
reset(): void;
|
|
31
|
+
addCell(code: string): void;
|
|
32
|
+
complete(code: string, cursor: number): Promise<CompletionResult | null>;
|
|
33
|
+
quickInfo(code: string, cursor: number): Promise<string | null>;
|
|
34
|
+
}
|
|
35
|
+
/** What a KernelCore gets from the process it runs in. */
|
|
36
|
+
export interface KernelHost {
|
|
37
|
+
/** The target's name, for the banner and messages. */
|
|
38
|
+
readonly runtime: string;
|
|
39
|
+
readonly version: string;
|
|
40
|
+
/** The TypeScript version cells are checked against; TYPESCRIPT_VERSION if not given. */
|
|
41
|
+
readonly languageVersion?: string;
|
|
42
|
+
readonly channels: KernelChannels;
|
|
43
|
+
launchTarget(events: TargetEvents): Promise<KernelTarget>;
|
|
44
|
+
/** What strips cells' types; esbuild by default (#238). */
|
|
45
|
+
readonly typeStrip?: TypeStripperName | TypeStripper;
|
|
46
|
+
/** A project's transform settings, e.g. a deno.json's JSX options (#13). */
|
|
47
|
+
readonly transform?: CellTransformOptions;
|
|
48
|
+
/** Shown once, in the first cell: e.g. why a project config wasn't used. */
|
|
49
|
+
readonly warning?: string | null;
|
|
50
|
+
readonly types?: TypeService | null;
|
|
51
|
+
/** Returned as `capabilities` in kernel_info_reply, when set: what the host offers cells (#384). */
|
|
52
|
+
readonly capabilities?: JsonObject;
|
|
53
|
+
/** JupyterLab's visual debugger, for targets driven over CDP (#18). */
|
|
54
|
+
createDebugger?(publish: (event: JsonObject) => void, transformOptions: () => CellTransformOptions): Debugger;
|
|
55
|
+
/** A file's source, for the lines around a traceback frame (#322). */
|
|
56
|
+
readSource?(file: string): string | undefined;
|
|
57
|
+
/** Path or URL prefixes of the kernel's own runtime files, whose frames a traceback marks as library code. */
|
|
58
|
+
readonly kernelFiles?: readonly string[];
|
|
59
|
+
log(text: string): void;
|
|
60
|
+
/** After shutdown_reply has gone out. */
|
|
61
|
+
exit(): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* kernel_info's language_info.version when the host doesn't know the
|
|
65
|
+
* installed TypeScript's: the major version package.json depends on.
|
|
66
|
+
*/
|
|
67
|
+
export declare const TYPESCRIPT_VERSION = "6";
|
|
68
|
+
export declare class KernelCore {
|
|
69
|
+
#private;
|
|
70
|
+
constructor(host: KernelHost);
|
|
71
|
+
run(): Promise<void>;
|
|
72
|
+
/** What SIGINT does: interrupt the cell, or the prompt it waits on. */
|
|
73
|
+
interrupt(): Promise<void>;
|
|
74
|
+
/** The process is exiting: a target that exits now isn't reported. */
|
|
75
|
+
stopping(): void;
|
|
76
|
+
/** A state dump, for a kernel that has stopped answering (#237). */
|
|
77
|
+
logState(): Promise<void>;
|
|
78
|
+
}
|