Skip to content

Commit 72a4b5d

Browse files
committed
Fix loading of extension host
1 parent a90137e commit 72a4b5d

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

packages/app/src/app/vscode/extensionHostWorker/common/fs.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { commonPostMessage } from '@codesandbox/common/lib/utils/global';
12
import { FileSystemConfiguration } from '../../../../../../../standalone-packages/codesandbox-browserfs';
23
import { getTypeFetcher } from './type-downloader';
34
import { EXTENSIONS_LOCATION } from '../../constants';
@@ -9,7 +10,6 @@ export const BROWSER_FS_CONFIG: FileSystemConfiguration = {
910
options: {
1011
'/': { fs: 'InMemory', options: {} },
1112
'/tmp': { fs: 'InMemory', options: {} },
12-
'/worker': { fs: 'WorkerFS', options: { worker: self } },
1313
'/sandbox': {
1414
fs: 'InMemory',
1515
},
@@ -47,7 +47,7 @@ export async function initializeBrowserFS({
4747
syncTypes = false,
4848
extraMounts = {},
4949
} = {}) {
50-
return new Promise(async resolve => {
50+
return new Promise(resolve => {
5151
const config = { ...BROWSER_FS_CONFIG };
5252
let modulesByPath = {};
5353

@@ -75,7 +75,7 @@ export async function initializeBrowserFS({
7575

7676
config.options = { ...config.options, ...extraMounts };
7777

78-
global.BrowserFS.configure(config, async e => {
78+
global.BrowserFS.configure(config, e => {
7979
if (e) {
8080
console.error(e);
8181
return;
@@ -93,6 +93,8 @@ export async function initializeBrowserFS({
9393
}
9494
}
9595
});
96+
97+
commonPostMessage({ $type: 'request-data', $broadcast: true });
9698
} else {
9799
resolve();
98100
}

packages/codesandbox-api/src/protocol/protocol.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
const generateId = () => {
1+
const generateId = () =>
22
// Such a random ID
3-
return Math.random() * 1000000 + Math.random() * 1000000 + '';
4-
};
3+
Math.floor(Math.random() * 1000000 + Math.random() * 1000000);
54

65
export default class Protocol {
7-
private outgoingMessages: Set<string> = new Set();
8-
private internalId: string;
6+
private outgoingMessages: Set<number> = new Set();
7+
private internalId: number;
98

109
constructor(
1110
private type: string,
@@ -105,8 +104,3 @@ export default class Protocol {
105104
}
106105
}
107106
}
108-
109-
// {
110-
// isFile(),
111-
// readFile(),
112-
// }

packages/node-services/src/child_process.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line max-classes-per-file
12
import { EventEmitter } from 'events';
23
import { protocolAndHost } from '@codesandbox/common/lib/utils/url-generator';
34
import { commonPostMessage } from '@codesandbox/common/lib/utils/global';
@@ -141,7 +142,7 @@ function getWorker(path: string) {
141142
const worker = WorkerConstructor();
142143

143144
// Register file system that syncs with filesystem in manager
144-
BrowserFS.FileSystem.WorkerFS.attachRemoteListener(worker);
145+
// BrowserFS.FileSystem.WorkerFS.attachRemoteListener(worker);
145146

146147
return worker;
147148
}
@@ -179,7 +180,7 @@ function handleBroadcast(
179180
return;
180181
}
181182

182-
data.$id = data.$id || Math.random() * 1000000;
183+
data.$id = data.$id || Math.floor(Math.random() * 100000000);
183184

184185
if (sentBroadcastsForPath.length > 100) {
185186
sentBroadcastsForPath.shift();

standalone-packages/vscode-extensions/out/bundles/ext-host.min.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

standalone-packages/vscode-extensions/out/bundles/ts.min.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)