Skip to content

Commit 7552554

Browse files
author
Ives van Hoorne
committed
Add Vue JSX support
1 parent b0cfb50 commit 7552554

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@
8080
"dependencies": {
8181
"@emmetio/codemirror-plugin": "^0.3.5",
8282
"axios": "^0.16.2",
83+
"babel-helper-vue-jsx-merge-props": "^2.0.2",
8384
"babel-plugin-detective": "^2.0.0",
8485
"babel-plugin-dynamic-import-node": "^1.0.2",
86+
"babel-plugin-syntax-jsx": "^6.18.0",
8587
"babel-plugin-system-import": "^1.1.5",
8688
"babel-plugin-system-import-transformer": "3.1.0",
8789
"babel-plugin-transform-async-to-generator": "^6.24.1",
8890
"babel-plugin-transform-decorators-legacy": "^1.3.4",
8991
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
92+
"babel-plugin-transform-vue-jsx": "^3.5.0",
9093
"babel-polyfill": "^6.23.0",
9194
"babel-preset-stage-0": "^6.24.1",
9295
"babel-standalone": "^6.25.0",

src/sandbox/eval/transpilers/babel/babel-worker.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
22

33
import dynamicImportPlugin from 'babel-plugin-dynamic-import-node';
4+
import vuePlugin from 'babel-plugin-transform-vue-jsx';
45

56
import { buildWorkerError } from '../utils/worker-error-handler';
67

@@ -22,13 +23,20 @@ declare var Babel: {
2223
};
2324

2425
Babel.registerPlugin('dynamic-import-node', dynamicImportPlugin);
26+
Babel.registerPlugin('transform-vue-jsx', vuePlugin);
2527

2628
self.addEventListener('message', event => {
2729
const { code, path, config } = event.data;
2830

31+
const plugins = [...config.plugins, 'dynamic-import-node'];
32+
33+
if (path.includes('.vue')) {
34+
plugins.push('transform-vue-jsx');
35+
}
36+
2937
const customConfig = {
3038
...config,
31-
plugins: [...config.plugins, 'dynamic-import-node'],
39+
plugins,
3240
};
3341

3442
try {

yarn.lock

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ babel-helper-to-multiple-sequence-expressions@^0.1.1:
737737
version "0.1.1"
738738
resolved "https://registry.yarnpkg.com/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.1.1.tgz#5f1b832b39e4acf954e9137f0251395c71196b35"
739739

740+
babel-helper-vue-jsx-merge-props@^2.0.2:
741+
version "2.0.2"
742+
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.2.tgz#aceb1c373588279e2755ea1cfd35c22394fd33f8"
743+
740744
babel-helpers@^6.24.1:
741745
version "6.24.1"
742746
resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2"
@@ -917,7 +921,7 @@ babel-plugin-syntax-function-bind@^6.8.0:
917921
version "6.13.0"
918922
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz#48c495f177bdf31a981e732f55adc0bdd2601f46"
919923

920-
babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
924+
babel-plugin-syntax-jsx@^6.18.0, babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
921925
version "6.18.0"
922926
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
923927

@@ -1304,6 +1308,12 @@ babel-plugin-transform-undefined-to-void@^6.8.2:
13041308
version "6.8.3"
13051309
resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.8.3.tgz#fc52707f6ee1ddc71bb91b0d314fbefdeef9beb4"
13061310

1311+
babel-plugin-transform-vue-jsx@^3.5.0:
1312+
version "3.5.0"
1313+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-3.5.0.tgz#6b1ad29351ad753919403675f0bf8b2a43e17671"
1314+
dependencies:
1315+
esutils "^2.0.2"
1316+
13071317
babel-polyfill@^6.23.0:
13081318
version "6.23.0"
13091319
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d"
@@ -5686,8 +5696,6 @@ moment@^2.18.1:
56865696
monaco-editor@CompuIves/codesandbox-monaco-editor:
56875697
version "0.9.0"
56885698
resolved "https://codeload.github.com/CompuIves/codesandbox-monaco-editor/tar.gz/e4e1efb582934ffd8fb135b1cfa1af82cdbc85e3"
5689-
dependencies:
5690-
monaco-typescript CompuIves/monaco-typescript
56915699

56925700
56935701
version "2.0.0"

0 commit comments

Comments
 (0)