Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Commit e910f42

Browse files
committed
Use vue-template-es2015-compiler (following vueify 9.3.0)
1 parent 4828db4 commit e910f42

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Portions of this project are heavily based on parts of [vueify](https://github.c
55

66
## Usage
77
* Install: `npm install --save-dev vue-typescript-jest`
8+
* This package does not declare any dependencies: install the preferred versions of TypeScript, Jest, Vue.js, and vueify. Cf. [`package.json`](package.json) for the versions used during development.
89
* Add the following snippet to `package.json` (adapting testRegex to your project layout)
910
```js
1011
"scripts": {
@@ -23,7 +24,7 @@ Portions of this project are heavily based on parts of [vueify](https://github.c
2324
"coveragePathIgnorePatterns": [
2425
"/node_modules/",
2526
"/test/.*\\.(ts|js)$",
26-
"/.*\\.vue"
27+
"/.*\\.vue$"
2728
]
2829
},
2930
```
@@ -98,7 +99,6 @@ module.exports = require('./counter-ts.ts').default
9899
</script>
99100
```
100101
* Code coverage of `*.vue` files fails as the generated code contains a `with` statement that trips the babylon parser: use `coveragePathIgnorePatterns` as shown above to ignore the `*.vue` files
101-
* This package does not declare any dependencies: install the preferred versions of TypeScript, Jest, Vue.js, and vueify. Cf. [`package.json`](package.json) for the versions used during development.
102102

103103
## Contributing
104104
Contributions including bug reports, tests, and documentation are more than welcome. To get started with development:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"coveragePathIgnorePatterns": [
3636
"/node_modules/",
3737
"/test/test/.*\\.(ts|js)$",
38-
"/.*\\.vue"
38+
"/.*\\.vue$"
3939
]
4040
},
4141
"devDependencies": {
@@ -52,6 +52,7 @@
5252
"typescript": "^2.0.3",
5353
"vue": "^2.0.1",
5454
"vue-template-compiler": "^2.0.1",
55+
"vue-template-es2015-compiler": "^1.2.2",
5556
"vue-typescript-import-dts": "^2.0.0"
5657
},
5758
"babel": {

preprocessor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function babel(src) {
6363
// this is heavily based on vueify (Copyright (c) 2014-2016 Evan You)
6464
function vue(src, filePath) {
6565
function toFunction (code) {
66-
return 'function(){' + code + '}'
66+
const transpile = require('vue-template-es2015-compiler')
67+
return transpile('function render () {' + code + '}')
6768
}
6869
const vueCompiler = require('vue-template-compiler')
6970
const parts = vueCompiler.parseComponent(src, { pad: true })

0 commit comments

Comments
 (0)