@observablehq/notebook-kit 1.9.0 → 1.9.2

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/observablehq/notebook-kit.git"
7
7
  },
8
- "version": "1.9.0",
8
+ "version": "1.9.2",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "test": "vitest",
@@ -14,6 +14,12 @@ export type TranspiledJavaScript = {
14
14
  autoview?: boolean;
15
15
  /** whether to implicitly derive a mutable; requires mutable output */
16
16
  automutable?: boolean;
17
+ /** the names of any referenced files */
18
+ files?: Set<string>;
19
+ /** the names of any referenced databases */
20
+ databases?: Set<string>;
21
+ /** the names of any referenced secrets */
22
+ secrets?: Set<string>;
17
23
  };
18
24
  export type TranspileOptions = {
19
25
  /** If true, resolve local imports paths relative to document.baseURI. */
@@ -60,5 +60,8 @@ export function transpileJavaScript(input, options) {
60
60
  output.insertRight(input.length, "\n}");
61
61
  const body = String(output);
62
62
  const autodisplay = cell.expression && !(inputs.includes("display") || inputs.includes("view"));
63
- return { body, inputs, outputs, autodisplay };
63
+ const files = new Set(cell.files.map((f) => f.argument));
64
+ const databases = new Set(cell.databases.map((f) => f.argument));
65
+ const secrets = new Set(cell.secrets.map((f) => f.argument));
66
+ return { body, inputs, outputs, autodisplay, files, databases, secrets };
64
67
  }
@@ -18,113 +18,7 @@ export declare class NotebookRuntime {
18
18
  fileAttachments: typeof fileAttachments;
19
19
  };
20
20
  readonly main: Module;
21
- constructor(builtins?: {
22
- aapl: () => Promise<any>;
23
- alphabet: () => Promise<any>;
24
- cars: () => Promise<any>;
25
- citywages: () => Promise<any>;
26
- diamonds: () => Promise<any>;
27
- flare: () => Promise<any>;
28
- industries: () => Promise<any>;
29
- miserables: () => Promise<any>;
30
- olympians: () => Promise<any>;
31
- penguins: () => Promise<any>;
32
- pizza: () => Promise<any>;
33
- weather: () => Promise<any>;
34
- _: () => Promise<any>;
35
- aq: () => Promise<any>;
36
- Arrow: () => Promise<any>;
37
- d3: () => Promise<any>;
38
- dot: () => Promise<import("./stdlib/template.js").RawTemplateRenderer>;
39
- duckdb: () => Promise<any>;
40
- DuckDBClient: () => Promise<typeof import("./stdlib/duckdb.js").DuckDBClient>;
41
- echarts: () => Promise<any>;
42
- htl: () => Promise<any>;
43
- html: () => Promise<any>;
44
- svg: () => Promise<any>;
45
- Inputs: () => Promise<typeof import("./stdlib/inputs.js")>;
46
- L: () => Promise<typeof import("./stdlib/leaflet.js")>;
47
- mapboxgl: () => Promise<any>;
48
- md: () => Promise<import("./stdlib/template.js").TemplateRenderer>;
49
- mermaid: () => Promise<import("./stdlib/template.js").AsyncRawTemplateRenderer>;
50
- Plot: () => Promise<any>;
51
- React: () => Promise<any>;
52
- ReactDOM: () => Promise<any>;
53
- tex: () => Promise<import("./stdlib/template.js").RawTemplateRenderer & {
54
- options: (options?: any) => import("./stdlib/template.js").RawTemplateRenderer;
55
- block: import("./stdlib/template.js").RawTemplateRenderer;
56
- }>;
57
- topojson: () => Promise<any>;
58
- vl: () => Promise<any>;
59
- dark: () => ObservableAsyncGenerator<boolean>;
60
- now: () => AsyncGenerator<number, void, unknown>;
61
- width: () => ObservableAsyncGenerator<number>;
62
- DatabaseClient: () => {
63
- (name: string, options?: import("./stdlib/databaseClient.js").QueryOptionsSpec): import("./stdlib/databaseClient.js").DatabaseClient;
64
- revive: ({ rows, schema, date, ...meta }: import("../databases/index.js").SerializableQueryResult) => import("./stdlib/databaseClient.js").QueryResult;
65
- prototype: {
66
- readonly name: string;
67
- readonly options: import("./stdlib/databaseClient.js").QueryOptions;
68
- sql(strings: readonly string[], ...params: import("./stdlib/databaseClient.js").QueryParam[]): Promise<import("./stdlib/databaseClient.js").QueryResult>;
69
- cachePath(strings: readonly string[], ...params: import("./stdlib/databaseClient.js").QueryParam[]): Promise<string>;
70
- };
71
- };
72
- FileAttachment: () => {
73
- (name: string, base?: string): import("./stdlib/fileAttachment.js").FileAttachment;
74
- prototype: {
75
- href: string;
76
- name: string;
77
- mimeType: string;
78
- lastModified: number | undefined;
79
- size: number | undefined;
80
- url(): Promise<string>;
81
- blob(): Promise<Blob>;
82
- arrayBuffer(): Promise<ArrayBuffer>;
83
- text(encoding?: string): Promise<string>;
84
- json(): Promise<any>;
85
- stream(): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
86
- dsv({ delimiter, array, typed }?: {
87
- delimiter?: string | undefined;
88
- array?: boolean | undefined;
89
- typed?: boolean | undefined;
90
- }): Promise<import("./stdlib/fileAttachment.js").DsvResult>;
91
- csv(options?: Omit<import("./stdlib/fileAttachment.js").DsvOptions, "delimiter">): Promise<import("./stdlib/fileAttachment.js").DsvResult>;
92
- tsv(options?: Omit<import("./stdlib/fileAttachment.js").DsvOptions, "delimiter">): Promise<import("./stdlib/fileAttachment.js").DsvResult>;
93
- image(props?: Partial<HTMLImageElement>): Promise<HTMLImageElement>;
94
- arrow(): Promise<any>;
95
- arquero(options?: any): Promise<any>;
96
- parquet(): Promise<any>;
97
- zip(): Promise<import("./stdlib/zip.js").ZipArchive>;
98
- xml(mimeType?: DOMParserSupportedType): Promise<Document>;
99
- html(): Promise<Document>;
100
- xlsx(): Promise<import("./stdlib/xlsx.js").Workbook>;
101
- };
102
- };
103
- Generators: () => typeof import("./stdlib/generators/index.js");
104
- Interpreter: () => {
105
- (name: string, options?: import("./stdlib/interpreter.js").InterpreterOptionsSpec): import("./stdlib/interpreter.js").Interpreter;
106
- prototype: {
107
- readonly name: string;
108
- readonly options: import("./stdlib/interpreter.js").InterpreterOptions;
109
- run(input: string): Promise<import("./stdlib/fileAttachment.js").FileAttachment>;
110
- cachePath(input: string): Promise<string>;
111
- };
112
- };
113
- Mutable: () => typeof import("./stdlib/mutable.js").Mutable;
114
- Promises: () => typeof import("./stdlib/promises/index.js");
115
- Files: () => typeof import("./stdlib/files/index.js");
116
- DOM: () => typeof import("./stdlib/dom/index.js");
117
- require: () => {
118
- (...specifiers: unknown[]): Promise<unknown>;
119
- resolve: (specifier: unknown) => string;
120
- } & {
121
- alias: (aliases: Record<string, string>) => {
122
- (...specifiers: unknown[]): Promise<unknown>;
123
- resolve: (specifier: unknown) => string;
124
- };
125
- };
126
- __ojs_observer: () => () => import("./stdlib/observer.js").Observer;
127
- });
21
+ constructor(builtins?: Record<string, () => unknown>);
128
22
  define(state: DefineState, definition: Definition, observer?: typeof observe): void;
129
23
  }
130
24
  export declare const runtime: Runtime & {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/observablehq/notebook-kit.git"
7
7
  },
8
- "version": "1.9.0",
8
+ "version": "1.9.2",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "test": "vitest",