Skip to content

Commit

Permalink
Merge pull request #11 from riot/dev
Browse files Browse the repository at this point in the history
v2.3.0
  • Loading branch information
aMarCruz committed Oct 30, 2015
2 parents 8f14f3b + d364c6e commit feb4282
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 25 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ branches:

install:
- npm i jade
- npm i babel@5.8
- npm i babel-core
- npm i babel-preset-es2015
- npm i coffee-script
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

### For babel users

Because changes in their API, support for babel-core through `compiler.parsers.css.es6` or a `babel` is a pending decision, a new beta version will include the final interface for babel.
Due to recent changes in the babel API, from v2.3.0-beta.7 we are supporting `babel` versions previous to 6.0.2 through `parsers.css.es6` (`<script type="es6">`), new versions are not compatible with the node API.

For `babel-core`, please use the new `parsers.css.babel` (`<script type="babel">`). You must `npm install babel-preset-es2015` too, for this works.


[travis-image]:https://img.shields.io/travis/riot/compiler.svg?style=flat-square
Expand Down
11 changes: 7 additions & 4 deletions dist/compiler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* riot-compiler 2.3.0-beta.6, @license MIT, (c) 2015 Muut Inc. + contributors */
/* riot-compiler 2.3.0, @license MIT, (c) 2015 Muut Inc. + contributors */
;(function (root, factory) {

/* istanbul ignore else */
Expand Down Expand Up @@ -35,6 +35,9 @@

switch (name) {
case 'es6':
req = 'babel'
break
case 'babel':
req = 'babel-core'
break
case 'none':
Expand Down Expand Up @@ -86,12 +89,12 @@
},
es6: function (js) {
return _req('es6').transform(js, {
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
}).code
},
babel: /* istanbul ignore next */ function (js) {
babel: function (js) {
return _req('babel').transform(js, {
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
}).code
},
coffee: function (js) {
Expand Down
8 changes: 4 additions & 4 deletions dist/riot.compiler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/**
* Compiler for riot custom tags
* @version 2.3.0-beta.6
* @version 2.3.0
*/

/**
Expand Down Expand Up @@ -58,12 +58,12 @@ var parsers = (function () {
},
es6: function (js) {
return _req('es6').transform(js, {
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
}).code
},
babel: /* istanbul ignore next */ function (js) {
babel: function (js) {
return _req('babel').transform(js, {
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
}).code
},
coffee: function (js) {
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//#if NODE
//#undef RIOT
/* riot-compiler 2.3.0-beta.6, @license MIT, (c) 2015 Muut Inc. + contributors */
/* riot-compiler 2.3.0, @license MIT, (c) 2015 Muut Inc. + contributors */
;(function (root, factory) {

/* istanbul ignore else */
Expand All @@ -22,7 +22,7 @@

/**
* Compiler for riot custom tags
* @version 2.3.0-beta.6
* @version 2.3.0
*/
//#endif

Expand Down
9 changes: 6 additions & 3 deletions lib/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ var parsers = (function () {

switch (name) {
case 'es6':
req = 'babel'
break
case 'babel':
req = 'babel-core'
break
case 'none':
Expand Down Expand Up @@ -96,12 +99,12 @@ var parsers = (function () {
},
es6: function (js) {
return _req('es6').transform(js, {
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
}).code
},
babel: /* istanbul ignore next */ function (js) {
babel: function (js) {
return _req('babel').transform(js, {
blacklist: ['useStrict', 'react'], sourceMaps: false, comments: false
presets: ['es2015'], ast: false, sourceMaps: false, comments: false
}).code
},
coffee: function (js) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "riot-compiler",
"version": "2.3.0-beta.6",
"version": "2.3.0",
"description": "Compiler for riot .tag files",
"main": "dist/compiler.js",
"directories": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"compiler"
],
"dependencies": {
"riot-tmpl": "^2.3.0-beta.8"
"riot-tmpl": "^2.3.0"
},
"devDependencies": {
"coveralls": "^2.11.4",
Expand Down
2 changes: 2 additions & 0 deletions test/specs/parsers/js/test-attr.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
riot.tag2('babel', '<div class="{className: true}" str="{className: true}" foo="{&quot;foo&quot; + bar}">Hello</div>', '', '', function(opts) {
}, '{ }');
2 changes: 0 additions & 2 deletions test/specs/parsers/js/test-attr.es6.js

This file was deleted.

5 changes: 5 additions & 0 deletions test/specs/parsers/js/test.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
riot.tag2('babel', '<h3>{test}</h3>', '', '', function(opts) {

var type = 'JavaScript';
this.test = 'This is ' + type;
}, '{ }');
18 changes: 13 additions & 5 deletions test/specs/parsers/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('HTML parsers', function () {

describe('JavaScript parsers', function () {

this.timeout(20000) // first call to babel-core is slooooow!
this.timeout(25000) // first call to babel-core is slooooow!

// complex.tag
it('complex tag structure', function () {
Expand Down Expand Up @@ -141,16 +141,24 @@ describe('JavaScript parsers', function () {
})

// testParser.es6.tag
it('es6 (babel-core 6.0.2+)', function () {
it('es6 (for babel 5.8.x)', function () {
if (have('es6')) {
testParser('test', { type: 'es6' })
}
})

// testParser.es6.tag
/*
it('new css.babel parser (babel-core 6.0.2+)', function () {
if (have('babel')) {
testParser('test', { type: 'babel' })
}
})*/

// testParser-attr.es6.tag
it('es6 with shorthands (fix #1090)', function () {
if (have('es6')) {
testParser('test-attr', { type: 'es6', expr: true })
it('babel with shorthands (fix #1090)', function () {
if (have('babel')) {
testParser('test-attr', { type: 'babel', expr: true })
}
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<es6> <!-- fix to riot #1090 -->
<babel> <!-- fix to riot #1090 -->
<div class={^ className: true } str={ className: true } foo={ `foo${ bar }` }>Hello</div>
</es6>
</babel>
9 changes: 9 additions & 0 deletions test/specs/parsers/test.babel.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

<babel>

<h3>{ test }</h3>

var type = 'JavaScript'
this.test = `This is ${type}`

</babel>

0 comments on commit feb4282

Please sign in to comment.