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
6 changes: 3 additions & 3 deletions packages/app/src/sandbox/eval/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { SerializedTranspiledModule } from './transpiled-module';
import Preset from './presets';
import { SCRIPT_VERSION } from '../';
import fetchModule, {
getCombinedMetas,
setCombinedMetas,
combinedMetas,
} from './npm/fetch-npm-module';
import coreLibraries from './npm/get-core-libraries';
import getDependencyName from './utils/get-dependency-name';
Expand Down Expand Up @@ -223,7 +223,7 @@ export default class Manager {
if (this.stage === 'transpilation') {
// In transpilation phase we can afford to download the file if not found,
// because we're async. That's why we also include the meta here.
returnValue = this.transpiledModules[p] || getCombinedMetas()[p];
returnValue = this.transpiledModules[p] || combinedMetas[p];
} else {
returnValue = this.transpiledModules[p];
}
Expand Down Expand Up @@ -1049,7 +1049,7 @@ export default class Manager {
const dependenciesQuery = this.getDependencyQuery();

const meta = {};
Object.keys(getCombinedMetas() || {}).forEach(p => {
Object.keys(combinedMetas || {}).forEach(p => {
const dir = pathUtils.dirname(p.replace('/node_modules', ''));
meta[dir] = meta[dir] || [];
meta[dir].push(pathUtils.basename(p));
Expand Down
7 changes: 1 addition & 6 deletions packages/app/src/sandbox/eval/npm/fetch-npm-module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import * as pathUtils from '@codesandbox/common/lib/utils/path';
import resolve from 'browser-resolve';
import DependencyNotFoundError from 'sandbox-hooks/errors/dependency-not-found-error';
Expand Down Expand Up @@ -28,14 +27,10 @@ type MetaFiles = Array<{
}>;

const metas: Metas = {};
let combinedMetas: Meta = {};
export let combinedMetas: Meta = {};
const normalizedMetas: { [key: string]: Meta } = {};
const packages: Packages = {};

export function getCombinedMetas() {
return combinedMetas;
}

export function setCombinedMetas(givenCombinedMetas: Meta) {
combinedMetas = givenCombinedMetas;
}
Expand Down
24 changes: 12 additions & 12 deletions packages/app/src/sandbox/npm/fetch-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ const VERSION = 1;

const BUCKET_URL =
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
? 'https://prod-packager-packages.codesandbox.io'
? 'https://d1jyvh0kxilfa7.cloudfront.net'
: 'https://dev-packager-packages.codesandbox.io';

// const NEW_PACKAGER_URL =
// 'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages';
const NEW_PACKAGER_URL =
'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages';

const PACKAGER_URL =
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
? 'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages'
? 'https://drq28qbjmc.execute-api.eu-west-1.amazonaws.com/prod/packages'
: 'https://xi5p9f7czk.execute-api.eu-west-1.amazonaws.com/dev/packages';

// function warmupPackager(url: string, method = 'GET') {
// fetch(url, {
// method,
// })
// .then(() => {})
// .catch(() => {});
// }
function warmupPackager(url: string, method = 'GET') {
fetch(url, {
method,
})
.then(() => {})
.catch(() => {});
}

function callApi(url: string, method = 'GET') {
return fetch(url, {
Expand Down Expand Up @@ -122,7 +122,7 @@ async function getDependencies(dependencies: Object) {
const bucketDependencyUrl = dependenciesToBucketPath(absoluteDependencies);

setScreen({ type: 'loading', text: 'Downloading Dependencies...' });
// warmupPackager(`${NEW_PACKAGER_URL}/${dependencyUrl}`, 'POST');
warmupPackager(`${NEW_PACKAGER_URL}/${dependencyUrl}`, 'POST');
try {
const bucketManifest = await callApi(
`${BUCKET_URL}/${bucketDependencyUrl}`
Expand Down