mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-27 13:39:44 -08:00
bf351243df
* upgrade pyodide * install pyodide modules to a custom user-writable path * in `augmentObject` `newData` is never undefined
18 lines
481 B
TypeScript
18 lines
481 B
TypeScript
import type { PyodideInterface } from 'pyodide';
|
|
|
|
let pyodideInstance: PyodideInterface | undefined;
|
|
|
|
export async function LoadPyodide(packageCacheDir: string): Promise<PyodideInterface> {
|
|
if (pyodideInstance === undefined) {
|
|
const { loadPyodide } = await import('pyodide');
|
|
pyodideInstance = await loadPyodide({ packageCacheDir });
|
|
|
|
await pyodideInstance.runPythonAsync(`
|
|
from _pyodide_core import jsproxy_typedict
|
|
from js import Object
|
|
`);
|
|
}
|
|
|
|
return pyodideInstance;
|
|
}
|