Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update babel to 7 & ava to 1 #117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -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"
]
}
8 changes: 4 additions & 4 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the reason that you got the error about the import in the test is that there's still things missing from the plugins.

It's super confusing based on how the official babel upgrade doc is worded, but I think to get equivalent functionality we need all of the stuff used in stage 0-2. I think all the extras where added by the babel upgarde tool to the package.json already. They probably just need to be added here.

And we might need to add them to mdx loader as plugins as well? Some of those handle the syntax for import.

I could absolutely be wrong about all of this.

].map(require.resolve)
}

Expand Down
38 changes: 25 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -128,11 +144,7 @@
"test/*",
"!**/test/components",
"!**/test/output"
],
"require": [
"babel-register"
],
"babel": "inherit"
]
},
"engines": {
"node": ">=8.0"
Expand Down
9 changes: 4 additions & 5 deletions test/mdx-fm-loader.js
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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);
};
}
Expand Down
Binary file modified test/snapshots/build.js.snap
Binary file not shown.
Binary file modified test/snapshots/template.js.snap
Binary file not shown.