Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include implicit stdlib snapshot imports in package snapshot key. #2840

Merged
merged 1 commit into from
Oct 3, 2024
Merged
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
7 changes: 6 additions & 1 deletion src/pyodide/internal/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,17 @@ function memorySnapshotDoImports(Module: Module): Array<string> {
const localModulePaths: Set<string> = new Set<string>(
MetadataReader.getNames()
);
const SNAPSHOT_IMPORTS_SET = new Set(SNAPSHOT_IMPORTS);
const importedModules: Array<string> = ArtifactBundler.constructor
// @ts-ignore parsePythonScriptImports is a static method.
.parsePythonScriptImports(MetadataReader.getWorkerFiles('py'))
.filter((module: string) => {
const moduleFilename = module.replace('.', '/') + '.py';
return !localModulePaths.has(moduleFilename) && module != 'js';
return (
!localModulePaths.has(moduleFilename) &&
module != 'js' &&
!SNAPSHOT_IMPORTS_SET.has(module)
);
});

const deduplicatedModules = [...new Set(importedModules)];
Expand Down