@@ -8,8 +8,8 @@ import type {TemplateLiteral} from "acorn";
8
8
import { JSDOM } from "jsdom" ;
9
9
import type { PluginOption , IndexHtmlTransformContext } from "vite" ;
10
10
import { getQueryCachePath } from "../databases/index.js" ;
11
- import { getInterpreterCachePath } from "../interpreters/index.js" ;
12
- import { getInterpreterMethod } from "../lib/interpreters.js" ;
11
+ import { getInterpreterCachePath , getInterpreterCommand } from "../interpreters/index.js" ;
12
+ import { getInterpreterMethod , isInterpreter } from "../lib/interpreters.js" ;
13
13
import type { Cell , Notebook } from "../lib/notebook.js" ;
14
14
import { deserialize } from "../lib/serialize.js" ;
15
15
import { Sourcemap } from "../javascript/sourcemap.js" ;
@@ -130,14 +130,14 @@ export function observable({
130
130
cell . mode = "js" ;
131
131
cell . value = `FileAttachment(${ JSON . stringify ( relative ( dir , cachePath ) ) } ).json().then(DatabaseClient.revive)${ hidden ? "" : `.then(Inputs.table)${ cell . output ? ".then(view)" : "" } ` } ` ;
132
132
}
133
- } else if ( mode === "node" ) {
133
+ } else if ( isInterpreter ( mode ) ) {
134
134
const { filename : sourcePath } = context ;
135
135
const sourceDir = dirname ( sourcePath ) ;
136
136
const cachePath = await getInterpreterCachePath ( sourcePath , mode , format , value ) ;
137
137
if ( ! existsSync ( cachePath ) ) {
138
138
await mkdir ( dirname ( cachePath ) , { recursive : true } ) ;
139
- const args = [ "--input-type=module" , "--permission" , "--allow-fs-read=." ] ;
140
- const child = spawn ( "node" , args , { cwd : sourceDir } ) ;
139
+ const [ command , args ] = getInterpreterCommand ( mode ) ;
140
+ const child = spawn ( command , args , { cwd : sourceDir } ) ;
141
141
child . stdin . end ( value ) ;
142
142
child . stderr . pipe ( process . stderr ) ;
143
143
child . stdout . pipe ( createWriteStream ( cachePath ) ) ;
0 commit comments