Skip to content

Commit

Permalink
v2018.4.18-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter T Bosse II committed Apr 18, 2018
1 parent 804831e commit 83b1116
Show file tree
Hide file tree
Showing 21 changed files with 1,759 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"packages": [
"packages/*"
],
"version": "2018.4.18-2"
"version": "2018.4.18-3"
}
2 changes: 1 addition & 1 deletion packages/animated-transition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"build": "babel src --out-dir . --ignore __tests__",
"watch": "babel -w src --out-dir . --ignore __tests__"
},
"version": "2018.4.18-2"
"version": "2018.4.18-3"
}
53 changes: 53 additions & 0 deletions packages/babel/flow/gatsby.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* @flow */

const apiRunnerNode = require(`./api-runner-node`)
const { store } = require(`../redux`)

const buildConfig = (abstractConfig, stage) => {
let babelrc = {
...abstractConfig.options,
presets: [],
plugins: [],
}

abstractConfig.presets.forEach(p =>
babelrc.presets.push([require.resolve(p.name), p.options])
)
abstractConfig.plugins.forEach(p =>
babelrc.plugins.push([require.resolve(p.name), p.options])
)

if (!babelrc.hasOwnProperty(`cacheDirectory`)) {
babelrc.cacheDirectory = true
}

if (stage === `develop`) {
// TODO: maybe this should be left to the user?
babelrc.plugins.unshift(require.resolve(`react-hot-loader/babel`))
}

// Make dynamic imports work during SSR.
if (stage === `build-html` || stage === `develop-html`) {
babelrc.plugins.unshift(require.resolve(`babel-plugin-dynamic-import-node`))
}

babelrc.plugins.unshift(
require.resolve(`babel-plugin-remove-graphql-queries`)
)

return babelrc
}

exports.buildConfig = buildConfig

/**
* Returns a normalized Babel config to use with babel-loader. All of
* the paths will be absolute so that Babel behaves as expected.
*/
exports.createBabelConfig = async function babelConfig(program, stage) {
await apiRunnerNode(`onCreateBabelConfig`, { stage })
const babelrcState = store.getState().babelrc
let babelrc = buildConfig(babelrcState.stages[stage], stage)

return babelrc
}
1 change: 1 addition & 0 deletions packages/babel/flow/gatsby.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions packages/babel/flow/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"babel": {
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"shippedProposals": true,
"targets": {
"node": "current"
},
"useBuiltIns": "entry"
}
],
"@babel/preset-flow"
]
},
"devDependencies": {
"@babel/cli": "latest",
"@babel/core": "latest",
"@babel/preset-env": "latest",
"@babel/preset-flow": "latest"
},
"scripts": {
"babel:build": "babel . -d . --ignore 'node_modules,public,__tests__' --minified --no-comments -x .es,.es6,.flow,.jsx,.mjs",
"babel:watch": "babel . -d . --ignore 'node_modules,public,__tests__' -w -x .es,.es6,.flow,.jsx,.mjs"
}
}
Loading

0 comments on commit 83b1116

Please sign in to comment.