Skip to content

Commit 3bbf712

Browse files
authored
Server Side Evaluation (codesandbox#1109)
1 parent 7b29320 commit 3bbf712

File tree

160 files changed

+9454
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+9454
-625
lines changed

.circleci/config.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ jobs:
7777
background: true
7878
- run:
7979
name: Setup BrowserStack local environment
80-
command: "[ -n \"$BROWSER_STACK_KEY\" ] && ./packages/app/integration-tests/BrowserStackLocal --key $BROWSER_STACK_KEY || true"
80+
command: '[ -n "$BROWSER_STACK_KEY" ] && ./packages/app/integration-tests/BrowserStackLocal --key $BROWSER_STACK_KEY || true'
8181
background: true
8282
- run:
8383
name: Test Integrations
8484
command: |
8585
sleep 15
8686
yarn test:integrations --ci --testResultsProcessor="jest-junit"
8787
environment:
88-
JEST_JUNIT_OUTPUT: "/tmp/test-results/js-test-results.xml"
88+
JEST_JUNIT_OUTPUT: '/tmp/test-results/js-test-results.xml'
8989
- store_test_results:
9090
path: /tmp/test-results
9191
- store_artifacts:
@@ -103,7 +103,7 @@ jobs:
103103
name: Test
104104
command: yarn test --ci --testResultsProcessor="jest-junit"
105105
environment:
106-
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
106+
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
107107

108108
lint:
109109
docker:
@@ -125,22 +125,22 @@ jobs:
125125
key: v12-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
126126
- run:
127127
name: Docker Sign In
128-
command: "[ -n \"$DOCKER_USER\" ] && echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin || true"
128+
command: '[ -n "$DOCKER_USER" ] && echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin || true'
129129
- run:
130130
name: Create Image
131-
command: "[ -n \"$DOCKER_USER\" ] && docker build -t codesandbox/client:${CIRCLE_SHA1:0:7} . || true"
131+
command: '[ -n "$DOCKER_USER" ] && docker build -t codesandbox/client:${CIRCLE_SHA1:0:7} . || true'
132132
- deploy:
133133
name: Push Image
134-
command: "[ -n \"$DOCKER_USER\" ] && docker push codesandbox/client:${CIRCLE_SHA1:0:7} || true"
134+
command: '[ -n "$DOCKER_USER" ] && docker push codesandbox/client:${CIRCLE_SHA1:0:7} || true'
135135

136136
workflows:
137137
version: 2
138138
build-and-test:
139139
jobs:
140140
- build-dependencies
141-
- test-integrations:
142-
requires:
143-
- build-dependencies
141+
# - test-integrations:
142+
# requires:
143+
# - build-dependencies
144144
- test-jest:
145145
requires:
146146
- build-dependencies
@@ -154,4 +154,5 @@ workflows:
154154
requires:
155155
- build-prod
156156
- lint
157+
# - test-integrations
157158
- test-jest

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"globals": {
1111
"Raven": true,
1212
"VERSION": true,
13-
"$PropertyType": true
13+
"$PropertyType": true,
14+
"TimeoutID": true
1415
},
1516
"rules": {
1617
"react/jsx-filename-extension": 0,

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"add-contributor": "all-contributors add",
2121
"generate": "all-contributors generate",
2222
"precommit": "lint-staged",
23-
"postinstall": "rimraf packages/app/node_modules/styled-components && yarn lerna run install-dependencies --scope codesandbox-browserfs --stream"
23+
"postinstall": "rimraf packages/app/node_modules/styled-components && yarn lerna run install-dependencies --scope codesandbox-browserfs --scope sse-loading-screen --stream"
2424
},
2525
"lint-staged": {
2626
"*.{js,css,json}": [
@@ -35,7 +35,9 @@
3535
"packages/codesandbox-api",
3636
"packages/sandpack",
3737
"packages/react-sandpack",
38-
"packages/homepage"
38+
"packages/homepage",
39+
"packages/sandbox-hooks",
40+
"packages/sse-hooks"
3941
],
4042
"nohoist": ["**/gatsby", "**/gatsby/**"]
4143
},

packages/app/config/webpack.common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ module.exports = {
114114
new RegExp(`${sepRe}node_modules${sepRe}.*ansi-styles`),
115115
new RegExp(`${sepRe}node_modules${sepRe}.*chalk`),
116116
new RegExp(`${sepRe}node_modules${sepRe}.*jest`),
117+
new RegExp(`sandbox-hooks`),
117118
new RegExp(`${sepRe}node_modules${sepRe}.*monaco-textmate`),
118119
new RegExp(`${sepRe}node_modules${sepRe}.*onigasm`),
119120
new RegExp(

packages/app/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"circular-json": "^0.4.0",
129129
"codemirror": "^5.27.4",
130130
"codesandbox-api": "^0.0.18",
131-
"codesandbox-import-utils": "1.2.10",
131+
"codesandbox-import-utils": "^1.3.0",
132132
"color": "^0.11.4",
133133
"compare-versions": "^3.1.0",
134134
"console-feed": "^2.8.0",
@@ -209,6 +209,7 @@
209209
"react-virtualized": "^9.19.1",
210210
"shelljs": "^0.7.8",
211211
"shortid": "^2.2.8",
212+
"socket.io-client": "^2.1.1",
212213
"store": "^2.0.12",
213214
"string-replace-loader": "^2.1.1",
214215
"styled-components": "^3.2.1",
@@ -218,7 +219,8 @@
218219
"vue-eslint-parser": "^2.0.3",
219220
"vue-hot-reload-api": "^2.2.4",
220221
"vue-template-compiler": "^2.5.2",
221-
"vue-template-es2015-compiler": "^1.6.0"
222+
"vue-template-es2015-compiler": "^1.6.0",
223+
"xterm": "3.7.0"
222224
},
223225
"jest": {
224226
"roots": [
@@ -232,7 +234,7 @@
232234
"/create-zip\\/.*\\/files/"
233235
],
234236
"transformIgnorePatterns": [
235-
"node_modules/(?!(common|lodash-es|react-icons))"
237+
"node_modules/(?!(common|lodash-es|sandbox-hooks|react-icons))"
236238
],
237239
"moduleNameMapper": {
238240
"\\.css$": "<rootDir>/__mocks__/styleMock.js",

packages/app/scripts/start.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,19 @@ function addMiddleware(devServer, index) {
203203
devServer.use(
204204
'/api',
205205
proxy({
206-
target: 'https://codesandbox.io',
206+
target: 'https://codesandbox.stream',
207207
changeOrigin: true,
208208
})
209209
);
210+
211+
devServer.use(
212+
'/socket.io',
213+
proxy({
214+
target: 'https://sse.codesandbox.stream',
215+
changeOrigin: true,
216+
secure: false,
217+
})
218+
);
210219
}
211220
// Finally, by now we have certainly resolved the URL.
212221
// It may be /index.html, so let the dev server try serving it again.

packages/app/src/app/components/CodeEditor/Monaco/workers/linter/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ self.addEventListener('message', async event => {
349349
let config = defaultConfig;
350350
let options = { filename };
351351

352-
if (template === 'vue-cli') {
352+
if (template === 'vue-cli' || template === 'nuxt') {
353353
const {
354354
getConfig: getVueConfig,
355355
getVerifyOptions: getVueVerifyOptions,

packages/app/src/app/components/CodeEditor/types.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
// @flow
2+
23
import type {
34
Module,
45
Sandbox,
56
ModuleError,
67
ModuleCorrection,
8+
Preferences,
79
} from 'common/types';
810

9-
export type Settings = {
10-
autoCompleteEnabled: boolean,
11-
autoDownloadTypes: boolean,
12-
codeMirror: boolean,
13-
fontFamily?: string,
14-
fontSize: number,
15-
lineHeight: number,
16-
lintEnabled: boolean,
17-
vimMode: boolean,
18-
tabWidth: number,
19-
enableLigatures: boolean,
20-
};
11+
export type Settings =
12+
| Preferences
13+
| {
14+
autoCompleteEnabled: boolean,
15+
autoDownloadTypes: boolean,
16+
codeMirror: boolean,
17+
fontFamily?: string,
18+
fontSize: number,
19+
lineHeight: number,
20+
lintEnabled: boolean,
21+
vimMode: boolean,
22+
tabWidth: number,
23+
enableLigatures: boolean,
24+
forceRefresh: boolean,
25+
};
2126

2227
type ModuleTab = {
2328
type: 'MODULE',

packages/app/src/app/components/NewSandbox/elements.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

packages/app/src/app/components/NewSandbox/index.js

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)