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

[v2] sourceType: 'unambigious' is a general babel config option, not for @babel/preset-env #5336

Merged
merged 2 commits into from
May 9, 2018
Merged
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
7 changes: 3 additions & 4 deletions packages/gatsby/cache-dir/api-runner-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// },
// ]

export function apiRunner(api, args, defaultReturn) {
exports.apiRunner = (api, args, defaultReturn) => {
// eslint-disable-next-line no-undef
let results = plugins.map(plugin => {
if (!plugin.plugin[api]) {
Expand All @@ -33,13 +33,12 @@ export function apiRunner(api, args, defaultReturn) {
}
}

export function apiRunnerAsync(api, args, defaultReturn) {
exports.apiRunnerAsync = (api, args, defaultReturn) =>
// eslint-disable-next-line no-undef
return plugins.reduce(
plugins.reduce(
(previous, next) =>
next.plugin[api]
? previous.then(() => next.plugin[api](args, next.options))
: previous,
Promise.resolve()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ const addDefaultPluginsPresets = (
loose: true,
modules: false,
useBuiltIns: `usage`,
sourceType: `unambiguous`,
shippedProposals: true, // includes async/await and Object spread/rest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@existentialism mentioned also in the babel slack while I was figuring this out that beta 43/44 shipped support for ES2018 so this isn't needed anymore.

targets,
},
})
Expand Down
28 changes: 19 additions & 9 deletions packages/gatsby/src/redux/__tests__/__snapshots__/babelrc.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand All @@ -20,6 +21,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand All @@ -33,6 +35,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand All @@ -46,6 +49,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand All @@ -66,6 +70,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [
Expand All @@ -79,6 +84,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [
Expand All @@ -92,6 +98,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [
Expand All @@ -105,6 +112,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [
Expand All @@ -125,6 +133,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -181,6 +190,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -237,6 +247,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -293,6 +304,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -356,6 +368,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -386,10 +399,8 @@ Object {
"options": Object {
"loose": true,
"modules": false,
"shippedProposals": true,
"sourceType": "unambiguous",
"targets": Object {
"browsers": Object {},
"node": "current",
},
"useBuiltIns": "usage",
},
Expand All @@ -415,6 +426,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [],
Expand All @@ -423,6 +435,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [
Object {
Expand Down Expand Up @@ -453,8 +466,6 @@ Object {
"options": Object {
"loose": true,
"modules": false,
"shippedProposals": true,
"sourceType": "unambiguous",
"targets": Object {
"browsers": Object {},
},
Expand Down Expand Up @@ -482,6 +493,7 @@ Object {
"options": Object {
"babelrc": false,
"cacheDirectory": true,
"sourceType": "unambiguous",
},
"plugins": Array [],
"presets": Array [],
Expand Down Expand Up @@ -522,8 +534,6 @@ Object {
Object {
"loose": true,
"modules": false,
"shippedProposals": true,
"sourceType": "unambiguous",
"targets": Object {
"browsers": Object {},
},
Expand All @@ -543,6 +553,7 @@ Object {
Object {},
],
],
"sourceType": "unambiguous",
}
`;

Expand Down Expand Up @@ -578,8 +589,6 @@ Object {
Object {
"loose": true,
"modules": false,
"shippedProposals": true,
"sourceType": "unambiguous",
"targets": Object {
"browsers": Object {},
},
Expand All @@ -599,5 +608,6 @@ Object {
Object {},
],
],
"sourceType": "unambiguous",
}
`;
4 changes: 4 additions & 0 deletions packages/gatsby/src/redux/reducers/babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = (
options: {
cacheDirectory: true,
babelrc: false,
sourceType: `unambiguous`,
},
},
"develop-html": {
Expand All @@ -17,6 +18,7 @@ module.exports = (
options: {
cacheDirectory: true,
babelrc: false,
sourceType: `unambiguous`,
},
},
"build-html": {
Expand All @@ -25,6 +27,7 @@ module.exports = (
options: {
cacheDirectory: true,
babelrc: false,
sourceType: `unambiguous`,
},
},
"build-javascript": {
Expand All @@ -33,6 +36,7 @@ module.exports = (
options: {
cacheDirectory: true,
babelrc: false,
sourceType: `unambiguous`,
},
},
},
Expand Down