@observablehq/notebook-kit 1.4.1 → 1.5.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/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.4.1",
8
+ "version": "1.5.0",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "test": "vitest",
@@ -8,7 +8,7 @@ export default function duckdb({ path, options }) {
8
8
  let result;
9
9
  let rows;
10
10
  try {
11
- result = await connection.run(strings.reduce((p, c, i) => `${p}$${i - 1}${c}`), params);
11
+ result = await connection.run(strings.reduce((p, c, i) => `${p}$${i}${c}`), params);
12
12
  rows = await result.getRowObjectsJson();
13
13
  }
14
14
  finally {
@@ -12,6 +12,8 @@ export function getInterpreterCommand(interpreter) {
12
12
  return ["node", ["--input-type=module-typescript", "--permission", "--allow-fs-read=."]];
13
13
  case "python":
14
14
  return ["python3", []];
15
+ case "r":
16
+ return ["Rscript", ["-"]];
15
17
  default:
16
18
  throw new Error(`unknown interpreter: ${interpreter}`);
17
19
  }
@@ -1,5 +1,5 @@
1
1
  export function isInterpreter(mode) {
2
- return mode === "node" || mode === "python";
2
+ return mode === "node" || mode === "python" || mode === "r";
3
3
  }
4
4
  export function getInterpreterExtension(format) {
5
5
  switch (format) {
@@ -21,7 +21,7 @@ export interface CellSpec {
21
21
  /** the committed cell value; defaults to empty */
22
22
  value?: string;
23
23
  /** the mode; affects how the value is evaluated; defaults to js */
24
- mode?: "js" | "ts" | "ojs" | "md" | "html" | "tex" | "dot" | "sql" | "node" | "python";
24
+ mode?: "js" | "ts" | "ojs" | "md" | "html" | "tex" | "dot" | "sql" | "node" | "python" | "r";
25
25
  /** if true, the editor will stay open when not focused; defaults to false */
26
26
  pinned?: boolean;
27
27
  /** if true, implicit display will be suppressed; defaults to false */
@@ -72,6 +72,8 @@ function serializeMode(mode) {
72
72
  return "application/vnd.node.javascript";
73
73
  case "python":
74
74
  return "text/x-python";
75
+ case "r":
76
+ return "text/x-r";
75
77
  case "ojs":
76
78
  return "application/vnd.observable.javascript";
77
79
  case "ts":
@@ -96,6 +98,8 @@ function deserializeMode(mode) {
96
98
  return "node";
97
99
  case "text/x-python":
98
100
  return "python";
101
+ case "text/x-r":
102
+ return "r";
99
103
  case "application/vnd.observable.javascript":
100
104
  return "ojs";
101
105
  case "text/x-typescript":
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.4.1",
8
+ "version": "1.5.0",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "test": "vitest",