@@ -8,8 +8,8 @@ import type {TemplateLiteral} from "acorn";
88import { JSDOM } from "jsdom" ;
99import type { PluginOption , IndexHtmlTransformContext } from "vite" ;
1010import { 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" ;
1313import type { Cell , Notebook } from "../lib/notebook.js" ;
1414import { deserialize } from "../lib/serialize.js" ;
1515import { Sourcemap } from "../javascript/sourcemap.js" ;
@@ -130,14 +130,14 @@ export function observable({
130130 cell . mode = "js" ;
131131 cell . value = `FileAttachment(${ JSON . stringify ( relative ( dir , cachePath ) ) } ).json().then(DatabaseClient.revive)${ hidden ? "" : `.then(Inputs.table)${ cell . output ? ".then(view)" : "" } ` } ` ;
132132 }
133- } else if ( mode === "node" ) {
133+ } else if ( isInterpreter ( mode ) ) {
134134 const { filename : sourcePath } = context ;
135135 const sourceDir = dirname ( sourcePath ) ;
136136 const cachePath = await getInterpreterCachePath ( sourcePath , mode , format , value ) ;
137137 if ( ! existsSync ( cachePath ) ) {
138138 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 } ) ;
141141 child . stdin . end ( value ) ;
142142 child . stderr . pipe ( process . stderr ) ;
143143 child . stdout . pipe ( createWriteStream ( cachePath ) ) ;
0 commit comments