Skip to content

Commit 8444f50

Browse files
author
Ives van Hoorne
committed
Save combined metas
1 parent 5a413a7 commit 8444f50

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/app/src/sandbox/eval/manager.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import type { Module } from './entities/module';
1212
import TranspiledModule from './transpiled-module';
1313
import type { SerializedTranspiledModule } from './transpiled-module';
1414
import Preset from './presets';
15-
import fetchModule, { getCombinedMetas } from './npm/fetch-npm-module';
15+
import fetchModule, {
16+
getCombinedMetas,
17+
setCombinedMetas,
18+
} from './npm/fetch-npm-module';
1619
import coreLibraries from './npm/get-core-libraries';
1720
import getDependencyName from './utils/get-dependency-name';
1821
import DependencyNotFoundError from '../errors/dependency-not-found-error';
@@ -422,7 +425,7 @@ export default class Manager {
422425
const aliasedPath = this.getAliasedDependencyPath(path, currentPath);
423426
const shimmedPath = coreLibraries[aliasedPath] || aliasedPath;
424427

425-
const pathId = path + currentPath;
428+
const pathId = shimmedPath + currentPath;
426429
const cachedPath = this.cachedPaths[pathId];
427430
try {
428431
let resolvedPath;
@@ -706,6 +709,7 @@ export default class Manager {
706709
cachedPaths: this.cachedPaths,
707710
version: VERSION,
708711
configurations: this.configurations,
712+
meta: getCombinedMetas(),
709713
dependenciesQuery,
710714
};
711715
}
@@ -750,12 +754,14 @@ export default class Manager {
750754
version,
751755
configurations,
752756
dependenciesQuery,
757+
meta,
753758
}: {
754759
transpiledModules: { [id: string]: SerializedTranspiledModule },
755760
cachedPaths: { [path: string]: string },
756761
version: string,
757762
configurations: Object,
758763
dependenciesQuery: string,
764+
meta: any,
759765
} = data;
760766

761767
// Only use the cache if the cached version was cached with the same
@@ -764,6 +770,8 @@ export default class Manager {
764770
version === VERSION &&
765771
dependenciesQuery === this.getDependencyQuery()
766772
) {
773+
setCombinedMetas(meta);
774+
767775
this.cachedPaths = cachedPaths;
768776
this.configurations = configurations;
769777

packages/app/src/sandbox/eval/npm/fetch-npm-module.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export function getCombinedMetas() {
3030
return combinedMetas;
3131
}
3232

33+
export function setCombinedMetas(givenCombinedMetas: Meta) {
34+
combinedMetas = givenCombinedMetas;
35+
}
36+
3337
function normalize(
3438
depName: string,
3539
files: MetaFiles,

0 commit comments

Comments
 (0)