diff --git a/.babelrc b/.babelrc index 8932ea1..7d1f29d 100644 --- a/.babelrc +++ b/.babelrc @@ -1,10 +1,33 @@ { - "presets": [ - "env", - "stage-0", - "react" - ], + "presets": ["@babel/preset-env", "@babel/preset-react"], "plugins": [ - "transform-runtime" + "@babel/plugin-transform-modules-commonjs", + "@babel/plugin-transform-runtime", + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-json-strings", + [ + "@babel/plugin-proposal-decorators", + { + "legacy": true + } + ], + "@babel/plugin-proposal-function-sent", + "@babel/plugin-proposal-export-namespace-from", + "@babel/plugin-proposal-numeric-separator", + "@babel/plugin-proposal-throw-expressions", + "@babel/plugin-proposal-export-default-from", + "@babel/plugin-proposal-logical-assignment-operators", + "@babel/plugin-proposal-optional-chaining", + [ + "@babel/plugin-proposal-pipeline-operator", + { + "proposal": "minimal" + } + ], + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-do-expressions", + "@babel/plugin-proposal-function-bind" ] } diff --git a/lib/config.js b/lib/config.js index df88d86..ec01ecf 100644 --- a/lib/config.js +++ b/lib/config.js @@ -9,13 +9,13 @@ const remark = { const babel = { presets: [ - 'babel-preset-env', - 'babel-preset-stage-0', - 'babel-preset-react', + '@babel/preset-env', + '@babel/preset-react' ].map(require.resolve), plugins: [ 'babel-plugin-macros', - 'babel-plugin-transform-runtime' + '@babel/plugin-transform-runtime', + '@babel/plugin-proposal-class-properties' ].map(require.resolve) } diff --git a/package.json b/package.json index 7b73de4..427318f 100644 --- a/package.json +++ b/package.json @@ -28,19 +28,35 @@ "author": "Brent Jackson", "license": "MIT", "dependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-decorators": "^7.0.0", + "@babel/plugin-proposal-do-expressions": "^7.0.0", + "@babel/plugin-proposal-export-default-from": "^7.0.0", + "@babel/plugin-proposal-export-namespace-from": "^7.0.0", + "@babel/plugin-proposal-function-bind": "^7.0.0", + "@babel/plugin-proposal-function-sent": "^7.0.0", + "@babel/plugin-proposal-json-strings": "^7.0.0", + "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-numeric-separator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-throw-expressions": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/plugin-transform-modules-commonjs": "^7.2.0", + "@babel/plugin-transform-runtime": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/preset-react": "^7.0.0", + "@babel/register": "^7.0.0", "@compositor/log": "^1.0.0-0", "@mdx-js/loader": "^0.15.0", "@mdx-js/mdx": "^0.15.0", "@mdx-js/tag": "^0.15.0", "@rebass/markdown": "^1.0.0-1", - "babel-core": "^6.26.3", - "babel-loader": "^7.1.4", + "babel-loader": "^8.0.0", "babel-plugin-macros": "^2.2.2", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.7.0", - "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", - "babel-register": "^6.26.0", "browser-env": "^3.2.5", "buble": "0.19.4", "chalk": "^2.4.1", @@ -85,7 +101,7 @@ }, "devDependencies": { "@compositor/logo": "^1.4.0", - "ava": "^0.25.0", + "ava": "^1.2.1", "isomorphic-fetch": "^2.2.1", "nyc": "^12.0.1", "react-test-renderer": "^16.4.1", @@ -128,11 +144,7 @@ "test/*", "!**/test/components", "!**/test/output" - ], - "require": [ - "babel-register" - ], - "babel": "inherit" + ] }, "engines": { "node": ">=8.0" diff --git a/test/mdx-fm-loader.js b/test/mdx-fm-loader.js index 222fb43..7616d63 100644 --- a/test/mdx-fm-loader.js +++ b/test/mdx-fm-loader.js @@ -1,9 +1,8 @@ import test from "ava"; import mdx from "@mdx-js/mdx"; -import { transform } from "babel-core"; -import env from "babel-preset-env"; -import react from "babel-preset-react"; -import stage0 from "babel-preset-stage-0"; +import { transform } from "@babel/core"; +import env from "@babel/preset-env"; +import react from "@babel/preset-react"; import fmLoader from "../lib/mdx-fm-loader"; @@ -17,7 +16,7 @@ test("mdx-fm-loader", async t => { return (err, result) => { t.is(err, null, "mdx-fm-loader should not error"); t.notThrows(() => { - transform(mdx.sync(result), { presets: [env, react, stage0] }); + transform(mdx.sync(result), { presets: [env, react] }); }, SyntaxError); }; } diff --git a/test/snapshots/build.js.snap b/test/snapshots/build.js.snap index 5034be3..5455ece 100644 Binary files a/test/snapshots/build.js.snap and b/test/snapshots/build.js.snap differ diff --git a/test/snapshots/template.js.snap b/test/snapshots/template.js.snap index 1071cca..1195eac 100644 Binary files a/test/snapshots/template.js.snap and b/test/snapshots/template.js.snap differ