Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.js.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/zip-COrdYVp5.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/zip-COrdYVp5.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/zip-CakRHzZu.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/zip-CakRHzZu.js.map

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions esm/interpreter/pyodide.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const type = 'pyodide';
const toJsOptions = { dict_converter: Object.fromEntries };

const { stringify } = JSON;
const { hasOwn } = Object;

const { apply } = Reflect;
const FunctionPrototype = Function.prototype;
Expand Down Expand Up @@ -70,12 +71,35 @@ const indexURLs = new WeakMap();

export default {
type,
module: (version = '0.28.3') =>
module: (version = '0.29.0') =>
`https://cdn.jsdelivr.net/pyodide/v${version}/full/pyodide.mjs`,
async engine({ loadPyodide, version }, config, url, baseURL) {
progress('Loading Pyodide');
let { packages, index_urls } = config;
if (packages) packages = packages.map(fixedRelative, baseURL);
if (packages) {
packages = packages.map(fixedRelative, baseURL);
if (!index_urls) {
progress('Loading Packages Graph');
const { default: graph } = await import(/* webpackIgnore: true */'./pyodide_graph.js');
progress('Loaded Packages Graph');
if (hasOwn(graph, version)) {
const invalid = packages.filter(entry => {
// consider only packages by name
if (/^[a-zA-Z0-9_]/.test(entry)) {
const [name, ...rest] = entry.split(/[>=<]=/);
const known = hasOwn(graph[version], name);
return !known || (rest.length > 0 && rest[1] !== graph[version][name]);
}
return false;
});
if (invalid.length > 0) {
throw new Error(
`These packages are not supported in Pyodide ${version}: ${invalid.join(', ')}`
);
}
}
}
}
progress('Loading Storage');
const indexURL = url.slice(0, url.lastIndexOf('/'));
// each pyodide version shares its own cache
Expand Down
Loading