* Load the pyodide.asm.mjs ES6 module in Node.js. * @param url The path to load. May be a url or a relative file system path. * @private
(url: string)
| 226 | * @private |
| 227 | */ |
| 228 | async function nodeLoadScript(url: string) { |
| 229 | if (url.startsWith("file://")) { |
| 230 | // handle file:// with filesystem operations rather than with fetch. |
| 231 | url = url.slice("file://".length); |
| 232 | } |
| 233 | if (url.includes("://")) { |
| 234 | // If it's a url, use dynamic import. |
| 235 | return await import(/* webpackIgnore: true */ url); |
| 236 | } else { |
| 237 | // Otherwise, hopefully it is a relative path we can load from the file |
| 238 | // system. |
| 239 | return await import( |
| 240 | /* webpackIgnore: true */ nodeUrlMod.pathToFileURL(url).href |
| 241 | ); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | export async function loadLockFile(lockFileURL: string): Promise<Lockfile> { |
| 246 | if (RUNTIME_ENV.IN_NODE) { |