@@ -44,7 +44,9 @@ type FSNode = {
4444 mode : number ;
4545} ;
4646type FSStream = {
47- tty ?: boolean ;
47+ tty ?: {
48+ ops : object ;
49+ } ;
4850 seekable ?: boolean ;
4951 stream_ops : FSStreamOps ;
5052 node : FSNode ;
@@ -57,7 +59,7 @@ type FSStreamOpsGen<T> = {
5759 read : ( a : T , b : Uint8Array , offset : number , length : number , pos : number ) => number ;
5860 write : ( a : T , b : Uint8Array , offset : number , length : number , pos : number ) => number ;
5961} ;
60- interface FS {
62+ interface FSType {
6163 unlink : ( path : string ) => void ;
6264 mkdirTree : ( path : string , mode ?: number ) => void ;
6365 chdir : ( path : string ) => void ;
@@ -173,7 +175,7 @@ declare class PyProxy {
173175 * @param options
174176 * @return The JavaScript object resulting from the conversion.
175177 */
176- toJs ( { depth, pyproxies, create_pyproxies, dict_converter, default_converter, } ?: {
178+ toJs ( { depth, pyproxies, create_pyproxies, dict_converter, default_converter, eager_converter , } ?: {
177179 /** How many layers deep to perform the conversion. Defaults to infinite */
178180 depth ?: number ;
179181 /**
@@ -208,6 +210,15 @@ declare class PyProxy {
208210 * documentation of :meth:`~pyodide.ffi.to_js`.
209211 */
210212 default_converter ?: ( obj : PyProxy , convert : ( obj : PyProxy ) => any , cacheConversion : ( obj : PyProxy , result : any ) => void ) => any ;
213+ /**
214+ * Optional callback to convert objects which gets called after ``str``,
215+ * ``int``, ``float``, ``bool``, ``None``, and ``JsProxy`` are converted but
216+ * *before* any default conversions are applied to standard data structures.
217+ *
218+ * Its arguments are the same as `dict_converter`.
219+ * See the documentation of :meth:`~pyodide.ffi.to_js`.
220+ */
221+ eager_converter ?: ( obj : PyProxy , convert : ( obj : PyProxy ) => any , cacheConversion : ( obj : PyProxy , result : any ) => void ) => any ;
211222 } ) : any ;
212223}
213224declare class PyProxyWithLength extends PyProxy {
@@ -1127,7 +1138,7 @@ declare class PyodideAPI {
11271138 * are available as members of ``FS.filesystems``:
11281139 * ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.
11291140 */
1130- static FS : FS ;
1141+ static FS : FSType ;
11311142 /**
11321143 * An alias to the `Emscripten Path API
11331144 * <https://github.com/emscripten-core/emscripten/blob/main/src/library_path.js>`_.
@@ -1467,8 +1478,11 @@ type ConfigType = {
14671478 stdout ?: ( msg : string ) => void ;
14681479 stderr ?: ( msg : string ) => void ;
14691480 jsglobals ?: object ;
1481+ _sysExecutable ?: string ;
14701482 args : string [ ] ;
1471- _node_mounts : string [ ] ;
1483+ fsInit ?: ( FS : FSType , info : {
1484+ sitePackages : string ;
1485+ } ) => Promise < void > ;
14721486 env : {
14731487 [ key : string ] : string ;
14741488 } ;
@@ -1558,6 +1572,11 @@ export declare function loadPyodide(options?: {
15581572 * Default: ``globalThis``
15591573 */
15601574 jsglobals ?: object ;
1575+ /**
1576+ * Determine the value of ``sys.executable``.
1577+ * @ignore
1578+ */
1579+ _sysExecutable ?: string ;
15611580 /**
15621581 * Command line arguments to pass to Python on startup. See `Python command
15631582 * line interface options
@@ -1593,7 +1612,8 @@ export declare function loadPyodide(options?: {
15931612 */
15941613 pyproxyToStringRepr ?: boolean ;
15951614 /**
1596- * Make loop.run_until_complete() function correctly using stack switching
1615+ * Make loop.run_until_complete() function correctly using stack switching.
1616+ * Default: ``true``.
15971617 */
15981618 enableRunUntilComplete ?: boolean ;
15991619 /**
@@ -1602,14 +1622,14 @@ export declare function loadPyodide(options?: {
16021622 */
16031623 checkAPIVersion ?: boolean ;
16041624 /**
1605- * Used by the cli runner. If we want to detect a virtual environment from
1606- * the host file system, it needs to be visible from when `main()` is
1607- * called. The directories in this list will be mounted at the same address
1608- * into the Emscripten file system so that virtual environments work in the
1609- * cli runner.
1610- * @ignore
1625+ * This is a hook that allows modification of the file system before the
1626+ * main() function is called and the intereter is started. When this is
1627+ * called, it is guaranteed that there is an empty site-packages directory.
1628+ * @experimental
16111629 */
1612- _node_mounts ?: string [ ] ;
1630+ fsInit ?: ( FS : FSType , info : {
1631+ sitePackages : string ;
1632+ } ) => Promise < void > ;
16131633 /** @ignore */
16141634 _makeSnapshot ?: boolean ;
16151635 /** @ignore */
0 commit comments