@tlockney/cdp-kernel 0.10.0 → 0.12.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/dist/browser/kernel.js +8 -2
- package/dist/browser/kernel.js.map +2 -2
- package/dist/browser/mod.d.ts +11 -0
- package/dist/browser/mod.js +11 -0
- package/dist/browser/target.d.ts +10 -0
- package/dist/browser/target.js +1 -1
- package/dist/browser/worker.js +1121 -77
- package/dist/browser/worker.js.map +4 -4
- package/dist/package.d.ts +3 -3
- package/dist/package.js +6 -2
- package/dist/workerd-target.js +1 -1
- package/package.json +1 -1
- package/runtime/browser-worker.mjs +6 -3
- package/runtime/cdn.d.mts +6 -1
- package/runtime/cdn.mjs +7 -2
- package/runtime/chart.d.mts +23 -0
- package/runtime/chart.mjs +359 -0
- package/runtime/display.d.mts +193 -68
- package/runtime/display.mjs +47 -67
- package/runtime/host.d.mts +7 -5
- package/runtime/sql.d.mts +147 -0
- package/runtime/sql.mjs +426 -0
- package/runtime/table-paging.d.mts +19 -0
- package/runtime/table-paging.mjs +183 -0
- package/runtime/table.d.mts +53 -0
- package/runtime/table.mjs +495 -0
- package/runtime/widget.d.mts +3 -3
package/dist/browser/mod.d.ts
CHANGED
|
@@ -4,6 +4,17 @@ import { type Channel, type JupyterMessage, type MessageListener } from "./chann
|
|
|
4
4
|
import { type BrowserTargetOptions } from "./target.ts";
|
|
5
5
|
export type { Channel, JupyterMessage, MessageListener } from "./channels.ts";
|
|
6
6
|
export { BrowserTarget, type BrowserTargetOptions, type HostHandler, type HostRequest, type WorkerLike } from "./target.ts";
|
|
7
|
+
/**
|
|
8
|
+
* The packages `jupyter.chart` imports, as it writes them: map them in
|
|
9
|
+
* `modules` to copies the page serves, and charts draw offline. The page
|
|
10
|
+
* serves ES modules that export what the packages do. Same as
|
|
11
|
+
* runtime/chart.mjs's VEGA, VEGA_LITE and LINKEDOM.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CHART_MODULES: {
|
|
14
|
+
readonly vega: "npm:vega@6";
|
|
15
|
+
readonly vegaLite: "npm:vega-lite@6";
|
|
16
|
+
readonly linkedom: "npm:linkedom@0.18";
|
|
17
|
+
};
|
|
7
18
|
export interface BrowserKernelOptions extends BrowserTargetOptions {
|
|
8
19
|
/** What strips cells' types; sucrase by default, since esbuild's native binary can't run in a page. */
|
|
9
20
|
typeStrip?: TypeStripperName | TypeStripper;
|
package/dist/browser/mod.js
CHANGED
|
@@ -15,6 +15,17 @@ import { VERSION } from "../package.js";
|
|
|
15
15
|
import { PageChannels } from "./channels.js";
|
|
16
16
|
import { BrowserTarget } from "./target.js";
|
|
17
17
|
export { BrowserTarget } from "./target.js";
|
|
18
|
+
/**
|
|
19
|
+
* The packages `jupyter.chart` imports, as it writes them: map them in
|
|
20
|
+
* `modules` to copies the page serves, and charts draw offline. The page
|
|
21
|
+
* serves ES modules that export what the packages do. Same as
|
|
22
|
+
* runtime/chart.mjs's VEGA, VEGA_LITE and LINKEDOM.
|
|
23
|
+
*/
|
|
24
|
+
export const CHART_MODULES = {
|
|
25
|
+
vega: "npm:vega@6",
|
|
26
|
+
vegaLite: "npm:vega-lite@6",
|
|
27
|
+
linkedom: "npm:linkedom@0.18",
|
|
28
|
+
};
|
|
18
29
|
export function startBrowserKernel(options) {
|
|
19
30
|
const channels = new PageChannels();
|
|
20
31
|
const log = options.log ?? ((text) => console.debug(`[cdp-kernel] ${text}`));
|
package/dist/browser/target.d.ts
CHANGED
|
@@ -22,6 +22,16 @@ export interface BrowserTargetOptions {
|
|
|
22
22
|
base?: string;
|
|
23
23
|
/** Where npm:, jsr: and bare imports load from; esm.sh by default. */
|
|
24
24
|
cdn?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Specifiers, as written, mapped to URLs the page serves (resolved
|
|
27
|
+
* against `base`), which win over `cdn`: a cell's imports and the
|
|
28
|
+
* libraries `jupyter.chart` and `jupyter.sql` import load from there.
|
|
29
|
+
* Mapping `CHART_MODULES` makes charts draw offline; `jupyter.sql` still
|
|
30
|
+
* loads DuckDB's worker and .wasm from jsDelivr.
|
|
31
|
+
*/
|
|
32
|
+
modules?: {
|
|
33
|
+
readonly [specifier: string]: string;
|
|
34
|
+
};
|
|
25
35
|
/**
|
|
26
36
|
* Modules the Worker imports before the first cell, each time it starts,
|
|
27
37
|
* resolved against `base`. A module's default export, if a function, is
|
package/dist/browser/target.js
CHANGED
|
@@ -49,7 +49,7 @@ export class BrowserTarget {
|
|
|
49
49
|
const base = options.base ?? globalThis.location?.href ?? "file:///";
|
|
50
50
|
try {
|
|
51
51
|
const params = options.params === undefined ? undefined : JSON.stringify(options.params);
|
|
52
|
-
const { userAgent } = await target.#request("info", { base, cdn: options.cdn, preload: options.preload ?? [], params });
|
|
52
|
+
const { userAgent } = await target.#request("info", { base, cdn: options.cdn, modules: options.modules, preload: options.preload ?? [], params });
|
|
53
53
|
if (typeof userAgent === "string")
|
|
54
54
|
target.versions.runtime = browserName(userAgent);
|
|
55
55
|
target.versions.engine = engineName(typeof userAgent === "string" ? userAgent : "");
|