Skip to content

Commit

Permalink
Use Babel 6
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Dec 15, 2015
1 parent e44e1e4 commit b2d2224
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"loose": "all",
"stage": 0
"presets": ["es2015-loose", "stage-0"],
"plugins": ["add-module-exports"]
}
18 changes: 13 additions & 5 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ gulp.task('build:docs', ['clean'], () => {

gulp.task('build:package', ['clean'], () => {
let editor = require('gulp-json-editor');
let builders = [
'babel-plugin-add-module-exports',
'babel-preset-es2015-loose',
'babel-preset-stage-0',
'babel-core'
];
return gulp.src('./package.json')
.pipe(editor( (p) => {
p.main = 'lib/postcss';
p.devDependencies['babel-core'] = p.dependencies['babel-core'];
delete p.dependencies['babel-core'];
return p;
.pipe(editor( (json) => {
json.main = 'lib/postcss';
for ( let i of builders ) {
json.devDependencies[i] = json.dependencies[i];
delete json.dependencies[i];
}
return json;
}))
.pipe(gulp.dest('build'));
});
Expand Down
2 changes: 1 addition & 1 deletion lib/container.es6
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class Container extends Node {
}

cleanRaws(keepBetween) {
super(keepBetween);
super.cleanRaws(keepBetween);
if ( this.nodes ) {
for ( let node of this.nodes ) node.cleanRaws(keepBetween);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/css-syntax-error.es6
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import supportsColor from 'supports-color';

import warnOnce from './warn-once';

export default class CssSyntaxError extends SyntaxError {
export default class CssSyntaxError {

name = 'CssSyntaxError';

constructor(message, line, column, source, file, plugin) {
super(message);
this.reason = message;

if ( file ) this.file = file;
Expand Down
12 changes: 6 additions & 6 deletions lib/input.es6
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ export default class Input {
}

error(message, line, column, opts = { }) {
let error;
let result;
let origin = this.origin(line, column);
if ( origin ) {
error = new CssSyntaxError(message, origin.line, origin.column,
result = new CssSyntaxError(message, origin.line, origin.column,
origin.source, origin.file, opts.plugin);
} else {
error = new CssSyntaxError(message, line, column,
result = new CssSyntaxError(message, line, column,
this.css, this.file, opts.plugin);
}

error.input = { line, column, source: this.css };
if ( this.file ) error.input.file = this.file;
result.input = { line, column, source: this.css };
if ( this.file ) result.input.file = this.file;

return error;
return result;
}

origin(line, column) {
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@
"license": "MIT",
"repository": "postcss/postcss",
"dependencies": {
"supports-color": "^3.1.2",
"source-map": "^0.5.1",
"babel-core": "5.8.25",
"js-base64": "^2.1.9"
"babel-plugin-add-module-exports": "0.1.1",
"babel-preset-es2015-loose": "6.1.3",
"babel-preset-stage-0": "6.3.13",
"supports-color": "^3.1.2",
"source-map": "^0.5.1",
"babel-core": "6.3.17",
"js-base64": "^2.1.9"
},
"devDependencies": {
"concat-with-sourcemaps": "1.0.4",
"postcss-parser-tests": "5.0.4",
"gulp-json-editor": "2.2.1",
"gulp-istanbul": "0.10.3",
"run-sequence": "1.1.5",
"babel-eslint": "4.1.5",
"babel-eslint": "5.0.0-beta6",
"gulp-eslint": "1.1.1",
"gulp-mocha": "2.2.0",
"gulp-babel": "5.3.0",
"gulp-babel": "6.1.1",
"strip-ansi": "3.0.0",
"gulp-shell": "0.5.1",
"yaspeller": "2.6.0",
"fs-extra": "0.26.2",
"isparta": "3.5.3",
"isparta": "4.0.0",
"eslint": "1.10.3",
"sinon": "1.17.2",
"mocha": "2.3.4",
Expand Down
2 changes: 1 addition & 1 deletion test/css-syntax-error.es6
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('CssSyntaxError', () => {

it('has stack trace', () => {
expect(parseError('a {\n content: "\n}').stack)
.to.match(/test\/css-syntax-error\.es6/);
.to.match(/css-syntax-error\.es6/);
});

it('highlights broken line', () => {
Expand Down

0 comments on commit b2d2224

Please sign in to comment.