diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/package.json b/package.json index f422427..0699623 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,16 @@ }, "homepage": "https://github.com/gaearon/babel-plugin-react-transform#readme", "devDependencies": { - "babel": "^5.8.23", + "babel-cli": "^6.1.1", + "babel-core": "^6.0.0", + "babel-preset-es2015": "^6.0.15", "mocha": "^2.2.5", "rimraf": "^2.4.3" }, "scripts": { "clean": "rimraf lib", - "build": "babel-plugin build", - "test": "mocha --compilers js:babel/register", + "build": "babel src --out-dir lib --copy-files", + "test": "mocha --compilers js:babel-core/register", "test:watch": "npm run test -- --watch", "prepublish": "npm run clean && npm run build" }, diff --git a/src/index.js b/src/index.js index 737677e..0fb736c 100644 --- a/src/index.js +++ b/src/index.js @@ -230,7 +230,7 @@ export default function ({ types: t }) { const wrapReactComponentId = this.state[wrapComponentIdKey]; const uniqueId = addComponentRecord(node, scope, file, this.state); - return t.callExpression( + t.callExpression( t.callExpression(wrapReactComponentId, [t.stringLiteral(uniqueId)]), [node] ); @@ -278,7 +278,7 @@ export default function ({ types: t }) { // Create one uber function calling each transformation const wrapComponentId = this.state[wrapComponentIdKey]; const wrapComponent = defineWrapComponent(wrapComponentId, initTransformIds); - return t.program([ + t.program([ recordsVar, ...initTransformVars, wrapComponent, diff --git a/test/fixtures/classic/.babelrc b/test/fixtures/classic/.babelrc index c166d04..a23bf02 100644 --- a/test/fixtures/classic/.babelrc +++ b/test/fixtures/classic/.babelrc @@ -1,7 +1,7 @@ { - "plugins": ["../../../src"], - "extra": { - "react-transform": { + "presets": ["es2015"], + "plugins": [ + ["../../../src", { "transforms": [{ "transform": "my-custom-module/wrap", "locals": ["module"], @@ -9,6 +9,6 @@ }, { "transform": "my-other-custom-module/wrap" }] - } - } + }] + ] } diff --git a/test/fixtures/customFactoryMethod/.babelrc b/test/fixtures/customFactoryMethod/.babelrc index 3ca1131..4dd34e5 100644 --- a/test/fixtures/customFactoryMethod/.babelrc +++ b/test/fixtures/customFactoryMethod/.babelrc @@ -1,7 +1,7 @@ { - "plugins": ["../../../src"], - "extra": { - "react-transform": { + "presets": ["es2015"], + "plugins": [ + ["../../../src", { "transforms": [{ "transform": "my-custom-module/wrap", "locals": ["module"], @@ -14,6 +14,6 @@ "createClass", "myComponentFactory" ] - } - } + }] + ] } diff --git a/test/fixtures/modern/.babelrc b/test/fixtures/modern/.babelrc index c166d04..a23bf02 100644 --- a/test/fixtures/modern/.babelrc +++ b/test/fixtures/modern/.babelrc @@ -1,7 +1,7 @@ { - "plugins": ["../../../src"], - "extra": { - "react-transform": { + "presets": ["es2015"], + "plugins": [ + ["../../../src", { "transforms": [{ "transform": "my-custom-module/wrap", "locals": ["module"], @@ -9,6 +9,6 @@ }, { "transform": "my-other-custom-module/wrap" }] - } - } + }] + ] } diff --git a/test/fixtures/vanilla/.babelrc b/test/fixtures/vanilla/.babelrc index c166d04..1565b49 100644 --- a/test/fixtures/vanilla/.babelrc +++ b/test/fixtures/vanilla/.babelrc @@ -1,7 +1,7 @@ { - "plugins": ["../../../src"], - "extra": { - "react-transform": { + "presets": ["es2015"], + "plugins": [ + ["../../../src", { "transforms": [{ "transform": "my-custom-module/wrap", "locals": ["module"], @@ -9,6 +9,7 @@ }, { "transform": "my-other-custom-module/wrap" }] - } - } + + }] + ] } diff --git a/test/index.js b/test/index.js index b2d99a8..fc6ec37 100644 --- a/test/index.js +++ b/test/index.js @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs'; import assert from 'assert'; -import { transformFileSync } from 'babel'; +import { transformFileSync } from 'babel-core'; import plugin from '../src'; function trim(str) {