Skip to content

Transpile coffeescript written in ES6 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion lib/compilers/coffee-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ module.exports = function (raw, cb, compiler) {
try {
compiled = coffee.compile(raw, {
bare: true,
sourceMap: true
sourceMap: true,
transpile: {
presets: ['env']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we want to use presets that the user has in their babelrc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyerburgh Yes, actually that should be better

}
})
} catch (err) {
throwError(err)
Expand Down
10 changes: 10 additions & 0 deletions test/coffee.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { shallow } from 'vue-test-utils'
import Coffee from './resources/Coffee.vue'
import CoffeeScript from './resources/CoffeeScript.vue'
import CoffeeES6 from './resources/CoffeeES6.vue'
import CoffeeScriptES6 from './resources/CoffeeScriptES6.vue'

test('processes .vue file with lang set to coffeescript', () => {
shallow(Coffee)
Expand All @@ -9,3 +11,11 @@ test('processes .vue file with lang set to coffeescript', () => {
test('processes .vue file with lang set to coffeescript', () => {
shallow(CoffeeScript)
})

test('processes .vue file with lang set to coffeescript', () => {
shallow(CoffeeES6)
})

test('processes .vue file with lang set to coffeescript', () => {
shallow(CoffeeScriptES6)
})
8 changes: 8 additions & 0 deletions test/resources/CoffeeES6.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div />
</template>

<script lang="coffee">
export default
data: -> {}
</script>
8 changes: 8 additions & 0 deletions test/resources/CoffeeScriptES6.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div />
</template>

<script lang="coffeescript">
export default
data: -> {}
</script>