diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000000..b5fe4a7d0a --- /dev/null +++ b/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["es2015", "react", "stage-0"], + "plugins": ["transform-runtime"] +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..37bb71f684 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +test +lib diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..3063f07d55 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +lib +node_modules diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..f2a6d3cad3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +--- +git: + depth: 1 +sudo: false +language: node_js +cache: + directories: + - node_modules + +node_js: + - "5" + - "4" + - iojs + - "0.12" + +script: npm test + +notifications: + slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..4ead0e1daf --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,13 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. + +Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..fc491e86a8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +# Contributing + +Contributions are always welcome, no matter how large or small. Before +contributing, please read the +[code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md). diff --git a/package.json b/package.json index 651825d860..0d1e36b1b7 100644 --- a/package.json +++ b/package.json @@ -5,15 +5,29 @@ "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", - "repository": "https://github.com/babel/babel/tree/master/packages/babylon", + "repository": "https://github.com/babel/babylon", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^5.0.0" + "babel-runtime": "^6.0.0" }, "devDependencies": { - "babel-helper-fixtures": "^6.6.5" + "ava": "^0.12.0", + "babel-cli": "^6.0.0", + "babel-helper-fixtures": "^6.6.5", + "babel-plugin-transform-class-properties": "^6.6.0", + "babel-plugin-transform-runtime": "^6.0.0", + "babel-preset-es2015": "^6.0.0", + "babel-preset-react": "^6.0.0", + "babel-preset-stage-0": "^6.5.0", + "kcheck": "^2.0.1" }, "bin": { "babylon": "./bin/babylon.js" + }, + "scripts": { + "test": "npm run build && npm run lint && ava test/", + "lint": "kcheck", + "build": "babel src --out-dir lib", + "watch": "babel src --out-dir lib --watch" } } diff --git a/scripts/_util.js b/scripts/_util.js deleted file mode 100644 index 74da881da0..0000000000 --- a/scripts/_util.js +++ /dev/null @@ -1,7 +0,0 @@ -var fs = require("fs"); - -exports.updateMain = function (main) { - var pkg = require("../package.json"); - pkg.main = main; - fs.writeFileSync(__dirname + "/../package.json", JSON.stringify(pkg, null, " ")); -}; diff --git a/scripts/postpublish.js b/scripts/postpublish.js deleted file mode 100644 index 0c6f9bbd74..0000000000 --- a/scripts/postpublish.js +++ /dev/null @@ -1,2 +0,0 @@ -require("./_util").updateMain("lib/index.js"); -require("fs").unlinkSync(__dirname + "/../index.js"); diff --git a/scripts/prepublish.js b/scripts/prepublish.js deleted file mode 100644 index a1864cc25d..0000000000 --- a/scripts/prepublish.js +++ /dev/null @@ -1,8 +0,0 @@ -require("./_util").updateMain("index.js"); -require("child_process").execSync( - __dirname + "/../../../node_modules/.bin/browserify " + - "--standalone babylon " + - "--entry " + __dirname + "/../lib/index.js " + - "--plugin bundle-collapser/plugin " + - "--plugin derequire/plugin " + - "--outfile " + __dirname + "/../index.js", { encoding: "utf8" }); diff --git a/test/fixtures/core/regression/T2921/expected.json b/test/fixtures/core/regression/T2921/expected.json new file mode 100644 index 0000000000..9df924963b --- /dev/null +++ b/test/fixtures/core/regression/T2921/expected.json @@ -0,0 +1,97 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "name": "a" + }, + "operator": "<==", + "right": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "b" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/index.js b/test/index.js index 72b64d62c7..be432625b0 100644 --- a/test/index.js +++ b/test/index.js @@ -1,21 +1,20 @@ var getFixtures = require("babel-helper-fixtures").multiple; var parse = require("../lib").parse; +var test = require("ava"); var _ = require("lodash"); var fixtures = getFixtures(__dirname + "/fixtures"); _.each(fixtures, function (suites, name) { _.each(suites, function (testSuite) { - suite(name + "/" + testSuite.title, function () { - _.each(testSuite.tests, function (task) { - test(task.title, !task.disabled && function () { - try { - return runTest(task); - } catch (err) { - err.message = task.actual.loc + ": " + err.message; - throw err; - } - }); + _.each(testSuite.tests, function (task) { + test(name + "/" + testSuite.title + "/" + task.title, !task.disabled && function () { + try { + return runTest(task); + } catch (err) { + err.message = task.actual.loc + ": " + err.message; + throw err; + } }); }); });